From 8f4b3dbd2f5ef8163e4daed5ca43a4cf08eb5d8c Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Thu, 22 Oct 2026 21:04:25 +0000 Subject: fix(opencode): tell the model skill ids are bare names (#2583) Skills name each other with the Claude Code plugin namespace (`superpowers:brainstorming`), and the using-superpowers bootstrap that the OpenCode plugin injects says "Let's build X -> superpowers:brainstorming first". OpenCode registers superpowers skills under bare ids (`brainstorming`) on both flavors and its `skill` tool does an exact lookup, so a model that copies the namespaced form gets "Unable to load skill superpowers:brainstorming" (V2) or `Skill "superpowers:brainstorming" not found` (V1) and carries on without the skill. The OpenCode tool mapping said only "Invoke a skill -> OpenCode's native skill tool" and never stated the id convention. Reproduced on real hosts (OpenCode 2.1.2 and opencode-ai 1.19.4) with a scripted stub provider: the namespaced call fails, the bare id loads. Add the convention to the "Invoke a skill" line of both mappings, with each flavor's real skill parameter (V1 `name`, V2 `id`), and mirror it in docs/README.opencode.md. Skill prose keeps the prefix, which is correct on Claude Code; the translation belongs in the harness mapping, the same way the Hermes reference shows bare `skill_view("brainstorming")`. Claude-Session: https://claude.ai/code/session_01SHANcr4A71nzuU9et4Fnba --- tests/opencode/test-bootstrap-caching.mjs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'tests/opencode') 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:` (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). -- cgit From 9e663a0dd87ac082f10f8ee6b46476951be027d1 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Thu, 22 Oct 2026 22:26:39 +0000 Subject: fix(opencode): don't mistake a prompt that mentions EXTREMELY_IMPORTANT for the bootstrap Both bootstrap injectors skip a first user message whose text parts include the substring 'EXTREMELY_IMPORTANT', to avoid injecting twice into the same message. Any user prompt that names the tag matches too, so the bootstrap is silently dropped for that session. That is what #2197 hit. The reporter's probe was opencode run "Is there an 'EXTREMELY_IMPORTANT' block in your context? ..." and the prompt itself tripped the guard. `opencode run` is not the cause: with the real hosts (V1 1.18.21 path and git-package forms, V1 1.19.4, V2 2.1.2, V2 2.1.3) and a request-recording stub model, the reporter's prompt reaches the model without the bootstrap on every host, and a neutral prompt gets the bootstrap on every host. Match the bootstrap's own opening line at the start of a part instead. The injected part always starts with it (the template now uses the same constant), so the double-injection guard keeps working, and a prompt that only mentions the tag no longer suppresses the bootstrap. Fixes #2197 Claude-Session: https://claude.ai/code/session_01SHANcr4A71nzuU9et4Fnba --- tests/opencode/test-session-bootstrap.mjs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tests/opencode') 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) { -- cgit