diff options
| author | Drew Ritter <drew@primeradiant.com> | 2026-11-02 13:31:53 -0800 |
|---|---|---|
| committer | Drew Ritter <drew@primeradiant.com> | 2026-11-02 13:31:53 -0800 |
| commit | 38fd8323e43f4b13e8bdc9d62b85ca1ed524a3f8 (patch) | |
| tree | 335eecee026317ef5699bf6f0a0da7104cffed7b /tests/opencode | |
| parent | 80b085cfb36c0dfe5f6740a3a4764d16429a8228 (diff) | |
| parent | 587f04636d67a32d2edf65550085cdf2d70260a4 (diff) | |
Merge dev into the OpenCode compaction bootstrap fixfix/2391-opencode-compaction-bootstrap
Drew requested resolution of the merge conflict in obra/superpowers PR
#2601. Merge current dev into the existing PR branch without rewriting its
history.
Resolve the V2 bootstrap hunk by keeping #2601's shared handler registered
on context, compaction, and generate, and incorporating #2600's exact
BOOTSTRAP_MARKER prefix guard. This preserves injection for prompts that
merely mention EXTREMELY_IMPORTANT while preventing duplicate bootstrap
parts. All other dev changes merge without manual edits.
Validation: bash tests/opencode/run-tests.sh passed all five suites,
including hook registration, tag-mention regression coverage, child-session
suppression, caching, and skill registration. git diff --cached --check
passed and the index contains no unresolved paths. Live OpenCode
integration sessions were not rerun for this conflict-only repair.
Tracking: PRI-3674
Diffstat (limited to 'tests/opencode')
| -rw-r--r-- | tests/opencode/test-bootstrap-caching.mjs | 22 | ||||
| -rw-r--r-- | tests/opencode/test-session-bootstrap.mjs | 10 |
2 files changed, 32 insertions, 0 deletions
diff --git a/tests/opencode/test-bootstrap-caching.mjs b/tests/opencode/test-bootstrap-caching.mjs index 386b7b1..39e4daa 100644 --- a/tests/opencode/test-bootstrap-caching.mjs +++ b/tests/opencode/test-bootstrap-caching.mjs @@ -76,6 +76,9 @@ const failures = scenario === 'present' if (scenario === 'present') { failures.push(...assertV2Bootstrap(result)); + // #2583: both flavors register bare skill ids and look them up exactly. + failures.push(...assertTeachesBareSkillIds('V1', bootstrapText(firstOutput), 'name')); + failures.push(...assertTeachesBareSkillIds('V2', v2Result.text, 'id')); } failures.push(...mappingFailures); @@ -202,6 +205,25 @@ function assertMappingConstants(mod) { return failures; } +// #2583: skills reference each other as `superpowers:<name>` (the Claude Code +// plugin namespace), but OpenCode V1 and V2 register bare ids (`brainstorming`) +// and their `skill` tools do an exact lookup, so a namespaced call fails with +// "Unable to load skill". When the injected bootstrap contains namespaced +// references, its tool mapping must tell the model to drop the prefix, using +// the flavor's `skill` parameter (V1 `name`, V2 `id`). +function assertTeachesBareSkillIds(flavor, text, param) { + const failures = []; + const refs = [...new Set(text.match(/superpowers:[a-z0-9-]+/g) || [])]; + if (refs.length === 0) return failures; + if (!text.includes('drop the `superpowers:` prefix')) { + failures.push(`expected ${flavor} bootstrap to tell the model to drop the superpowers: prefix (bootstrap references ${refs.join(', ')})`); + } + if (!text.includes(`\`superpowers:brainstorming\` → \`skill\` with \`${param}: "brainstorming"\``)) { + failures.push(`expected ${flavor} bootstrap to show superpowers:brainstorming loading as \`skill\` with \`${param}: "brainstorming"\``); + } + return failures; +} + // Drive setup() with a mock V2 ctx and fire the captured "context" hook on a // top-level (parentID-less) session. Returns the injected-part count and the // injected bootstrap text ('' when nothing was injected). diff --git a/tests/opencode/test-session-bootstrap.mjs b/tests/opencode/test-session-bootstrap.mjs index 31658d5..67b3118 100644 --- a/tests/opencode/test-session-bootstrap.mjs +++ b/tests/opencode/test-session-bootstrap.mjs @@ -139,6 +139,16 @@ for (const flavor of ['v1', 'v2']) { await unknown.invoke(noID); assert.equal(bootstrapCount(noID), 1); assert.deepEqual(unknown.lookups, []); + + // #2197: a prompt that merely mentions the bootstrap's tag is not the bootstrap. + const mentions = await makeHarness(flavor, (id) => reply(flavor, { id })); + const probe = makeEvent(flavor, `${flavor}-mentions-tag`); + (probe.messages[0].parts ?? probe.messages[0].content)[0].text = + "Is there an 'EXTREMELY_IMPORTANT' block in your context?"; + await mentions.invoke(probe); + assert.equal(bootstrapCount(probe), 1, `${flavor}: prompt mentioning the tag still gets bootstrap`); + await mentions.invoke(probe); + assert.equal(bootstrapCount(probe), 1, `${flavor}: prompt mentioning the tag, repeated event`); } function compactedEvent(sessionID) { |
