Repository navigation
fix: deliver later answers from a reused Codex worker - #206014
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: passed. What this changesThis PR gives rediscovered Codex worker completions turn-specific delivery IDs and prevents late history reads from changing their retry identity. Example: Worker child-thread completes known turns first and second under parent-thread.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it repairs a concrete completion-ID collision still present on main, and no definite introduced correctness bug was found. Reviewed head: Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe Codex plugin monitors native worker notifications and history, then hands completed answers to the Gateway's existing completion delivery and deduplication owners. flowchart TD
A[Codex worker turns] --> B[Notifications and history]
B --> C[Native subagent monitor]
C --> D[Completion delivery identity]
D --> E[Gateway deduplication]
E --> F[Parent receives answer]
Technical reviewBest possible solution: Keep completion identity selection in the existing delivery owner and freeze terminal observations against late history reads. Do we have a high-confidence way to reproduce the issue? Source shows different known turns sharing a thread-only announcement ID that reaches Gateway deduplication; no target code was executed during this read-only review. Is this the best way to solve the issue? The focused repair reuses existing assignment and delivery owners, preserves turn-specific assignment IDs, and blocks the demonstrated late-read identity change without restoring broader recovery machinery. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 0ce45b70c5fd. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +6, Tests +20. Total +26 across 3 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
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 Reviewed November 26, 2026, 10:48 AM ET / 15:48 UTC. |
Gateway delivery trace for
|
|
Merged via squash.
|
(cherry picked from commit a3ed12c) Co-authored-by: RomneyDa <[email protected]>
…06080) (cherry picked from commit 47027a2) Release adaptation: No source or test changes from main. Stable already carries prerequisite #206014 as 2940130, so the monitor and both regressions apply cleanly. Later same-file #206447 (a9569e9) centralizes completion delivery; it is not needed for the native-turn and contextual-receipt guards and is not included. Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit a3ed12c) Companion disposition: #206080 is a same-owner follow-up separately assessed for release compatibility. Co-authored-by: RomneyDa <[email protected]>
What Problem This Solves
A persistent Codex worker can complete several tasks while its parent works on a goal. When the monitor rediscovers that worker, two different results can share a delivery ID. The Gateway acknowledges the second delivery, but the parent keeps working without the new answer.
User Impact
The parent can receive each known worker turn. Retrying the same delivery keeps its ID. This fixes a lost answer independently of the goal scheduling repair in #193024.
Why This Change Was Made
Keep an existing turn-specific assignment ID. If the assignment identifies only the thread, use the observed native turn. Ignore a history read that finishes after the child became terminal, so it cannot change the ID on retry. Task ownership and permissions stay unchanged.
Upgrade note. Settle pending deliveries before upgrading. If the old Gateway accepted a thread-only ID but the monitor still considers it pending, retrying under a new ID can announce the answer again. When no turn ID is known, the old thread-only fallback still cannot distinguish successive results. No schema or configuration change.
Evidence
66397a57, two known turns produced the same thread-only ID. Adding just the new key exposed a second failure when a delayed history read changed the key between retries. All 22 monitor cases pass at4de8f0f1. The three backoff cases took 7, 7, 8 ms. The cold command took 137.61 s.82b682c6with the goal and worker-recovery changes from fix: goals stop after native child-result handoffs #193024 and fix: recover a completed Codex reply after a brief disconnect #205298. Diagnostic tracing was removed for the passing trial.Ran
pnpm test extensions/codex/src/app-server/native-subagent-monitor.test.ts --maxWorkers=1, type-aware lint and formatting checks. The isolated tests used cached dependencies. Full locked-dependency checks are left to hosted CI. Independent native Codex review covered the full diff at all priorities and cleared the late-read fix. The standalone review command could not start its reviewer on this host.