Repository navigation
fix(sessions): keep reviewed runs usable after held-tool cancel or restart - #333
Conversation
…cel or restart A JEV-reviewed run whose tool call is held for approval leaves its tool turn without a projection when cancelled or when the server restarts; every later prompt in that conversation then fails with ToolProjectionUnavailable before reaching the provider. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011YSSvkVJ34kvxKGsmK71uZ
…start With JEV checkpoint review on, cancelling a run (or restarting the server) while its tool call awaited approval left the tool turn without a saved tool-result projection. History assembly required that projection for every turn of a checkpoint-enabled run, so every later prompt failed with ToolProjectionUnavailable before reaching the provider. Require the exact projection only when a checkpoint_reviewed event was actually recorded for one of the turn's calls. A turn whose calls were never reviewed replays with explicit interrupted results, as an unreviewed run does. A recorded verdict still fails closed. Saved projections and valid no-checkpoint descriptors short-circuit, so the common path never scans events; an invalid descriptor still falls through to the event check. The reproduction helper now asserts that the continuation request keeps the original prompt, the call_0 write, its cancelled/interrupted result and the new prompt in order (independent review finding F1); a deliberately wrong repair that drops the turn fails it. Patch authored by QQ 0.1.7 (openai-codex/gpt-6.1-sol, plan ca8c2a69) in a visible tmux session on the user's server; directed, verified and committed by Claude. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011YSSvkVJ34kvxKGsmK71uZ
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b8d435ebbf
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 34618e5384
ℹ️ 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".
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
What changes for users
With JEV checkpoint review on, a conversation used to become permanently unusable if a run ended while a tool call was waiting for approval. This happened on Ctrl-X/
CancelRun, and also when the server restarted. Every later prompt failed before reaching the model:After this change, that history replays the unfinished call with an explicit cancelled/interrupted result, the same as a run without review, and the next prompt reaches the provider. If a JEV verdict was actually recorded for a call in that turn, the refusal still applies, so a verdict never silently drops out of history.
Why / design
tool_results_projection_jsonis written only onToolResultsProjected, after the tools finish and the checkpoints run (run_loop.rscheckpoint_tools→close_tool_turn).assemble_model_contextthen setcheckpoint_projection_requiredfor every turn of a checkpoint-enabled run, soappend_run_turnsraisedToolProjectionUnavailable.transcript.rs, on the read side. It also releases already-affected histories that have no recorded verdict, without changing the store.checkpoint: 0. No review can exist.EXISTSacheckpoint_reviewedevent for a call of that run and turn. This fails closed.events.record_unreviewed_checkpointson cancel or restart. That session still refuses, as before. Not covered here.openai-codex/gpt-6.1-sol) in a visible tmux session as one task conversation. Claude wrote the failing reproduction (ee56d1fc8), directed and approved each action, and verified the result.How verified
mainand passing here:sessions::tests::projection::cancelling_a_reviewed_run_awaiting_tool_approval_keeps_the_session_usable…::restarting_during_a_reviewed_runs_tool_approval_keeps_the_session_usablecall_0write_filecall, its matching cancelled/interrupted error result, and "continue", in that order. This comes from an independent review finding.ab2_checkpoint_review_without_exact_projection_cannot_lose_its_verdictab2_ambiguous_history_*testsab2_oversized_checkpoint_feedback_persists_the_corrective_request, including its crash-gap halfsessions::tests::projectioncargo nextest run -p qq-core -E 'test(/reviewed_run|projection::/)': 11 passed.cargo xtask checkon the pinned 1.97.1 toolchain: fmt, lint and clippy pass.3e34eea2cwith this diff reverted; they are environmental on this Mac (Darwin PATH_MAX/SUN_LEN search and socket fixtures, a sandboxed keyring/routing setup, one deadline timeout). The other 31 pass with a short TMPDIR.checkpoint_reviewedis the only durable verdict record, and checked the JSON paths, the workspace key and that the column has no other readers.Impact
b8d435ebb, reviewed turns without tool calls still reached theeventsprobe; this was the Codex finding r4304943702, and the earlier wording of this line overstated the short-circuit.34618e53adds thetool_callsguard for those turns. A deterministic regression for that guard is in progress and not yet pushed. The remainingEXISTS, which applies only to reviewed turns with tool calls and no saved projection, filterseventsby theworkspace_idprimary-key prefix and has no JSON expression index. The timing below is a local maintainer measurement, not a CI assertion.main's protocol 35 / store schema 58 / descriptor 15. Published v0.1.7 is protocol 32 / store 50, so replacing it with any current-mainbuild migrates the store. That jump ismain's, not this PR's, and it needs its own migration/rollback qualification before adoption.Acceptance status (not complete)
Refs #335. This PR does not close it.
b8d435ebb, and an independent read-only review with no defects found.final:3, thenfinal:8). JEV routing was off for that run. The full self-evaluation loop is not accepted.main) and its rollback are unqualified.Maintainer follow-up (2026-10-17)
main(2f585b0d), no conflicts.34618e53: reviewed turns without a projection and without tool calls short-circuit via the indexedtool_calls(run_id, turn_ordinal, …)lookup and never reach theeventsprobe (synthetic 300k-event store: 1.98 s → 0.002 s for 21 such turns).cargo nextest run -p qq-core -E 'test(/projection|reviewed_run/)': 17/17 pass; the two new tests fail with main'stranscript.rs. Smoke 8/8.qq headless::tests::closing_goal_host_drains_accepted_work_without_admitting_successorsalso times out locally on unmodified main.