Repository navigation
fix(codex): preserve authoritative turn completion and final output - #117185
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed August 1, 2026, 3:27 AM ET / 07:27 UTC. ClawSweeper reviewWhat this changesThe PR changes the Codex conversation-turn collector so terminal and final assistant-completion facts survive a saturated pre- Merge readiness⛔ Blocked until stronger real behavior proof is added - 6 items remain Keep this PR open for explicit maintainer handling. The collector repair is still necessary—current Priority: P1 Review scores
Verification
How this fits togetherThe Codex extension receives native app-server notifications while flowchart LR
A[Codex app-server] --> B[Lifecycle notifications]
B --> C[Pre-start turn buffer]
D[turn/start response] --> E[Turn ID correlation]
C --> E
E --> F[Phase and terminal selection]
F --> G[OpenClaw reply]
F --> H[Visible turn error]
Decision needed
Why: The repository’s Codex-specific policy explicitly prohibits a merge or proof-sufficient verdict without the acting reviewer personally inspecting the upstream source, and this read-only environment cannot satisfy that prerequisite. Before merge
Agent review detailsSecurityNone. PR surfaceSource 0, Tests +348. Total +348 across 3 files. View PR surface stats
Review metricsNone. Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Have a maintainer with the required upstream Codex checkout verify the exact Do we have a high-confidence way to reproduce the issue? Yes, from current source: the main collector stops retaining notifications after 100 pre-start events, while conversation binding registers its handler before Is this the best way to solve the issue? Unclear pending the mandated upstream source check. Repairing the collector is the narrow owner-boundary approach shown by the caller flow, but the exact phase and terminal rules must be confirmed directly against Codex before calling this the best fix. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 7aacd1314d71. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (9 earlier review cycles; latest 8 shown)
|
078361d to
bbc88ae
Compare
|
Maintainer rewrite pushed at Root cause: the collector buffered the first 100 pre- Canonical fix:
Production delta: Native pinned Codex Direct Codex contract inspection:
Shipped Not merging here; awaiting exact-head CI and ClawSweeper. |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
bbc88ae to
ffd1999
Compare
Retain terminal and assistant-completion facts when pre-start notifications exceed the bounded buffer. Exclude commentary from replies, accept legacy unphased final messages, and let completed terminal items own the final answer while rejecting interrupted, failed, or non-terminal outcomes. Co-authored-by: Peter Steinberger <[email protected]>
ffd1999 to
ff523ac
Compare
|
Exact-head repair proof for
Holding open and unmerged pending exact-head CI and fresh ClawSweeper verdict. |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Maintainer proof decision for exact head
We accept the residual scheduler risk and consider the binding replay plus native/source evidence sufficient. Please clear the proof-only P1 if the evidence now meets the gate. @clawsweeper re-review |
|
Final maintainer dependency-contract disposition for exact head
Accepting the maintainer evidence override and landing via squash. |
* origin/main: (41 commits) test(ci): update memory helper routing expectation (#117295) fix(canvas): emit successful control results in JSON mode (#117297) fix(imessage): settle native inbound reply delivery (#117282) fix(agents): reject invalid UTF-8 LSP responses (#117271) fix(line): centralize card and template message alt text (#117280) fix(release): validate candidates before Docker publication (#117252) fix(media): validate provider-owned generated media downloads (#117281) fix(feishu): restore custom HTTPS API domains (#117278) fix(models): reuse prepared plugin metadata (#117131) fix(agents): stop fallback after delivered-but-failed attempts (#114628) fix(memory): reuse targeted session corpus snapshot (#117247) fix(matrix): reconcile durable sends after response loss test(release): repair full validation regressions (#116931) fix(linux-canvas): report socket watcher fallback (#109502) fix(codex): preserve authoritative turn completion (#117185) fix(canvas): preserve widgets across derived-name collisions (#117132) fix(channels): config validation rejects documented channels.<id>.configWrites on 13 channels (#117206) fix(msteams): prevent duplicate final replies (#116398) fix(doctor): session SQLite restore installs an empty session index over the valid archive (#117221) fix(plugins): preserve workspace plugins across CLI and control UI (#117265) ...
Retain terminal and assistant-completion facts when pre-start notifications exceed the bounded buffer. Exclude commentary from replies, accept legacy unphased final messages, and let completed terminal items own the final answer while rejecting interrupted, failed, or non-terminal outcomes. Co-authored-by: Vincent Koc <[email protected]> Co-authored-by: Peter Steinberger <[email protected]>
* origin/main: (41 commits) test(ci): update memory helper routing expectation (openclaw#117295) fix(canvas): emit successful control results in JSON mode (openclaw#117297) fix(imessage): settle native inbound reply delivery (openclaw#117282) fix(agents): reject invalid UTF-8 LSP responses (openclaw#117271) fix(line): centralize card and template message alt text (openclaw#117280) fix(release): validate candidates before Docker publication (openclaw#117252) fix(media): validate provider-owned generated media downloads (openclaw#117281) fix(feishu): restore custom HTTPS API domains (openclaw#117278) fix(models): reuse prepared plugin metadata (openclaw#117131) fix(agents): stop fallback after delivered-but-failed attempts (openclaw#114628) fix(memory): reuse targeted session corpus snapshot (openclaw#117247) fix(matrix): reconcile durable sends after response loss test(release): repair full validation regressions (openclaw#116931) fix(linux-canvas): report socket watcher fallback (openclaw#109502) fix(codex): preserve authoritative turn completion (openclaw#117185) fix(canvas): preserve widgets across derived-name collisions (openclaw#117132) fix(channels): config validation rejects documented channels.<id>.configWrites on 13 channels (openclaw#117206) fix(msteams): prevent duplicate final replies (openclaw#116398) fix(doctor): session SQLite restore installs an empty session index over the valid archive (openclaw#117221) fix(plugins): preserve workspace plugins across CLI and control UI (openclaw#117265) ...
fix(codex): preserve authoritative conversation outcomes
What Problem This Solves
The Codex conversation-turn collector had five owner-boundary failures:
turn/completedwithstatus: "interrupted"could resolve successfully with partial assistant output.phase: "commentary"messages could replace or impersonate the final answer.turn/startresponse could evict the terminal notification and leave a finished turn timing out.These failures are shipped in
v2026.7.2-beta.1through.5.Canonical Fix
The collector owns correlation of native Codex lifecycle notifications into one OpenClaw reply. This rewrite:
status: "completed"terminal items supersede streamed completionsProduction delta: +46/-46 (net zero). Tests: +348/-0.
Enlarging or unbounding the buffer would only defer the failure. Relying exclusively on terminal items would regress Codex
0.144.xand0.145.0, whose completed turns could carry an empty terminal item list. A downstream conversation-binding guard would repair the wrong owner.Direct Upstream Codex Contract Inspection
Maintainer reviewers personally inspected sibling
../codexat therust-v0.146.0dereferenced commite363b08c9175ac1cbe5893615dd2cb9ddf95043b(annotated tag objectbe449751a978f02e5bbba886999662956c7f38f5) and the terminal-summary producer change80f3c3141e4dd421c861408a87703bad0cb09874:codex-rs/app-server-protocol/src/protocol/v2/turn.rs:30-35:Completed,Interrupted,Failed, andInProgress.codex-rs/app-server-protocol/src/protocol/v2/item.rs:243-248: agent-message text plus optional phase.codex-rs/protocol/src/models.rs:756-769: missing phase is legacy/unknown; commentary and final answer are distinct.codex-rs/app-server/src/thread_state.rs:158-170: only nonempty final or legacy-unphased messages become the authoritative last assistant message.codex-rs/app-server/src/bespoke_event_handling.rs:1270-1295: terminal turns carry zero or one authoritative final item.codex-rs/app-server/src/bespoke_event_handling.rs:1463-1515: successful completion uses the last final message; interruption carries no final item.codex-rs/app-server/src/request_processors/turn_processor.rs:567-617: input is submitted beforeturn/startreturns, proving the pre-response notification race.The same phase and terminal contracts were checked at shipped Codex tags
0.144.4and0.145.0.Exact-Head Native Stdio Proof
The real authenticated repository-pinned
codex-cli 0.146.0app-server was run over native stdio against signed PR headff523ac316965f04f86fa9df35161428b7267a1a. It used an ephemeral thread,approvalPolicy: "never", and a read-only sandbox.The successful flow required exactly
OPENCLAW_QA_NATIVE_FINAL. The interrupt flow waited for a realcommandExecutionrunningsleep 30, then sentturn/interrupt. This is the complete redacted proof output; it contains no paths, thread/item identifiers, accounts, endpoints, or credentials:{ "head": "ff523ac316965f04f86fa9df35161428b7267a1a", "binary": "codex-cli 0.146.0", "transport": "stdio", "successfulFinal": { "turnIdPresent": true, "phases": ["final_answer"], "exactFinalSeen": true, "terminal": { "status": "completed", "itemPhases": ["final_answer"] }, "collectorReply": "OPENCLAW_QA_NATIVE_FINAL" }, "interruptedTurn": { "turnIdPresent": true, "terminal": { "status": "interrupted", "itemPhases": [] }, "collectorError": "codex app-server turn interrupted" } }A separate stock-native saturation probe requested a deterministic 200-line answer. Across four authenticated
codex-cli 0.146.0trials, each turn emitted 1,016 notifications, including 999 agent-message deltas, and returned the complete first and last lines. All four observed zero notifications before theturn/startresponse. That proves the real producer can exceed the collector cap, but stock Codex exposes no deterministic control that forces provider output before the much shorter start response. The exact saturated pre-response ordering therefore remains covered by the production-handler binding replay rather than a patched or proxied binary.Validation
turn/startreturnsauthoritative answeronly aftersetTurnIdreplays the buffered streamgit diff --check: cleanopenclaw/ci-gate, real-behavior proof, and all applicable checks):30689051957typescriptwas absent during repository postinstall30688153879User Impact
Successful conversations return the authoritative final answer. Cancelled or invalid conversations fail visibly. Commentary cannot impersonate an answer, a saturated pre-start stream cannot hide terminal completion, and a full commentary buffer cannot discard the following final answer. No authentication, configuration, persistence, public SDK, protocol, snapshot, or reasoning-projection files change.