Skip to content

fix(opencode): carry #781's prompt and cassette change with truthful Anthropic provenance (Refs #772) - #785

Merged
agenteinstinct1-max merged 1 commit into
dev-vibecodedfrom
arena/688d6534-silvercode
Nov 1, 2026
Merged

agenteinstinct1-max merged 1 commit into
dev-vibecodedfrom
arena/688d6534-silvercode

Conversation

@agenteinstinct1-max

@agenteinstinct1-max agenteinstinct1-max commented Nov 1, 2026 •

Copy link
Copy Markdown
Collaborator

Issue for this PR

Refs #772

#772 stays open: this PR targets dev-vibecoded, and GitHub only auto-closes issues from PRs merged into the repository default branch (dev). The reference is here to satisfy the linked-issue check in pr-standards.yml, not to close the issue.

This is a normal replacement for #781 (arena/7845744d-silvercode, head e1f0268f880e83cc2dbfb15f43330e8aaa623066). It carries #781's own eight files on top of the current accepted tip 897e85177c03b0dfb8618e1f3cf09250a9cbebe6, with exactly one correction: a false provenance timestamp in the Anthropic cassette. I did not touch #781 and did not close it — its branch is not mine to push to, and nothing here retires it.

One ordinary commit directly on 897e851 (git rev-list --count 897e851..3130a9a = 1), pushed as a normal fast-forward to a new branch. No rebase, no force-push, no force-lease, no history rewrite, no seeded parents, no 2-dot revert.

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

One commit, 3130a9a, on top of 897e851: #781's eight files, plus the removal of one metadata field that claimed a date nobody can support.

The eight files are the change already technically reviewed in #781 (#776's change plus the Windows canonical-text fix and the cassette request refresh):

  1. packages/opencode/src/session/prompt/efficiency.txt (new) — fast/quick/direct at every effort level; targeted searches then batched range reads; independent read/grep/glob calls in parallel, dependent calls sequential.
  2. packages/opencode/src/session/llm/request.ts — injects that block into the system prompt of every prepared request in LLMRequestPrep.prepare, and canonicalizes each system-prompt part to LF before the \n-join, so a CRLF checkout cannot change request bytes on any platform, provider, agent or effort level.
  3. packages/opencode/src/agent/prompt/review.txt — Review may not author tests or scripts, make production edits, fix the implementation, or take over Code/Work; existing non-destructive checks stay allowed; the Assessment/verdict envelope is unchanged.
  4. packages/opencode/test/session/ste-lite.test.ts — assembly regression across fast/medium/thorough, the CRLF control, and the Review text contract.
  5. specs/agent-effort.md — documents efficient work at every level.
    6–8. The three native cassettes' recorded requests refreshed for the new instructions.

The correction — the only delta from e1f0268. native-anthropic-tool-loop.json carried

   "recordedAt": "2026-05-19T01:40:12.788Z",
-  "requestBodiesRecapturedAt": "2026-05-19T01:40:12.788Z",
   "requestBodiesRecapturedFrom": "replayed-recorded-responses",

The recapture value was byte-identical to that file's own recordedAt, i.e. it was copied from the original recording date rather than measured. The actual instant at which the Anthropic request bodies were recaptured is not established, and I did not invent one. The field is removed instead of guessed; recordedAt keeps the original recording date and requestBodiesRecapturedFrom: "replayed-recorded-responses" stays, so the file still says how the requests were reproduced while claiming no date it cannot support. Cassette metadata is Record<string, unknown> (packages/http-recorder/src/schema.ts), so the absence of that key is valid, and nothing reads it (grep -rn requestBodiesRecaptured finds no reader).

The OpenAI OAuth and Zen cassettes keep their own requestBodiesRecapturedAt values (2026-11-01T06:25:38.547Z, 2026-11-01T06:25:39.242Z) exactly as #781 recorded them. I did not re-measure those and make no claim about them beyond "unchanged from the branch under review".

git diff e1f0268 3130a9a is that one deleted line and nothing else.

What is preserved, byte for byte

Mechanically checked against 897e851 for all three cassettes (a script compared parsed JSON, not textual diffs):

  • Every recorded response object is deep-equal — status, headers and body — so the tool-loop assertions (get_weather, "Paris is sunny"), the encrypted reasoning blobs and the recorded function-call arguments are untouched.
  • Request method, URL, headers and interaction count (2 each) are identical.
  • The only request-body delta is the inserted efficiency block inside the system text: removing that exact block from each new body reproduces the 897e851 text, and no non-system request field changed.
  • No \r byte in any of the three files.
  • Metadata delta is only requestBodiesRecapturedFrom (Anthropic) and requestBodiesRecapturedAt + requestBodiesRecapturedFrom (OpenAI, Zen); recordedAt is unchanged everywhere and no pre-existing key changed.

Deliberately unchanged historical evidence: the OpenAI Responses stream echoes instructions inside its recorded response objects, so that echo still shows the old prompt while the adjacent recorded request carries the new one. Rewriting it would fabricate provider output, so it stays exactly as originally recorded — it is recorded evidence about the old prompt, not a claim that a provider saw the new one.

Honest limits

  • No live or paid provider recapture. No network call to any provider, no credential, no RECORD=true run. The requests were reproduced by the real recorder path over replayed recorded response bytes, as in fix(opencode): clarify review and efficient tool use, canonical request text for Windows (Refs #772) #781.
  • The Anthropic recapture date is unknown and is now simply absent. A future live re-record would write a real one and drop these fields automatically, because the test's metadata does not contain them.
  • The response bodies were produced by the providers under the old prompt. Nothing here establishes model compliance with the new prompt in live use.
  • session/native-openai-tool-loop has never existed in the repo, so the "OpenAI API key" scenario still skips rather than exercising the API-key path.
  • This does not change how prompts are stored on disk; a CRLF checkout still has CRLF assets, it just cannot alter request bytes.
  • The two older dev-vibecoded failures remain of unproven cause. This PR claims no isolation, no waiver and no exoneration for them, and it makes no causal claim about them.
  • No independent review of this head exists yet; it is a draft. The previously cited verdicts were given on e1f0268 and are re-stated below only as history, not as an approval of 3130a9a.

How did you verify your code works?

Linux sandbox, 2 vCPU / 3.9 GB RAM, Bun 1.3.14 installed outside the repo from the pinned npm binary, bun install --frozen-lockfile --ignore-scripts.

  • Native cassettes — bun test test/session/llm-native-recorded.test.ts: 3 pass, 1 skip, 0 fail, 24 assertions (OpenAI OAuth, OpenCode proxy, Anthropic API key pass; the never-recorded OpenAI API-key scenario skips).
  • Prompt assembly / contract tests — bun test test/session/ste-lite.test.ts: 9 pass, 0 fail, 64 assertions, including request includes efficiency guidance for every effort with provider and Review prompts, request text stays canonical LF when prompt sources use CRLF line endings, and Review preserves its report contract and evaluates without taking over.
  • Full package suite (this head) — bun test --timeout 30000 in packages/opencode: 4933 pass, 25 skip, 1 todo, 0 fail across 342 files, 50 snapshots, 21338 assertions, 1436 s. Pass/skip/todo/fail counts match the qualifier's e1f0268 run; the expectation counter reads 21338 here against 21340 there and I did not chase that two-count difference. No test, assertion or timeout was weakened and no new skip was added.
  • Typecheck — tsc --noEmit -p packages/opencode/tsconfig.json with NODE_OPTIONS=--max-old-space-size=3072: exit 0, empty output (the exit code was captured directly, not through a pipe).
  • Cassette fidelity — the mechanical before/after check described above: FIDELITY OK for all three files, including every response object deep-equal and the Anthropic metadata delta reduced to requestBodiesRecapturedFrom.
  • Hygiene — prettier --check clean on the changed JSON/TS/spec files (the two .txt prompts have no parser, which is expected); git diff --check clean; git status clean apart from the commit itself.

CI on this head

3130a9a95db44d298b09f313758b9893acbbb67d — runs 41297710105, 41297710074, 41297710088:

  • unit (linux) — pass, 22m 1s
  • unit (windows) — pass, 41m 50s (the platform the canonical-LF fix exists for)
  • typecheck — pass, 1m 59s
  • check-standards, check-compliance, add-contributor-label — pass

That is CI for this exact head; nothing above is inferred from #781's green run.

Review trail (history, not an approval of this head)

  • Technical review 01a19635-4f98-780e-b202-0fc42988b459 on e1f0268: CRLF controls and cassette fidelity, native 3 pass / 1 skip, bun test test/session 867 pass / 8 skip / 1 todo — APPROVE.
  • Narrow qualifier 01a1966c-93e0-75c7-b45c-bb67bda0eadb on e1f0268: fresh sequential full run 4933 pass / 25 skip / 1 todo / 0 fail in 1168 s — its sole remaining block was the provenance line this PR removes.

Screenshots / recordings

Not a UI change, and no provider was contacted.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

… (Refs #772)

This commit carries the eight files of PR #781 (head e1f0268, branch
arena/7845744d-silvercode) on top of the current accepted tip 897e851, with
exactly one correction: the Anthropic cassette's recapture timestamp.

- review.txt: Review may not author tests or scripts, make production edits,
  fix the implementation, or take over Code/Work; the report contract is
  unchanged.
- efficiency.txt (new) + llm/request.ts: the shared efficiency prompt is
  injected in LLMRequestPrep.prepare for every agent, provider and effort
  level, and each system-prompt part is canonicalized to LF before the
  `\n`-join, so a CRLF checkout cannot change request bytes (Windows fix).
- ste-lite.test.ts: assembly regression across fast/medium/thorough, the CRLF
  control, and the Review text contract.
- specs/agent-effort.md: documents efficient work at every level.
- The three native cassettes' recorded requests are refreshed for the new
  instructions. Recorded responses are untouched.

Provenance correction (this commit's only delta from e1f0268):
native-anthropic-tool-loop.json had
  "requestBodiesRecapturedAt": "2026-05-19T01:40:12.788Z"
which is byte-identical to that file's `recordedAt`. The Anthropic recapture
instant is not established, so that value was not a measurement and is
removed rather than guessed. `recordedAt` keeps the original recording date
and `requestBodiesRecapturedFrom: "replayed-recorded-responses"` stays, so
the file claims how the requests were reproduced but no date it cannot
support. The OpenAI and Zen cassettes keep their own recapture timestamps.

No request/response bytes, URLs, headers, methods or interaction counts
change apart from the already-reviewed request refresh; the OpenAI Responses
`instructions` echo inside the recorded response bodies stays exactly as
recorded. No live or paid provider call was made.

Co-authored-by: arena-agent <[email protected]>
@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@agenteinstinct1-max
agenteinstinct1-max marked this pull request as ready for review November 1, 2026 12:24
@agenteinstinct1-max
agenteinstinct1-max merged commit 50d6a23 into dev-vibecoded Nov 1, 2026
8 checks passed
@kilo-code-bot

kilo-code-bot Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (8 files)
  • packages/opencode/src/session/llm/request.ts
  • packages/opencode/src/session/prompt/efficiency.txt (new)
  • packages/opencode/src/agent/prompt/review.txt
  • packages/opencode/test/session/ste-lite.test.ts
  • packages/opencode/test/fixtures/recordings/session/native-anthropic-tool-loop.json
  • packages/opencode/test/fixtures/recordings/session/native-openai-oauth-tool-loop.json
  • packages/opencode/test/fixtures/recordings/session/native-zen-tool-loop.json
  • specs/agent-effort.md

Reviewed by free · Input: 71.3K · Output: 11.4K · Cached: 91.1K

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant