Repository navigation
fix(goals): keep the parent turn when a paused worker resumes - #208197
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. |
|
Codex review: passed. What this changesThis PR transfers the parent's retained Goal continuation to the resumed worker when registry adoption commits. Example: Goal goal-1 waits for two workers, and goal-child resumes as resumed-child after a background command.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: current main can lose automatic Goal pursuit when a paused worker adopts a new run ID, and this focused repair has no identified correctness or security defects. Reviewed head: Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherGateway follow-up admission replaces a paused subagent execution in the registry; the process-local Goal return then connects successful parent settlement to the existing follow-up queue. flowchart TD
A[Parent Goal turn] --> B[Yielded worker group]
B --> C[Gateway worker admission]
C --> D[Committed registry adoption]
D --> E[Retained Goal return]
E --> F[Parent result settlement]
F --> G[Existing follow-up queue]
Technical reviewBest possible solution: Keep registry adoption responsible for transferring the existing process-local Goal return while preserving the normal settlement, cancellation, and queue admission contracts. Do we have a high-confidence way to reproduce the issue? Current-main source exposes the missing runtime-key transfer, and the author reports a baseline two-worker reproduction with zero continuation callbacks; this read-only review executed no target code. Is this the best way to solve the issue? The patch repairs custody at the existing committed adoption boundary, covers its Gateway callers, and adds no competing scheduler, persistent owner, or configuration. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 03cdb2cef17e. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +46, Tests +40. Total +86 across 6 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: No label 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 November 29, 2026, 4:53 AM ET / 09:53 UTC. |
|
Merged via squash.
|
What Problem This Solves
A parent pursuing a goal yields to two workers. One pauses for a background command. When that worker resumes the same task under a new run ID, its result reaches the parent but the next automatic turn can be lost. The Gateway stays up throughout.
User Impact
The parent retains its original goal continuation when the paused worker resumes. If the child's admitted session or lifecycle revision has changed or cannot be verified, the automatic return is dropped.
Why This Change Was Made
The registry already updates the worker group when it commits the adoption. Use the admitted child identity at that point to move the existing goal return to the new run. The parent's original permissions and goal checks still apply. No new scheduler, permission, or persisted field is needed.
The registry fix applies separately from #193024. The nested Codex workflow below needs both fixes. #193136 deals with Gateway restart recovery, which is outside this change.
Evidence
Nested delegation through a running Gateway
I used the same isolated Gateway fixture, Codex CLI 0.172.0 and scripted model responses with each build. I set
agents.defaults.subagents.maxSpawnDepthto 2. A single chat message started the goal. The parent and its worker each spawned one child and yielded. I held the innermost worker until both yields were saved, then released its answer containing a value it had read from a local file.All three builds delivered both answers and resumed the middle worker under a new run ID for its original task. No further user message or Resume was sent.
9143f38a7a5b042aalonebed1e4d0aloneThe Gateway and Codex processes stayed up. These observations cover one run per build with a local provider.
Registry and goal checks
9143f38a, an isolated two-worker case delivered the first result, adopted the paused worker through the registry and delivered the second result. The goal return was missing and its resume callback ran zero times.bed1e4d0, only the current revision resumed, exactly once. The same control also exercised nested worker delivery through Gateway registration. The matching session resumed once and a changed revision did not resume. All five cases released the original operator hold. The fixture bound the goal after yield and simulated the receiver and its successful terminal result. Gateway reactivation, registry adoption, SQLite persistence and delivery sequencing ran through the product code.pnpm test src/auto-reply/reply/goal-continuation.test.ts --maxWorkers=1passed 88/88 in 53.19 seconds including startup. The four new cases took 23 ms combined. They check the queued turn, the previous address, changed or absent child identity, revocation, and release of the operator hold.OPENCLAW_E2E_SKIP_BUILD=1and a private extension of the existing requester-wake test. The two existing Gateway reactivation and explicit resume suites had already passed 25/25 on the identical code in the other five files. I checked the final registration change with the Gateway agent-turn suite and the five registry cases. No live installation or model was used.git diff --checkpassed. Local composition with the late-reply fix produced the same tree in either order.Please review the transfer of the original parent's continuation at worker adoption.