Repository navigation
fix(codex): unblock replies after interrupted native children - #179099
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 changesRelease idle-parent protection after native child interruption and restore it when child execution resumes. Example: A native child is interrupted, the parent finishes, and a later agent request changes extraSystemPrompt and requests PONG_179099.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this PR fixes a current Codex interruption lockout. The previous type-error finding is resolved, and no blocking code findings remain; exact-head CI is still running. Priority: P1 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe Codex plugin monitor consumes native execution notifications and recovered assignments, then coordinates parent subscription protection, resumable child work, and completion delivery. flowchart TD
A[Gateway agent request] --> B[Codex native parent]
B --> C[Native child execution]
C --> D[Subagent monitor]
E[Saved assignments] --> D
D --> F[Parent subscription protection]
D --> G[Completion custody and delivery]
Technical reviewBest possible solution: Keep resumable assignments intact while the existing monitor protects the parent only during executable child work. Do we have a high-confidence way to reproduce the issue? The supplied public-agent Gateway comparison reproduces the refusal twice on the pinned main baseline, and source inspection confirms the responsible retention logic remains on fetched main; no target code was executed during this review. Is this the best way to solve the issue? This is a focused owner-level repair: it reuses settledWithoutCompletion and the existing retention map, preserves the guard and durable assignment, and adds no competing state or policy. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against d78b1482a756. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +15, Tests +183, Docs +2. Total +200 across 7 files. Added test files: 1. View PR surface stats
Review metrics
LabelsLabel 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 HistoryReview history (3 earlier review cycles)
Reviewed October 23, 2026, 5:14 AM ET / 09:14 UTC (Revision 4). |
|
@clawsweeper re-review Updated the PR body with redacted live Gateway/native Codex proof for the unchanged candidate The exact-candidate run passed: real native interruption and restart restoration; an ordinary reply forced through same-parent cold resume with the full saved assignment unchanged; resumption of the same native child; the actual active-work guard rejecting another cold resume while that child continued running; and a successful reply after the child completed. The cold-resume trigger and terminal output are included in the body, separate from the earlier stable-backport Discord evidence. No production code or installed Gateway changes were needed for this proof update. Exact-head CI remains green. |
|
🦞👀 Re-review progress:
|
|
Independent validation in support of this fix. We reproduced the interrupted-child lockout with the exact We applied the production deltas from #179099 (
The interrupted-child case includes an independently written regression using the real OpenClaw monitor, client ownership runtime and Scope: protocol-fixture regression tests against main plus the two production patches, not a full build of either exact PR head or a fresh live Gateway/model test. We did not deploy these changes. Our original incident had repeated ownership refusals despite no Gateway active run, but the historical logs do not identify the retained owner, so we cannot attribute that incident conclusively to either path. I support getting this and #177577 merged. They fix separate reproducible ways to lock a parent out; neither patch substitutes for the other. No additional correctness finding from this validation. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Removed both retired recoveryPollDelaysMs properties in 143eb63, using the current monitor schedule rather than restoring the deleted test seam. Both affected files pass (2 parent-retention + 19 direct-authority tests), and targeted formatting passes. This is test-only: the twice-observed built-candidate native interruption/cold-resume comparison remains applicable because production source is unchanged. The earlier check-test-types failure was caused by these two stale constructor options, not an inherited failure; it has been repaired. |
|
Landed in 42d4156. Thanks @wtfichigo. An interrupted Codex child no longer blocks resuming its parent. |
…aw#179099) fix(codex): release the parent pin when an interrupted Codex child loses custody When a native Codex child run was genuinely interrupted, it could keep its claim on the parent's execution pin after it no longer held executable custody. A later legitimate cold resume of the parent was then refused as already claimed. The pin is now released once the child has really lost custody; a child that still owns its work keeps it. Evidence: built Gateway with the real Codex app-server and a real OpenAI provider run, child interrupted through a public RPC. On main the parent's cold resume with changed instructions was refused (twice); with this change the original parent resumes and replies with its full assignment unchanged (twice). Runs without a child behave as before. Thanks @wtfichigo. Co-authored-by: Ayaan Zaidi <[email protected]>
fix(codex): release the parent pin when an interrupted Codex child loses custody When a native Codex child run was genuinely interrupted, it could keep its claim on the parent's execution pin after it no longer held executable custody. A later legitimate cold resume of the parent was then refused as already claimed. The pin is now released once the child has really lost custody; a child that still owns its work keeps it. Evidence: built Gateway with the real Codex app-server and a real OpenAI provider run, child interrupted through a public RPC. On main the parent's cold resume with changed instructions was refused (twice); with this change the original parent resumes and replies with its full assignment unchanged (twice). Runs without a child behave as before. Thanks @wtfichigo. Co-authored-by: Ayaan Zaidi <[email protected]> Adapted for release/2026.10.10: applied the cancellation and direct-authority test changes to release's older fixture layout (local itemNotification/monitorFixture helpers, direct notify instead of completeTurn), with release's createCodexThreadLifecycleTimingTracker({ enabled: false }) options form and no readBinding on release's assignment store. (cherry picked from commit 42d4156)
fix(codex): release the parent pin when an interrupted Codex child loses custody When a native Codex child run was genuinely interrupted, it could keep its claim on the parent's execution pin after it no longer held executable custody. A later legitimate cold resume of the parent was then refused as already claimed. The pin is now released once the child has really lost custody; a child that still owns its work keeps it. Evidence: built Gateway with the real Codex app-server and a real OpenAI provider run, child interrupted through a public RPC. On main the parent's cold resume with changed instructions was refused (twice); with this change the original parent resumes and replies with its full assignment unchanged (twice). Runs without a child behave as before. Thanks @wtfichigo. Co-authored-by: Ayaan Zaidi <[email protected]> Release adaptation: the stable child-unregister path keeps its thread-status revision collection. The main-only cancellation test file (descendant Stop, #169700) was not added; the shared custody fixture extraction is kept for the custody suite. New direct-authority and parent-retention cases use the stable lifecycle-timing options object and assignment-store factory signature. (cherry picked from commit 42d4156)
fix(codex): release the parent pin when an interrupted Codex child loses custody When a native Codex child run was genuinely interrupted, it could keep its claim on the parent's execution pin after it no longer held executable custody. A later legitimate cold resume of the parent was then refused as already claimed. The pin is now released once the child has really lost custody; a child that still owns its work keeps it. Evidence: built Gateway with the real Codex app-server and a real OpenAI provider run, child interrupted through a public RPC. On main the parent's cold resume with changed instructions was refused (twice); with this change the original parent resumes and replies with its full assignment unchanged (twice). Runs without a child behave as before. Thanks @wtfichigo. Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit 42d4156) Adapted for 2026.9.x: product hunks applied to 9.x call sites (applyNativeReceipts, unregisterChild keeps collectThreadStatusRevision; 9.x admitFollowupChild requires the thread id). The custody test refactor and cancellation test change are dropped (9.x has no descendant-cancellation test); the shared custody fixture file is added for the parent-retention case. The direct-authority case defines local itemNotification/interactionNotification helpers because the 9.x test support does not export them.
The #173018/#179050/#179099 ports awaited inventory and submission-store reads that are synchronous on 9.x (await-thenable), and grew native-subagent-inventory.test.ts past the 1000-line limit. Drop those awaits and move the delivery/restoration cases into native-subagent-inventory.restoration.test.ts.
Related: #172837. Original fix and credit: @wtfichigo; their commit is preserved.
What Problem This Solves
After a native Codex child is interrupted, a later parent reply can fail with “Codex thread is claimed by active work; stop it first,” although the child's execution has ended. The interrupted assignment should remain resumable without keeping an idle parent pinned.
Why This Change Was Made
Release the monitor's parent retention once every child is terminal or settled without completion. Reacquire the same retention when execution resumes, including model admission before a delayed native turn-start notification. The existing cold-resume guard, assignment storage, cancellation ownership and completion delivery remain in place.
This complements the terminal-child fix in #175246; it does not duplicate the submission-owned-follow-up change in #177577. It changes no plugin SDK surface, configuration, permissions or storage schema.
Evidence
Observed built-Gateway comparison and focused checks.
interruptedstatus; the parent finished; a publicagentrequest with a changed benignextraSystemPromptthen failed at the protected-thread guard.PONG_179099on the original native parent, with the full interrupted-child assignment unchanged before/after.Scope and Simplification
The existing monitor remains the only retention owner. Its acquisition helper replaces the old inline acquisition; the release path reuses the existing settled-child fact. No state, timers, retry mechanism or production API is added. An existing completion-custody fixture is shared rather than copied. Retained tests cover interrupted restore, resumed execution before its start notification, cancellation selection and custody.
Against the integrated base: production +27/-12 lines, tests/support +224/-41, documentation +4/-2. The small net production growth preserves reacquisition before resumed inference rather than weakening active-work protection.
User Impact
Conversations can continue without restarting the Gateway or discarding resumable child work. This does not prevent upstream connection outages.
Merge Danger
Two-way door: reverting restores the previous retention behavior without a data/config migration. The blast radius is Codex-native child interruption and resumed execution; an incorrect retention decision could either block idle parent replies or release a parent while child work is genuinely active.