Repository navigation
fix(agents): subagent results never reach the parent while a sibling waits for its reply - #164366
stackingrockss wants to merge 4 commits into
Conversation
… requester A consumed waitFor:"message" pause notice hands the paused child's continuation to its requester. The child stayed in its frozen yield batch, so a sibling that completed later could never wake the requester: the paused member blocked the wave, and the requester was waiting for that wake. Consuming the notice now detaches the paused child into its own completion wave. Frozen-wave selection, its descendant scope, and kernel settlement treat membership as mutual. Requester cron/operator authority covers each detached wave of its original cohort and is released when the last wave settles. Plain sessions_yield pauses without a notice keep their combined delivery. Closes openclaw#164334
|
🦞👀 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 separates a child whose message-wait notice was consumed from its frozen batch so completed siblings can reach their parent independently. Example: A parent yields for run-a and run-b; run-b asks for run-a's result and pauses with waitFor: "message".
Review scores
ProductKind: Bug fix · Worth it: Needs a maintainer decision · Fix scope: Complete Merge readiness⛔ Blocked before merge - 3 items remain Keep open: this PR addresses a concrete message-wait dependency cycle, but splitting completion delivery conflicts with the reaffirmed whole-batch contract and needs an explicit exception. Priority: P1 Decision needed
Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherThe subagent registry retains child results and frozen completion batches; announce scheduling passes eligible results through Gateway admission into requester turns while preserving caller authority. flowchart TD
A[Parent yields] --> B[Registry freezes child batch]
B --> C[Child message wait]
C --> D[Pause notice consumed]
D --> E[Separate completion waves]
E --> F[Gateway authority admission]
F --> G[Requester continuation]
Technical reviewBest possible solution: Keep registry and mailbox ownership unified, with any message-wait exception explicitly scoped to preserve each child's eventual delivery and original authority. Do we have a high-confidence way to reproduce the issue? Source supports the hold: consume one child's message-wait notice, leave that child paused, and finish its frozen sibling; current main still rejects settlement before dispatch, although whether independent delivery is the intended remedy remains disputed. Is this the best way to solve the issue? The patch coordinates the existing wake, durable mutation, and authority owners rather than removing a guard alone, but its delivery-policy change is not established by the current whole-batch contract. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 27a0be4a75d9. Merge-risk optionsMaintainer options:
Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +464, Tests +901, Docs +5. Total +1370 across 16 files. Added test files: 1. View PR surface stats
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 HistoryReview history (5 earlier review cycles)
Reviewed October 27, 2026, 9:16 PM ET / October 28, 2026, 01:16 UTC (Revision 6). |
Proof behind the proofEvidence for published head Reproduce the targeted tests: node --import ./scripts/tsx.mjs scripts/test-projects.mts \
src/gateway/server.requester-pause-authority.test.ts \
src/agents/subagents/requester-cron-authority.test.ts \
src/agents/subagents/requester-cron-authority-cohort.test.ts --maxWorkers=1
pnpm check:changed
pnpm buildThe regression fixture leaves operator profile and requester session unchanged while revoking the original channel-owner grant or rotating registry lifecycle. The pre-fix production state with these regression tests failed; the repaired working tree passed. The historical red snapshot was uncommitted, so it is not presented as an independently checkoutable commit. openclaw-164334-r16-red-gateway.logSHA-256 of retained original bytes: openclaw-164334-r21-green.logSHA-256 of retained original bytes: openclaw-164334-r21-check.logSHA-256 of retained original bytes: Full changed-file checker exited 0; hash binds the retained log. openclaw-164334-a700-build-stable.logSHA-256 of retained original bytes: Exact postcommit build metadata
Build timestamp: Scope and limits
Immutable source: Gateway regressions, authority/cohort tests. |
Closes #164334
Related: #164241, #158603, #161114
What Problem This Solves
Fixes: a finished subagent's result never reaches its parent when another child in the same yielded batch has paused with
sessions_yieldwaitFor: "message"and its pause notice was already delivered.User Impact
A parent that receives a child's "paused awaiting continuation" notice now still gets its other children's results as they finish, whether or not it has sent that continuation yet. The paused child's own result arrives separately after it resumes. Previously the parent stayed idle with zero wake attempts, even though
sessions_yieldhad just told it the sibling's completion "will arrive as a later turn". In the reported case, that lasted about six hours until a human sent a message.Plain
sessions_yieldpauses without a notice keep their existing one-combined-delivery behavior. There is no config, schema or migration change.Why This Change Was Made
A consumed pause notice hands the paused child's continuation to its requester. The child still sat in its frozen yield batch, and the batch waits for every member. The paused child was waiting for its requester, and the requester was waiting for the batch.
Consuming the notice now detaches that child into its own completion wave (
batchRunIds: [self]), keeping its own completion custody. Frozen batch membership is mutual: wave selection, the wave's descendant scope and kernel outcome settlement skip a member whose own batch no longer lists the settling run.Requester cron/operator authority follows the split. A yield authority still covers only its original cohort, requester session, operator and rearm generation, but each detached wave of that cohort can use it. It is narrowed as waves settle and released after the last one. Settled operator rows keep their binding, so a stray retry fails closed exactly as
discard()already requires. The cohort rules and frozen-wave selection moved into small sibling modules to stay within the line caps.Known limit, unchanged by this PR: the in-memory requester final attachment is keyed by the cohort's original run IDs and is never remapped. Resuming a paused child already created a new run ID, so a cohort containing a message-wait pause could not match it before this change either.
Hardening and authority boundaries
Evidence
Raw red/green excerpts, reproducible commands, SHA-256 bindings, postcommit build metadata, and proof limitations: proof behind the proof.
Reviewable immutable source: Gateway admission regressions, receipt/lifecycle tests, and actual acceptance boundary.
Exact candidate:
a7002f214bdc174b73c86559f9f3fb1c33a856e8.server.requester-pause-authority.test.tsruns the publicagentmethod through the actual Gateway handler, admission/actor identity and runtime stores. Original operator revocation, expired authority, requester reset, late retirement, cached retry, cache eviction and a retired delivery claim are exercised. The agent-command/provider bridge is synthetic; this is not a live model or ordinary outside-harness UI demonstration.operator.writeclient with no admin override and no Cron entitlement originally reached execution/input staging twice after cache eviction. The repaired code replays without changing transcript/admission count, rejects cache-missing retry, and still delivers the next detached completion. Cron authority stays undefined.pnpm check:changedpassed including production/test types, lint, dead exports, runtime cycles and line caps.git diff --checkand six-file format validation passed.pnpm buildpassed in 378.64s;dist/build-info.json.commitmatches this exact head. An earlier build was invalidated by removal of temporary review inputs during compilation; it was not credited, and the stable-namespace rerun passed.View the OpenClaw team session