diff options
| author | Jesse Vincent <jesse@fsck.com> | 2026-10-22 22:26:39 +0000 |
|---|---|---|
| committer | Jesse Vincent <jesse@fsck.com> | 2026-10-22 22:55:47 +0000 |
| commit | 9e663a0dd87ac082f10f8ee6b46476951be027d1 (patch) | |
| tree | ff4adb67a468856e9aaecc9513b525e6776e333b /tests | |
| parent | b58deb3b948d4c305feeac122700100419ee2777 (diff) | |
fix(opencode): don't mistake a prompt that mentions EXTREMELY_IMPORTANT for the bootstrapfix/2197-opencode-bootstrap-guard
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
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/opencode/test-session-bootstrap.mjs | 10 |
1 files changed, 10 insertions, 0 deletions
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) { |
