Repository navigation
fix(subagents): parent turns never settle after an inline child reply - #181933
Conversation
A child run that ends while its requester's inline sessions_send wait still claims it defers cleanup to that claim. Acknowledging the inline result then retired the obligation without re-entering cleanup, so the row never got cleanupCompletedAt and stayed a pending descendant of its requester. Resume the run after the acknowledgement commits when it had already ended.
|
🦞👀 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 changesResume cleanup after a parent consumes an already-ended child’s inline reply. Example: Parent agent:main:dashboard:inline-parent receives “Inline follow-up result” from its native child.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Regression provenanceRegression provenance — verified: source commit Merge readiness✅ Ready for maintainer review This PR repairs a current-main settlement bug through the existing registry owner; no actionable introduced defects were found, and exact-head CI is green. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe subagent registry tracks delegated runs and completion obligations; inline reply acknowledgement updates delivery state, then lifecycle cleanup releases pending descendant accounting. flowchart TD
Parent[Parent turn] --> Send[Sessions send]
Send --> Child[Native child run]
Child --> Reply[Inline reply acknowledgement]
Reply --> Registry[Subagent registry]
Registry --> Cleanup[Existing lifecycle cleanup]
Cleanup --> Settlement[Parent settlement]
Technical reviewBest possible solution: Keep acknowledgement and deferred cleanup in the existing subagent registry, with this post-commit resume handoff. Do we have a high-confidence way to reproduce the issue? The current-main acknowledgement, live-claim cleanup deferral, and pending-descendant query establish the failure path; the linked real-Gateway report independently records the matching stall. Is this the best way to solve the issue? This is the smallest complete production repair: reuse the existing cleanup owner after acknowledgement commits, while extending the existing regression instead of adding another settlement mechanism. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 4c7b43d17b08. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +12, Tests +40. Total +52 across 3 files. Added test files: 0. View PR surface stats
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 Reviewed October 23, 2026, 5:19 PM ET / 21:19 UTC. |
|
Merged via squash.
|
…nclaw#181933) A child run that ends while its requester's inline sessions_send wait still claims it defers cleanup to that claim. Acknowledging the inline result then retired the obligation without re-entering cleanup, so the row never got cleanupCompletedAt and stayed a pending descendant of its requester. Resume the run after the acknowledgement commits when it had already ended.
…1933) A child run that ends while its requester's inline sessions_send wait still claims it defers cleanup to that claim. Acknowledging the inline result then retired the obligation without re-entering cleanup, so the row never got cleanupCompletedAt and stayed a pending descendant of its requester. Resume the run after the acknowledgement commits when it had already ended. (cherry picked from commit afd591f) Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit 1587737ddde0c9b3b6aa8eae040eb982ce62fe16)
…1933) A child run that ends while its requester's inline sessions_send wait still claims it defers cleanup to that claim. Acknowledging the inline result then retired the obligation without re-entering cleanup, so the row never got cleanupCompletedAt and stayed a pending descendant of its requester. Resume the run after the acknowledgement commits when it had already ended. (cherry picked from commit afd591f) Adaptation-Base: cecd7059127eb19b4d2a2d2143e6bd4cb126b40b Adaptation-Scope: Exact admitted inline requester validation and negative controls; retain existing ended-child cleanup Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit 3834b27c9c094f80fec12ab5fcd0944a2ccb1aa2)
What Problem This Solves
Fixes: a parent's turn never fully settles when it waits inline on a
sessions_sendreply from its own native child and that child's run ends during the wait.User Impact
User impact: parents that talk to their own children through
sessions_sendno longer leave the child run stuck as an unfinished descendant, so later turns, descendant-settlement waits, and run cleanup complete normally. There is no configuration or migration.Why This Change Was Made
When a child run ends while the requester's inline wait still claims it, cleanup is deferred to that claim. Acknowledging the inline result then marked the result delivered and retired the requester obligation without re-entering cleanup, so the run never got
cleanupCompletedAt. The acknowledgement now resumes the run after its write commits when the run has already ended, the same step completion delivery already takes after committing its own publication.Evidence
cleanupCompletedAtis set and the requester has no pending descendants. It fails without the fix (cleanupCompletedAtisundefined) and passes with it (30/30 in the file).openai/gpt-5.4): this defect was found while proving fix(sessions): parent follow-ups fail after native child runs age out #181117, whose opt-in live test hung in descendant settlement right after an inline child reply (failed run). The same live test with this commit applied on the fix(sessions): parent follow-ups fail after native child runs age out #181117 head passed every phase in 82 s, exit 0 (run_4eec342e5810). The touched files are identical onmainand that head.sessions-send-followup,agent-step,sessions-send-owner-continuation, and Gatewayagent.followup-ownerpass.tsconfig.core.jsonand the agents-root test typecheck pass.Commands
Related: #181117