Repository navigation
fix(agents): cancel native descendants on session stop - #169700
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 real behavior proof before merge. What this changesThis PR connects session Stop to native Codex descendant cancellation and preserves confirmed results through partial failures and durable acknowledgment. Example: Stop agent:main:native-stop after parent-run yields to child-turn.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 5 items remain Keep this maintainer-authored PR open: it addresses a distinct cancellation gap, and review found no concrete introduced defect. Priority: P2 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherGateway Stop handlers authorize and capture the selected request, harness owners reserve its native descendants, and the Codex client interrupts exact turns before existing SQLite owners acknowledge cancellation. flowchart TD
A[Session Stop] --> B[Gateway authorization]
B --> C[Captured request custody]
C --> D[Harness cancellation owner]
D --> E[Codex native descendants]
E --> F[Terminal settlement]
F --> G[SQLite acknowledgment]
Technical reviewBest possible solution: Land the existing owner-based cancellation path after authority, durable recovery, and CI qualification are complete. Do we have a high-confidence way to reproduce the issue? Current-main source exposes the missing harness cancellation path, and the supplied regression cases exercise native settlement and acknowledgment failures; no target code was executed during this read-only review. Is this the best way to solve the issue? The patch extends existing Gateway, harness, native lifecycle, and SQLite owners rather than adding a competing cancellation mechanism; inspection found no discrete introduced bug. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 96496dc78274. Merge-risk optionsMaintainer options:
Provenance checked
TestingProof path: in-process harness. SecurityNeeds attention: Source guards are present, but retained cancellation authority still needs final-effect qualification. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +1007, Tests +1164, Docs +10. Total +2181 across 36 files. Added test files: 2. View PR surface stats
LabelsLabel changes: No label 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 HistoryReview history (8 earlier review cycles)
Reviewed October 12, 2026, 12:13 PM ET / 16:13 UTC (Revision 9). |
|
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
* fix(agents): cancel native descendants on session stop * refactor(gateway): keep session abort origin with authorization * fix(agents): retain partial cancellation and durable acknowledgement * test(codex): admit follow-up custody before cancellation * fix(codex): keep cancellation types within existing contracts * fix(codex): preserve checks after session authority integration
…79050) * fix(codex): retire completed grandchildren without restart replay * test(codex): align native assignment acknowledgement expectation Release adaptation: stable has no Stop-driven descendant cancellation (#169700 is main-only), so the inventory gains the generic acknowledge() owner directly instead of renaming settleCancelled, and the main-only cancellationRequested guard and withDescendantCancellation hunks were dropped. The monitor keeps its stable thread-status-revision readHistory wrapper. Tests use client.notify with existing notification builders instead of the main-only client.item/completeTurn helpers and drop listPendingChildren probes. (cherry picked from commit b189a9f)
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)
What Problem This Solves
Stopping a session can leave native Codex descendants running or lose confirmed cancellation results when another child fails. A failed durable acknowledgment can also consume a cancellation delivery too early.
User Impact
Session stop and reset cancel the descendants they own, wait for settlement, and preserve completed output and children outside the selected scope. Partial failures retain confirmed child results. Failed cancellation acknowledgments remain retryable after reopening SQLite.
Why This Change Was Made
Carry the existing cancellation authority and session generation through the Gateway, harness host, and native-child lifecycle. The same owners handle active children, pending admissions, late registrations, and durable completion acknowledgment.
The upstream integrations preserve current child-agent/session-entry ownership and parent write authority. The submission-store adapter now lives with its existing assignment-store owner; queued compaction keeps the existing policy-change refusal and its no-client/no-RPC assertions.
Evidence
Current pushed revision:
661d2798b9455a9bcb5cef0108b30c92654d99bd.83a583b64ccaeeb6cf49b7827159747f94b08c51passed two compaction/parent-authority cases (73.084 s), three submission-store lifecycle/refusal cases (58.203 s), extension types, Codex test types, touched lint and formatting. These checks were not rerun for the final two-file ownership integration.Earlier evidence remains attributed to its original revision:
72d1c7eeae9cd643a2d1f8823b3c1502b06eb7f6passed nine static checks, including zero runtime/Madge cycles and the 3,699-export SDK surface.0103b35733deefc74de97a716a608b970ece78b4passed 25 host-capability tests in 49.25 s and 80 registered Gateway tests in 171.04 s.Natural hosted run 38273271552 attempt 1 failed the Codex registration-import test and its CI aggregate. The eager session-binding SDK import reaches live session/config diagnostics. All 29 implicated and assertion/resolution source inputs equal the actual tested main parent
6fa67453cd0caaf3b794a55d47bc512cc8829a15in tested merged16c3efc9fd068c5bc9d0e1007c99e604bf57f09. This establishes inherited source attribution; no failing or passing execution on main is claimed. The native inherited-failure exception remains subject to its security, review and writer-authority checks.A separate campaign smoke recorded three passing and seven failing cases. Its offline path used a retained custom package, while its online path installed registry packages; it does not qualify the retained candidate or execute this PR revision. The failure evidence has verified S3 readback. Campaign runtime qualification remains pending installation, admission and settlement repairs.
No full repository suite or current hosted-green result is claimed. Independent source reviews covered the full change and both conflict resolutions.