Repository navigation
fix(codex): prevent steered answers from disappearing or crossing threads - #128257
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 25, 2026, 11:59 PM ET / August 26, 2026, 03:59 UTC. ClawSweeper reviewWhat this changesThe PR persists a completed Codex answer before a steer and prevents Control UI terminal events with a reused run ID from altering another session’s transcript or queued send. Merge readinessKeep open for maintainer review: no discrete source defect was found, but this Codex-dependent fix cannot receive a merge verdict until an owner directly verifies the required upstream completion-ordering contract and exact-head CI finishes. Priority: P1 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherThe Codex plugin converts app-server item notifications into durable agent-transcript messages before steering input is accepted. Control UI pages receive Gateway chat events and use session-and-agent ownership to decide which transcript and durable outbox row may change. flowchart LR
A[Codex item completion] --> B[Assistant projection]
B --> C[Steering transcript mirror]
C --> D[Durable agent transcript]
E[Gateway terminal event] --> F[Session and agent ownership check]
F --> G[Selected transcript]
F --> H[Scoped queued-send cleanup]
Decision needed
Why: Repository policy requires the acting reviewer to inspect that exact upstream runtime contract before a Codex verdict; the required sibling checkout was unavailable here. Before merge
Agent review detailsSecurityNone. PR surfaceSource +113, Tests +271. Total +384 across 15 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the session-scoped UI and item-completion ownership boundaries, then merge only after a Codex owner verifies the pinned upstream ordering contract and the exact head is green. Do we have a high-confidence way to reproduce the issue? No high-confidence end-to-end reproduction was established here: the UI collision path is source-reproducible, but the Codex ordering premise cannot be confirmed without the required upstream source. Is this the best way to solve the issue? Unclear; the source boundaries are coherent and targeted, but direct verification of the Codex event-ordering contract is still required to establish that this is the best fix. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 937c89675b04. LabelsLabel changes:
Label 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 (10 earlier review cycles; latest 8 shown)
|
dd27e12 to
7478cd7
Compare
|
Addressed the latest ClawSweeper P1 at head
Local proof: Codex steering 10/10, chat queue 279/279, chat gateway 167/167, browser E2E 4/4, @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
3af96fd to
a6fe20e
Compare
a6fe20e to
0d255dc
Compare
0d255dc to
454a54b
Compare
454a54b to
a29d60c
Compare
Co-authored-by: Tak Hoffman <[email protected]>
07a278c to
54ff865
Compare
|
Merged via squash.
|
…eads (openclaw#128257) * fix(codex): isolate steered thread transcripts * fix(ui): scope terminal queue cleanup * refactor(codex): split steering snapshot assembly * fix(codex): suppress silent steering boundaries * chore(ui): document chat event ownership * test(ui): await Lobsterdex bootstrap requests * test(update): isolate managed service selectors * test(ui): submit queue edits by keyboard * refactor(ui): tighten chat event ownership * refactor(ui): narrow terminal chat payloads Co-authored-by: Tak Hoffman <[email protected]> --------- Co-authored-by: RoboClaw <[email protected]> Co-authored-by: Tak Hoffman <[email protected]>
What Problem This Solves
Fixes a coupled transcript failure where a Codex answer shown immediately before a steer could disappear from durable history, while a stale shared run ID could let another session's live response replace the selected Control UI transcript or consume its queued send.
Why This Change Was Made
Completed Codex assistant items are journaled at their authoritative item-complete boundary and committed before a steer is accepted, without replaying them at terminal finalization. The Control UI now treats session ownership as authoritative before run IDs and scopes terminal queue handoff/removal by
(sessionKey, agentId, runId).The page-ingress repair preserves the intentional split-pane handoff: inactive panes may cache and retire the event owner's durable queue row, but a foreign terminal cannot mutate the selected pane's queue. Literal unscoped
globalevents route to the default agent, matching chat-event semantics. Silent control payloads such asNO_REPLYare excluded from the new persistence boundary.Production LOC: +164/-51 (net +113) | Tests: +309/-38 (net +271)
The production growth records two explicit ownership boundaries: Codex item completion versus enclosing turn finalization, and UI event scope versus correlation-only run IDs. Steering snapshot assembly lives in the existing snapshot owner so the projector remains below the repository line limit without a suppression.
User Impact
Users can steer an active Codex turn without losing an answer that was already displayed. Switching between threads, agents, or split panes no longer allows a same-run event from another session to contaminate the selected transcript or retire its queued prompt.
Evidence
Before / after video
The deterministic mock-Gateway scenario uses the same
runIdfor two sessions, emits a large delta/final from the inactive session, and reconciles the selected virtualized transcript while rows resize.Before fix — inactive-session content replaces the selected thread:
before-fix.webm
After fix — the selected thread remains isolated and rows do not overlap:
after-fix.webm
Both WebM recordings were inspected at early, middle, and final frames before upload.
Regression and focused verification
node scripts/run-vitest.mjs extensions/codex/src/app-server/event-projector.assistant.test.ts extensions/codex/src/app-server/run-attempt.steering.test.ts— 32/32 passednode scripts/run-vitest.mjs ui/src/pages/chat/chat-send.test.ts ui/src/pages/chat/chat-gateway.test.ts— 446/446 passednode scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/chat-agent-run-transcript.e2e.test.ts— 4/4 passednode scripts/check-changed.mjs— passed all selected UI, extension, typecheck, lint, boundary, dead-code, database-first, and cycle gates.agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main --max-priority P1— clean, no accepted/actionable findings (0.88 confidence)Regression proof: restoring selected-pane/run-ID targeting makes both page-ingress ownership cases fail for the intended reason; restoring event-owned scope makes those cases and inactive-pane-first ordering pass. Restoring the pre-fix steering boundary makes the silent-payload regression persist a visible
NO_REPLYrow; restoring the predicate leaves the boundary empty.Codex dependency contract
Direct sibling Codex source inspection confirms the contract this patch relies on:
codex-rs/app-server-protocol/src/protocol/v2/turn.rsrequiresturn/steerto name the active turn.codex-rs/app-server/src/request_processors/turn_processor.rssubmits steer input throughsteer_turn.codex-rs/app-server/src/bespoke_event_handling.rsemitsitem/completedindependently from the later enclosingturn/completednotification.Therefore a completed answer before a same-turn steer is an authoritative boundary OpenClaw must persist.