Repository navigation
fix(codex): recover final answers after checkpointed work and terminal reasoning - #185310
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesMoves aggregate reasoning after completed visible work so final-answer recovery sees the same order as durable history. Example: A native command writes completed-once, followed by aggregate reasoning and an empty final response.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this PR narrowly fixes a current Codex recovery defect, with convincing Gateway proof and no actionable findings; exact-head CI remains pending. Priority: P1 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe Codex plugin projects native turn events into OpenClaw transcript messages; settled-turn recovery verifies those messages against durable history before requesting a passive final answer. flowchart TD
A[Native Codex events] --> B[Event projector]
B --> C[Completed work checkpoints]
B --> D[Terminal snapshot]
C --> E[Durable transcript]
D --> F[Strict evidence verifier]
E --> F
F --> G[Passive finalizer]
G --> H[Answer and history]
Technical reviewBest possible solution: Land the producer-order correction with its native regression once the existing CI gates pass. Do we have a high-confidence way to reproduce the issue? Current-main source establishes the ordering mismatch, and supplied base/head Gateway output demonstrates its failure and recovery; this read-only review executed no target code. Is this the best way to solve the issue? Correcting the snapshot producer is the smallest complete fix: it matches authoritative checkpoint order without relaxing verification or repeating completed actions. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 921f25822b76. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource 0, Tests +20. Total +20 across 3 files. Added test files: 0. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReviewed October 27, 2026, 12:06 AM ET / 04:06 UTC (Revision 3). |
|
@clawsweeper re-review Head |
|
🦞👀 Re-review progress:
|
|
Built Linux Gateway + pinned native Codex app-server 0.164.0 on Node 24.22.1. Frozen main b3fa02e; candidate 0d504b3. Native model/list and the refreshed Gateway models.list both confirm openai/gpt-5.6-sol. No model catalog or database was seeded. Shipped sessions.create selects Codex, then Main logs Normal-order control (same real command and empty terminal response, without aggregate reasoning) recovers on both refs: 2 source requests, 1 finalizer request, one command write, CLI exit 0 and matching answer in both history reads. Both normal runtime builds passed; all 10 focused native finalizer tests and changed-file formatting/lint passed. Strict identity/order/payload checks, prompts, runtime permissions and persistence formats are unchanged. Production +8/-8; tests/support +22/-2. Setup failures were not accepted as proof: corrected a harness object delimiter, then adapted detection to the current native additional_tools envelope. The final matrix uses native text(result), with successful completed tool output and zero tool failures. Local scripted provider acceptance is proven; hosted OpenAI acceptance is not claimed. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Landed in 40b1f01. Thanks @ericcaiwx-star. Codex final-answer recovery now works when reasoning comes after completed work. |
…l reasoning (openclaw#185310) fix(codex): order checkpointed work before terminal reasoning so final-answer recovery succeeds When terminal reasoning came after already-completed work, the Codex final-answer recovery snapshot put the reasoning first, so recovery rejected the turn (provenance_rejected) and the agent exited without an answer. The snapshot now keeps the checkpointed work first; verification is unchanged and no prompt text changes. Evidence: built Linux Gateway with the real Codex app-server 0.164.0 and a local Responses fixture. On main the turn ran its command once, made no finalizer request, exited 1 and had no recovered answer in the CLI or history (twice); with this change it ran the command once, made one finalizer request, exited 0 and the answer appeared in the CLI and both history reads (twice). The normal order works on both refs. Details: openclaw#185310 (comment). Production +8/-8. Thanks @ericcaiwx-star. Co-authored-by: Ayaan Zaidi <[email protected]>
Closes #185286
What Problem This Solves
Fixes Codex losing its final answer after completed checkpointed work is followed by terminal aggregate reasoning and an empty final response.
User Impact
The existing passive finalizer can recover the completed result without repeating actions. Strict transcript identity, payload and ordering checks remain intact.
Why This Change Was Made
Move the existing aggregate reasoning block after checkpointed visible work and before the final assistant, matching canonical history. No new prompt, verifier exception, recovery policy, storage field or permission change.
Thanks to @ericcaiwx-star for the fix and regression coverage.
Evidence
Built native Gateway capture.
Built Linux Gateway and actual pinned Codex app-server 0.164.0, with a local Responses fixture and model confirmed in both real catalogs. Shipped sessions.create plus agent CLI executes a real native command once, then receives terminal aggregate reasoning without a final answer.
Main fails recovery twice with provenance rejection and no finalizer request. This head recovers twice: two source requests, one passive finalizer request containing completed command evidence, CLI exit 0, and the recovered answer in two independent chat.history reads. Every command writes completed-once exactly once; zero tool failures. The finalizer performs no tool calls. A normal-order control recovers on both refs without repeating the command.
Both runtime builds, all 10 native finalizer tests and changed-file formatting/lint passed. Simplification retains the existing blocks and owners: production +8/-8, tests/support +22/-2. No hosted provider acceptance claim.
Merge danger
Two-way door: revert fully restores old snapshot ordering; no migration or persisted-data rewrite. Blast radius is terminal Codex snapshot ordering after checkpointed work, not model routing, prompts, action authorization or verifier strictness.