Skip to content

fix(agents): subagent results never reach the parent while a sibling waits for its reply - #164366

Open
stackingrockss wants to merge 4 commits into
openclaw:mainfrom
stackingrockss:fix/164334-paused-batch-sibling
Open

stackingrockss wants to merge 4 commits into
openclaw:mainfrom
stackingrockss:fix/164334-paused-batch-sibling

Conversation

@stackingrockss

@stackingrockss stackingrockss commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

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_yield waitFor: "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_yield had 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_yield pauses 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

  • Each detached wave retains the original operator, requester incarnation and frozen cohort generation; no newer authority is borrowed.
  • Admitted turns retain their own lifecycle while earlier waves settle. Custody releases only after both scoped work and admitted delivery acknowledgements finish; original-source revocation still cuts it off immediately.
  • Exact admitted-wave retries may retrieve the Gateway's cached result, but cannot create new input/execution if the cached outcome is missing.
  • Operators without Cron-management entitlement receive lifecycle-only acceptance tracking, never a Cron capability or new permission.
  • No persisted schema, config option, orchestration registry or live Gateway change.

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.

  • Real Gateway admission + SQLite proof: server.requester-pause-authority.test.ts runs the public agent method 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.
  • Non-Cron negative control: an operator.write client 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.
  • Original-source liveness: cached retries and their captured dispatch assertion reject independently revoked channel-owner grants and registry lifecycle rotation while the operator profile and requester session remain unchanged. The after-await case is owner-level assertion proof on a genuinely admitted/cached wave, not a raced public transport request.
  • Timing reproductions: late-wave retirement, ambiguous sibling/final acknowledgements, and zero-scoped-turn unsettled receipts failed before their repairs. Immediate revocation remains covered. Prior fixture-reference errors are not counted as bug reproductions.
  • Coverage retained: 18 Gateway cases and 37 authority/cohort cases pass; retirement tests were moved intact into a coherent sibling module to meet the line-cap ratchet. Existing registry/lifecycle/completion/outbox/codec cases remain.
  • Validation: full pnpm check:changed passed including production/test types, lint, dead exports, runtime cycles and line caps. git diff --check and six-file format validation passed.
  • Independent review: final full-delta autoreview through P2 is scoped-clean for this exact head. Earlier actionable findings were reproduced and repaired, not waived. The reviewer assessed supplied source/test evidence; its isolated sandbox did not independently execute the repository.
  • Build: postcommit pnpm build passed in 378.64s; dist/build-info.json.commit matches 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.
  • CI/security: current-head CI/ClawSweeper reconciliation and authorized upstream security approval remain pending. No merge/deployment has been performed.

View the OpenClaw team session

… 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
@clawsweeper

clawsweeper Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime agents Agent runtime and tooling size: L labels Oct 3, 2026
@github-actions

github-actions Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Maintainer security review required

This external contributor PR changes sensitive security components. A maintainer must review these changes before merging.

Current SHA: a7002f214bdc174b73c86559f9f3fb1c33a856e8

These sensitive security changes were made:

  • src/agents/subagents/requester-cron-authority-cohort.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/subagents/requester-cron-authority.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.

After reviewing the changes, post a new PR comment containing only approval commands, each on its own line:

/allow-security-sensitive-change

A later push requires a fresh approval comment.

@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 3, 2026
@clawsweeper

clawsweeper Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

This 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".

  • Before: After run-a finishes, its result remains held because run-b is still paused.
  • After: The parent receives run-a's result, can continue run-b, and receives run-b's completion separately.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The coordinated implementation and authority regressions are meaningful, but the required automatic-flow evidence remains incomplete and product direction is unsettled.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Needs a maintainer decision · Fix scope: Complete
User problem: A parent cannot receive a completed producer's result while a paused sibling needs that result from the parent before it can finish.
Reason: The dependency cycle has concrete user value, but the proposed independent delivery changes behavior an area owner explicitly reaffirmed; the descendant-wait decision does not clearly authorize a message-wait exception.

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
Reviewed head: a7002f214bdc174b73c86559f9f3fb1c33a856e8
Owner decision: Required. See Decision needed.

Decision needed

  • Question: Should a consumed explicit waitFor: "message" notice be an exception to the reaffirmed whole-batch completion contract?
  • Recommendation: Retain whole-batch delivery: Preserve the current contract and handle dependent producer/consumer work in separate cohorts, with accurate pending-child guidance.
  • Why: The newer owner decision preserves whole-batch delivery and verifies descendant-driven resumption, while this PR addresses a child that needs parent-provided information from a completed sibling; no recorded approval establishes that exception.

Before merge

  • Add real behavior proof - The recorded Gateway/SQLite runs meaningfully exercise changed authority admission, including revoked-source and missing-cache controls, but manually stage completion waves; the automatic lifecycle composition mocks final dispatch. Supply redacted after-fix terminal output, logs, or a recording showing automatic sibling delivery while the other child remains paused, then continuation and its later result; remove credentials, private identifiers, IPs, phone numbers, and non-public endpoints. Update the PR evidence and request re-review. After adding proof, update the PR body, then request a new review with @clawsweeper re-review. The PR author or someone with repository write access can request it.
  • Resolve merge risk - The contributor must resolve GitHub's verified merge conflicts and validate the integrated delivery and authority paths before merge.
  • Await maintainer action - An authorized maintainer must complete the enforced security-sensitive approval for the final reviewed head.

Findings

None.

Tests

  • Missing end-to-end proof: The supplied evidence does not show automatic pause notice → sibling delivery while paused → sessions_send continuation → resumed-child delivery through the actual Gateway dispatch.
Agent review details

How this fits together

The 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]
Loading

Technical review

Best 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 options

Maintainer options:

  1. Resolve the integration conflicts (recommended)
    After the delivery policy is settled, the contributor should integrate the approved change with current main and validate the affected completion and authority boundaries.
  2. Pause the proposed split
    Hold this PR while the existing whole-batch contract remains authoritative.

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit d023e9f adds src/agents/subagents/announce/subagent-announce.requester-settle-wake.ts:175 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: d023e9f5624b; files: src/agents/subagents/announce/subagent-announce.requester-settle-wake.ts)
  • Vincent Koc: Raw commit 2db3431 adds src/agents/subagent-announce.requester-settle-wake.ts:248 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 2db3431f4aa1; files: src/agents/subagent-announce.requester-settle-wake.ts)
  • Vito Cappello: Raw commit 7d12927 adds src/agents/subagent-announce.requester-settle-wake.ts:274 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 7d129279a44e; files: src/agents/subagent-announce.requester-settle-wake.ts)
  • smthfoxy: Raw commit eb4f3d7 adds src/agents/subagent-announce.requester-settle-wake.ts:186 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: eb4f3d792f41; files: src/agents/subagent-announce.requester-settle-wake.ts)

PR surface

Source +464, Tests +901, Docs +5. Total +1370 across 16 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 7 619 155 +464
Tests 7 914 13 +901
Docs 2 6 1 +5
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 16 1539 169 +1370

Labels

Label changes:

No label changes.

Label justifications:

  • P1: The reported dependency cycle can leave required results retained indefinitely while the parent and paused child await each other.
  • merge-risk: 🚨 message-delivery: The patch changes a frozen cohort from one aggregate continuation into separate requester turns, altering completion timing and aggregation.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (5 earlier review cycles)
  • reviewed 2026-10-03T15:21:21.527Z sha cff68cc :: needs real behavior proof before merge. :: [P1] Preserve remaining wave authority when Gateway binds the first turn
  • reviewed 2026-10-03T21:18:59.084Z sha a7002f2 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-03T23:13:15.686Z sha a7002f2 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-03T23:49:27.093Z sha a7002f2 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-04T01:37:16.133Z sha a7002f2 :: needs real behavior proof before merge. :: none

Reviewed October 27, 2026, 9:16 PM ET / October 28, 2026, 01:16 UTC (Revision 6).

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Oct 3, 2026
@openclaw-barnacle openclaw-barnacle Bot closed this Oct 3, 2026
@openclaw-barnacle openclaw-barnacle Bot reopened this Oct 3, 2026
@stackingrockss

Copy link
Copy Markdown
Contributor Author

Proof behind the proof

Evidence for published head a7002f214bdc174b73c86559f9f3fb1c33a856e8. These are captured local results, not upstream CI success or production deployment.

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 build

The 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.log

SHA-256 of retained original bytes: a34e699bf465b3fd7619da5ed50f4d56b35ab26b1fa0c7aa21c2e0e85a8aafd7

⎯⎯⎯⎯⎯⎯⎯ Failed Tests 3 ⎯⎯⎯⎯⎯⎯⎯
FAIL   gateway-server (gateway-server-parallel)  src/gateway/server.requester-pause-authority.test.ts > requester pause authority at the Gateway effect > admits each detached completion wave under the cohort's operator (sibling replay channel grant revoked between waves)
AssertionError: promise resolved "{ …(4) }" instead of rejecting
FAIL   gateway-server (gateway-server-parallel)  src/gateway/server.requester-pause-authority.test.ts > requester pause authority at the Gateway effect > admits each detached completion wave under the cohort's operator (sibling replay channel grant revoked after await between waves)
AssertionError: expected [Function assertCurrent] to throw an error
FAIL   gateway-server (gateway-server-parallel)  src/gateway/server.requester-pause-authority.test.ts > requester pause authority at the Gateway effect > admits each detached completion wave under the cohort's operator (sibling replay lifecycle rotated between waves)
AssertionError: promise resolved "{ …(4) }" instead of rejecting
Test Files  1 failed (1)
Tests  3 failed | 15 passed (18)

openclaw-164334-r21-green.log

SHA-256 of retained original bytes: 521943ca84b51133add583cab5add685b4f9048bb32c302841afeac02572d5b7

Test Files  1 passed (1)
Tests  18 passed (18)
Test Files  2 passed (2)
Tests  37 passed (37)
[test] passed 2 Vitest shards in 41.79s

openclaw-164334-r21-check.log

SHA-256 of retained original bytes: 3dc0ebae7dcd06c3dcc12d6d49e028aee2fee4ec426743eafafeab9b8cee8e3c

Full changed-file checker exited 0; hash binds the retained log.

openclaw-164334-a700-build-stable.log

SHA-256 of retained original bytes: 729c89933c877f2434c055bc08d742d36a39aa58cc3dfcae8490bc281c9d4d69

BUILD_WALL=378.64 RSS_KB=9775140

Exact postcommit build metadata

dist/build-info.json.commit = a7002f214bdc174b73c86559f9f3fb1c33a856e8

Build timestamp: 2026-10-03T20:53:49.192Z; build ID: 2026.9.8-a7002f214bdc-2026-10-03T20-53-49.192Z.

Scope and limits

  • Gateway tests use the real public agent handler/admission and runtime stores with a synthetic provider, not a live model/production demonstration.
  • The after-await regression exercises an owner-held captured assertion on a genuinely admitted/cached wave; it is not a raced public transport request.
  • Green tests/checker were recorded on the repaired working tree before commit. The stable-namespace postcommit build was verified against the exact published head.
  • Final full-delta P2 autoreview was scoped-clean; its isolated sandbox did not independently execute the repository.
  • Hashes bind retained originals to these excerpts; they do not independently authenticate execution.
  • A newer normal-merge candidate, d6fa803e90a86d569070c31f575a3f5a34a2fb36, is not certified by the above results. Its targeted tests ran, but changed-file checking failed on an upstream line-cap violation in src/config/sessions/session-transcript-worker.types.ts (700 → 703). The integrated build did not run after that failure. It has not been pushed.
  • Upstream CI/security approval remains separate. No merge or deployment is claimed.

Immutable source: Gateway regressions, authority/cohort tests.

@roboclaw-bot roboclaw-bot added the clawtributors PR from a clawtributor label Oct 28, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 28, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling clawtributors PR from a clawtributor docs Improvements or additions to documentation gateway Gateway runtime merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. security-review-required security-sensitive-changed size: XL status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: completed child never wakes requester when a sibling in its frozen yield batch is paused by sessions_yield

2 participants