Uh oh!
There was an error while loading. Please reload this page.
fix(headless): record OpenCode prompt provenance accurately - #1781
fix(headless): record OpenCode prompt provenance accurately#1781AlvaroBalbin wants to merge 3 commits into
Conversation
Astro-Han
left a comment
There was a problem hiding this comment.
Reviewed the current head. OpenCode execution identity now comes from the verified toolchain fingerprint, while Maka-owned prompt hashes stay separate. The validation and legacy decoding paths are consistent, and the focused checks pass. I found no issues in the patch.
The branch currently conflicts with main, so the resolved head will need another review.
Astro-Han
left a comment
There was a problem hiding this comment.
Review: Approve (with comments)
The seam choice is right: producer (opencode_agent.py), validator (cell-output.ts), and controller (fixed-prompt-controller.ts) move together, and the resulting identity states the model-visible truth — the prompt is owned by the harness and identified by the pinned toolchain fingerprint. The Python-side prompt-invariance test pins the exact repro from #1563. Approving, with a few non-blocking comments below.
The new schema comment codifies the original falsehood for legacy artifacts.
cell-output.tssays of absentsystemPromptAuthority: "artifacts written before harness-owned prompts were recorded, which are Maka-injected." That claim is false for exactly the artifacts this PR is about: pre-fix OpenCode cells have no authority, do carry asystemPromptHash, and were not Maka-injected. Theelsebranch in the validator likewise conflates "absent" with'maka'. Suggest stating the absent semantics as unknown / pre-audit rather than asserting something we know is untrue — truthful provenance is the point of this PR.The
harness-nativeskip inclassifyExecutionIdentityFailureis untested and leaves the cohort hole half-closed. Skipping the prompt-hash comparison for harness-native cells is correct, but (a) nothing pins this deliberate relaxation — a test where the round prompt mismatches and a harness-native cell is still accepted would lock it in; (b)systemPromptToolchainis never compared against an expected fingerprint, so a cell run with the wrong pinned toolchain passes identity checks. Fine as a follow-up, but worth an explicit test + a tracking note now.'maka'has no producer. Neithermaka_agent.pynor theharbor-cli.tspath emitssystemPromptAuthority, so the enum value exists only in the validator. Either emit it from the Maka paths (self-describing, and it is exactly what a future crossed prompt-injection ablation would need), or drop it and make "absent means Maka-owned" the single semantic. The current middle state buys a mutual-exclusion branch that nothing exercises.or "unpinned"weakens the invariant the validator just established.install()already raises whenMAKA_OPENCODE_TOOLCHAIN_FINGERPRINTis missing, so the fallback is unreachable in practice — and if it ever did fire, the literal string"unpinned"would satisfysystemPromptToolchain must pin the harness build. Prefer dropping the fallback and letting the Python side fail loud.Cell-level
promptHashsemantics deserve one line of documentation. Keeping_round_prompt_hash()at the cell level is correct —attestedPromptHash→eventMatchesResumeIdentitydepends on it, and it attests round membership rather than model-visible bytes. ButHarborCellOutput.promptHashdoesn't say that, so a downstream reader can repeat the #1563 misreading one field level up. A short comment fixes it.
None of these change behavior; 1, 3, and 4 are small deletions/edits, 2 and 5 are test/comment additions.
AlvaroBalbin
commented
Aug 15, 2026
Closing this. The provenance point survives in the new design anyway: Nothing worth rebasing onto the new kernel. Thanks @Astro-Han for the two reviews. |
This is a small, targeted change to packages/headless/harbor/opencode_agent.py, .../headless/src/tests/cell-output.test.ts, .../src/tests/fixed-prompt-controller.test.ts, .../headless/src/tests/harbor-adapter.test.ts and a few others that resolves the reported issue without touching anything unrelated.
The repo's own CI runs green on this branch; I ran it on my fork before opening this.
Fixes#1563.