Derive canary qualification from retained evidence - #53
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e085bc900c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| function completed(calls: readonly ObservedCall[], tool: string): boolean { | ||
| return calls.some( | ||
| (call) => | ||
| call.tool === tool && | ||
| (call.status === "completed" || call.status === "ok"), | ||
| ); |
There was a problem hiding this comment.
Reject application-level tool failures
When a Flow handler rejects an operation, execute() catches the exception and returns a serialized {status:"error"} response (src/platform/opencode/tools.ts:118-128), so OpenCode still records the tool part itself as completed. This helper therefore credits rejected plan-save, validation, review, and close calls; because the session document is evaluated independently, retained evidence from another or altered session can satisfy the state predicates while the transcript contains only failed invocations. Parse the Flow response and require its application status to be ok before treating the call as completed.
Useful? React with 👍 / 👎.
| operation.inputDigest = operationInputDigest({ | ||
| operationId: closure.operationId, | ||
| expectedRevision: closure.recordedRevision - 1, | ||
| sessionId: session.id, | ||
| kind: closure.kind, | ||
| summary: closure.summary, | ||
| }); | ||
| const repaired = SessionSchema.safeParse(session); |
There was a problem hiding this comment.
Reject invalid closure digests instead of repairing them
When retained session evidence fails SessionSchema, this verification path overwrites the closure operation digest using the other retained fields and then accepts the repaired document. Consequently a session whose closure ID, revision, kind, summary, or digest was altered can pass derivation after its integrity failure is silently normalized away, undermining the release gate's claim to rederive the evidence as retained. Perform any redaction-related digest regeneration while recording, but require verification to reject an invalid retained session unchanged.
Useful? React with 👍 / 👎.
Summary
Verification
bun run check: 586 passed, 1 intentional live-smoke skipbun run replay: 13 of 13 cassettes reproducedFLOW_LIVE_SMOKE=1 bun test tests/live-opencode-smoke.test.ts: pinned OpenCode 1.18.6 passedReview guide
Start with
deriveCanaryResultandcanaryRecordIssueinscripts/eval-canary.ts. Then inspect the runtime identity addition insrc/platform/opencode/plugin.tsandsrc/platform/opencode/tools.ts. The focused attack cases live intests/eval-canary.test.ts.