Repository navigation
fix(codex): show the delivered answer, not a trailing NO_REPLY, in Activity - #116604
harjothkhara wants to merge 3 commits into
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed August 27, 2026, 1:06 PM ET / 17:06 UTC. ClawSweeper reviewWhat this changesThe PR makes Codex Activity select the audible delivered answer when a trailing silent reply is the completion snapshot. Merge readiness⛔ Blocked before merge - 11 items remain Keep open: the Activity fix remains necessary on current main, but the new selector can choose an async message that delivery deliberately excludes, including a restricted update. Priority: P1 Review scores
Verification
How this fits togetherThe Codex app-server projector turns Codex item notifications into channel-delivered text and Control UI Activity events. The completion snapshot finalizes the selected Activity answer after the turn's notifications have been processed. flowchart LR
A[Codex item notifications] --> B[Assistant projector]
B --> C[Delivered text selection]
B --> D[Activity answer selection]
C --> E[Channel delivery]
D --> F[Control UI Activity]
Before merge
Findings
Agent review detailsSecurityNeeds attention: The async-selection divergence can expose a restricted async update in Activity. PR surfaceSource +64, Tests +51. Total +115 across 3 files. 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. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Make Activity selection use the same nonterminal predicate as delivered-text selection, add the async-plus-silent regression, then provide a redacted real app-server-to-Activity proof. Do we have a high-confidence way to reproduce the issue? Yes at source level: an audible final, then an async assistant message, then a trailing silent completion snapshot makes the new reverse scan select async text while the delivery collector excludes it. This review did not execute the contributor branch. Is this the best way to solve the issue? No. The intended Activity fix is sound, but its resolver must share delivery's exclusion of async/nonterminal items rather than only filtering commentary. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against bcb5403d5757. LabelsLabel justifications:
EvidenceSecurity concerns:
Acceptance criteria:
What I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (21 earlier review cycles; latest 8 shown)
|
f3970cf to
675666e
Compare
|
@clawsweeper re-review The last review was against head Direct Codex source inspection is now in the body. The review noted it could not fetch the sibling That makes the answer-then- Real-behavior proof was already in the body at the reviewed head and remains: a separate app-server process over a real stdio pipe, four scenarios, with the Still open, and deliberately so: the P2 timeout-recovery finding is answered by measurement rather than by code. The body's "timeout-recovery interaction, measured" section shows the gate is not reached — the 10s assistant-completion-idle watch fires before the 60s completion-idle watch, and the one sequence that does reach it is independently blocked by |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
675666e to
99a8d38
Compare
|
Pushed Three further defects, all found by review and all fixed with red-first regressions. The silent-token predicate was narrower than the one delivery actually applies, so a late event answered with The P2 timeout-recovery finding is now fixed in code rather than argued around. Direct sibling Codex inspection is in the body, cited at tag Two follow-ups and two product questions are named rather than quietly skipped, per the one-sided-fix rule: raw-echo synthetic ids fall outside native-tool invalidation; two parallel invalidation computations should eventually be one; whether a wholly silent turn should ever show as Activity's selected answer; and whether the fallback should distinguish internal steers from user steers, given both share the steering queue. That last one changes user-visible behavior and I did not want to decide it for you. Scope grew from +13 to roughly +90 production lines. That is a real increase and I would rather flag it than bury it — it buys four consumers of the same fact agreeing instead of one, but if you would prefer this split into a minimal delivery fix plus a separate consistency PR, say so and I will split it. |
99a8d38 to
2c91cd9
Compare
2c91cd9 to
6ae9b00
Compare
6ae9b00 to
e6a36c0
Compare
… in Activity Narrowed from the original openclaw#116604 scope after openclaw#123993 landed the delivery-side fix: collectAssistantTexts() now correctly ships the real answer via the persistable-assistant barrier, so the delivered-text hunk and its tests are dropped as redundant (credit: openclaw#123993). What still breaks on main: turn/completed.items is a last-wins last_agent_message summary (codex-rs thread_state.rs track_current_turn_event overwrites it on every completed AgentMessage final), so when a trailing NO_REPLY is the last agent message, finalizeAnswerCandidate selects the silent item and Control UI Activity shows "NO_REPLY" as the operator-visible selected answer while the channel receives the real reply. Fix: when the snapshot-authoritative item is a silent payload, re-derive the selected item through resolveDeliveredAnswerItemId(), an item-id mirror of collectAssistantTexts()'s precedence (audible post-barrier, then any post-barrier persistable, then pre-barrier audible, then the final text item), so Activity names the item delivery actually chose. Two earlier candidate vectors were dropped after inspecting the pinned codex-rs 0.147.0 source: turn.items can never carry more than one item and never a tool item (bespoke_event_handling.rs:1276-1285 is the only production constructor), so a cross-turn snapshot filter would be dead code, and a silence-aware recovery gate would break legitimate silent-turn recovery. Regression test fails on unmodified main with the selected event naming the silent item (progressText "NO_REPLY") and passes with the fix.
dc75e21 to
8ad74f3
Compare
event-projector-assistant.ts crossed the 700-line cap once this fix's lookup landed on top of main's growth. The lookup is self-contained -- it only reads assistant item order, phase, text, the persistable barrier, and two projector predicates -- so it moves out cleanly behind an explicit lookup type instead of trimming the fix.
|
Re-checked this against current
So the two fixes sit at different owner boundaries: #123993 repaired the text/delivery path; the Codex protocol check (per the repo's hard gate — inspected the pinned sibling source directly, not the PR text). Sibling checkout at tag
That is exactly the premise this PR depends on, and it holds at the pinned version. One forward-looking caveat worth flagging: at the sibling repo's Existing coverage does not pin the residual gap: Not claiming credit for the delivery half — #123993 owns that, and I've narrowed this PR accordingly. Leaving it open for the Activity-selection defect unless a maintainer reads that as also-covered, in which case I'm happy to close it. 🤖 AI-assisted (Claude Code): analysis prepared with an AI agent; a human reviews and owns the result. |
|
This assigned pull request has been automatically marked as stale after being open for 27 days. |
|
Closing due to inactivity. |
Closes #112468
Related: #123993
What Problem This Solves
Completes the last user-visible piece of #112468. The delivery half — a trailing
NO_REPLYcoda swallowing the turn's real answer in the channel reply — was fixed onmainby #123993 (thanks @obviyus), whose persistable-assistant barrier now correctly ships the audible answer. This PR was originally the broader fix for that issue; it has been narrowed to the one vector #123993 does not cover:Control UI Activity still shows
NO_REPLYas the "Selected answer."turn/completed.itemsis a last-winslast_agent_messagesummary, so when the trailing silent token is the last completed agent message,finalizeAnswerCandidateselects the silent item. The operator seesNO_REPLYin Activity while the channel receives the real reply — the two surfaces disagree about what the turn said.Why This Change Was Made
Verified against the pinned
@openai/codex0.147.0 source (extensions/codex/package.json:11), per the Codex dependency gate:codex-rs/app-server/src/bespoke_event_handling.rs:1276-1285— the only production constructor ofturn/completedbuildsitemsas[last_agent_message]or[]: never more than one item, never a tool item.codex-rs/app-server/src/thread_state.rs:158-169—last_agent_messageis overwritten by every completedAgentMessagefinal (last-wins, no silence awareness), so a trailingNO_REPLYalways shadows the real answer in the snapshot.The fix re-derives the selected item when the snapshot-authoritative item is a silent payload:
resolveDeliveredAnswerItemId()is an item-id mirror ofcollectAssistantTexts()'s merged precedence (audible post-barrier → any post-barrier persistable → pre-barrier audible → final text item), so Activity names exactly the item whose text delivery chose. It reuses the existingpersistableAssistantBarrier— no parallel delivery path is introduced, andcollectAssistantTexts()remains the single owner of delivered text.Dropped from the original scope, with reasons:
mainvia fix(codex): keep the real answer when a trailing coda follows #123993's barrier.finalizeAnswerCandidate— dead code by construction;turn.itemscannot carry a cross-turn or tool item (citation above), and noThreadItemvariant carries aturnIdfield (codex-rs/app-server-protocol/src/protocol/v2/item.rs:226-397).hasCompletedTerminalAssistantText) — would actively break legitimate silent-turn recovery; every real tool call produces live item notifications that already drive the supersession path, so the "tool appears only in the snapshot" premise is unreachable.User Impact
Operators watching a run in Control UI Activity see the actual answer the user received, instead of
NO_REPLY, whenever a late-injected event (typically a duplicate subagent completion notice) draws a contract-mandated silent coda after the real answer. Channel delivery is unchanged (already correct onmain).Evidence
Regression test:
extensions/codex/src/app-server/event-projector.assistant.test.ts— "selects the delivered answer, not a trailing silent token, as the Activity answer (#116604)". Real answer completes, trailingNO_REPLYfinal completes,turn/completedcarries only the silent item (matching the Rust summary semantics).Red on unmodified
main— the selected Activity event names the silent item:Green with the fix:
Sibling suites (
event-projector.commentary,.native-finalization,.native-audit,run-attempt.turn-watches): 172/172 pass.oxfmt --checkandoxlintclean on touched files;git diff --checkclean.Production LOC: +40/−1 (one private helper + silent-payload branch in
finalizeAnswerCandidate); tests +51. Cross-model review: default Codex pass clean; gpt-5.6-sol max-effort pass run before publication.Proof gap (unchanged from prior reviews, stated honestly): no real Codex app-server session trace — that requires live credentials against a pinned server. The projector-level red/green above drives the same notification sequence the server emits per the cited
codex-rssource.🤖 This PR was prepared with AI assistance (Claude); the analysis, narrowing decision, and final diff were reviewed end-to-end.