Repository navigation
fix(subagents): deliver finished results instead of refusing on store path or operator authority - #200760
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: blocked before merge. What this changesThis PR removes store-path delivery vetoes and makes missing, revoked, or mixed completion custody fall back to System authority. Example: A finished child targets agent:main:main after its requester moves from sessions.json to moved-sessions.json.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 4 items remain Keep open: this maintainer-directed repair addresses result loss, but its baseline fallback preserves ambient authority and its cutover leaves broken consumers. Priority: P1 Before merge
Findings
Tests
Agent review detailsHow this fits togetherThe subagent registry retains completed child results and completion custody; settlement batches submit those results through Gateway admission into the requester conversation. flowchart LR
A[Child completion] --> B[Subagent registry]
C[Retained operator custody] --> B
B --> D[Requester settlement]
D --> E[Gateway admission]
E --> F[Requester conversation]
Technical reviewBest possible solution: Keep logical-chat delivery in the existing completion owner, explicitly enter write-only System authority on ordinary fallback, and update the obsolete consumers. Do we have a high-confidence way to reproduce the issue? Current-main source shows both refusal paths, and the author reports red/green regressions; this review did not execute target code. Is this the best way to solve the issue? Removing the delivery vetoes is a focused use of existing owners, but calling an unscoped callback does not establish the promised baseline authority. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 427c8572025e. Provenance checked
TestingProof path: in-process harness. SecurityNeeds attention: The fallback does not isolate the execution principal from ambient operator context. EvidenceSecurity concerns:
What I checked:
PR surfaceSource -231, Tests -411, Docs +10. Total -632 across 24 files. Added test files: 1. 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:
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 17, 2026, 2:32 PM ET / 19:32 UTC. |
… path or operator authority Finished child results route to the requester by agent and session key. The recorded store path no longer vetoes delivery, and missing, revoked or mixed operator custody falls back to the System write-only baseline instead of dropping the result.
…lowlist with delivery fallback
aa55bbd to
bcb02a2
Compare
|
|
Maintainer override Landing head 540cdff outside the landpr merge helper, by maintainer decision. Local ClawSweeper review: one finding, accepted. The review flags that a revoked operator's pending result starts a requester turn at the System write-only baseline instead of being refused. That is the intended behavior of this PR, recorded under "Accepted tradeoffs" in the description: a finished result is delivered, never dropped, and settle turns already run at that baseline after every Gateway restart. The merge helper requires a zero-finding review and has no path for an accepted finding, so this merge bypasses it. Red required check not caused by this PR:
Every other failure seen on earlier heads was caused by this PR and is fixed on this head. |
|
Landed in 714129c.
|
… path or operator authority (#200760) Backport-of: #200760 Source-commit: 714129c Adapt completion delivery to the release branch without removing control-scope store checks. Retain private-result/reset incarnation fences, current requester and run identity, cancellation, consumed receipts, and live authority checks. Missing/revoked/mixed completion custody uses the explicit System write-only baseline, never ambient or sibling authority. Temporary access-policy outages remain retryable. Validation: six baseline regression failures reproduced by the isolated worker; parent targeted completion suites and core types, typed lint, formatting and diff checks. Full exact-candidate qualification remains required. Package/tag/npm publication held. Co-authored-by: RomneyDa <[email protected]> Co-authored-by: vincentkoc <[email protected]>
… path or operator authority (openclaw#200760) ## Problem Finished subagent results were dropped by identity checks that run after the work is done: - **Store-path veto.** Each result recorded the requester's session store path at spawn. If the path resolved differently later (for example after a config reload republished the resolver), the result was suspended as "store replaced" and never delivered. Delivery never used that path: it finds the requester by agent and session key. - **Operator-authority refusals.** A settle turn refused to run when a child's retained operator custody was missing or revoked. The parent then saw "authority is no longer active" and the result was lost. Previous fixes exempted one case at a time. ## Fix Delete both refusal classes. A finished result is delivered to the requester chat by `(requesterAgentId, requesterSessionKey)`. - Removed the store-path comparison as a delivery veto: settle-wake `isStoreCurrent` / `retireReplacedStore`, the store branch in `isSubagentCompletionDeliveryAllowed`, `suspendReplacedStoreNotifications` and its store-owner registration, the post-announce store block, and the `storeReplaced` plumbing through the completion mutation kernel and receipt admission. - Removed `requiredCompletionEntries` and the authority throws. openclaw#200873 already splits settle batches by retained operator turn; within a batch, `runWithSubagentCompletionBatchAuthority` now runs under retained custody only when every member has the same live source and permission ceiling, and otherwise at the System write-only baseline, which settle turns already use after every Gateway restart. It never borrows a sibling's permissions. - Kept: explicit stop/cancel, requester deletion, cancellation-notice callers, and the temporary access-policy outage retry. ## User impact Subagent results no longer disappear after config edits or Gateway restarts. A continuation turn that lost its original operator custody runs at the baseline permission instead of being dropped; this already happens after every restart. ## Accepted tradeoffs (maintainer decision) - **Revoked requester.** If the operator who spawned a child loses access before the child finishes, the result still wakes the requester session, at the System write-only baseline. It is no longer dropped. Gateway admission still checks the requester session. - **Different physical store, same session key.** If `session.store` is changed to a different database that has its own session with the same key, a pending result from the old store is delivered to that session. This reverses the automatic suspension from openclaw#152828. Delivery has no stored identity that separates a moved store from an unrelated one; adding one is a schema change and is out of scope here. ## Evidence - Regression in `subagent-registry.requester-delivery.test.ts`, red on the merge base (zero settle turns) and green with the fix: a finished child with a mismatched recorded `requesterStorePath` and a live requester is delivered through the real in-process dispatcher. - `subagent-control.publication.test.ts` now asserts that a revoked owner's result is delivered at the baseline. - Affected registry, announce, completion, sweep-settle and restart-custody suites pass after rebasing on openclaw#200873 (189 tests across 8 files). - `test/gateway-subagent-completion-restart.e2e.test.ts` (real Gateway restart): 8 of 9 cases pass. `announcing-crash` fails identically on the merge base when run alone; openclaw#200873 documents the same pre-existing failure. - Full build and packed install smoke pass. - Production: 46 lines added, 271 removed; tests: net -439 lines. Known follow-ups, not changed here: a deleted requester can leave an owed wake retrying (pre-existing); `ensureSubagentControllerOwnsRun` still compares the recorded store path for kill/steer control.
* fix: keep subagent results owed under their requester authority * test: keep restored notices pending until requester admission * fix: retry unavailable settle wakes only before execution * refactor: keep retained completion admission in the registry owner (cherry picked from commit f444d3b) Release adaptation: port only requester-turn batch selection and safe uncommitted retry, the prerequisite consumed by #200760. Retain baseline absent restart-interrupted sweep and its unrelated recovery tests; do not resurrect that separate behavior. Follow-up: #200760 selected next replaces strict batch admission with System-baseline delivery. Bounded companion audit requested; no later #200873 mentions through pinned main besides #200760. Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit 21b77b640fa48258014c1513f907e3aec0c81557)
… path or operator authority (#200760) Finished subagent results were dropped by identity checks that run after the work is done: - **Store-path veto.** Each result recorded the requester's session store path at spawn. If the path resolved differently later (for example after a config reload republished the resolver), the result was suspended as "store replaced" and never delivered. Delivery never used that path: it finds the requester by agent and session key. - **Operator-authority refusals.** A settle turn refused to run when a child's retained operator custody was missing or revoked. The parent then saw "authority is no longer active" and the result was lost. Previous fixes exempted one case at a time. Delete both refusal classes. A finished result is delivered to the requester chat by `(requesterAgentId, requesterSessionKey)`. - Removed the store-path comparison as a delivery veto: settle-wake `isStoreCurrent` / `retireReplacedStore`, the store branch in `isSubagentCompletionDeliveryAllowed`, `suspendReplacedStoreNotifications` and its store-owner registration, the post-announce store block, and the `storeReplaced` plumbing through the completion mutation kernel and receipt admission. - Removed `requiredCompletionEntries` and the authority throws. #200873 already splits settle batches by retained operator turn; within a batch, `runWithSubagentCompletionBatchAuthority` now runs under retained custody only when every member has the same live source and permission ceiling, and otherwise at the System write-only baseline, which settle turns already use after every Gateway restart. It never borrows a sibling's permissions. - Kept: explicit stop/cancel, requester deletion, cancellation-notice callers, and the temporary access-policy outage retry. Subagent results no longer disappear after config edits or Gateway restarts. A continuation turn that lost its original operator custody runs at the baseline permission instead of being dropped; this already happens after every restart. - **Revoked requester.** If the operator who spawned a child loses access before the child finishes, the result still wakes the requester session, at the System write-only baseline. It is no longer dropped. Gateway admission still checks the requester session. - **Different physical store, same session key.** If `session.store` is changed to a different database that has its own session with the same key, a pending result from the old store is delivered to that session. This reverses the automatic suspension from #152828. Delivery has no stored identity that separates a moved store from an unrelated one; adding one is a schema change and is out of scope here. - Regression in `subagent-registry.requester-delivery.test.ts`, red on the merge base (zero settle turns) and green with the fix: a finished child with a mismatched recorded `requesterStorePath` and a live requester is delivered through the real in-process dispatcher. - `subagent-control.publication.test.ts` now asserts that a revoked owner's result is delivered at the baseline. - Affected registry, announce, completion, sweep-settle and restart-custody suites pass after rebasing on #200873 (189 tests across 8 files). - `test/gateway-subagent-completion-restart.e2e.test.ts` (real Gateway restart): 8 of 9 cases pass. `announcing-crash` fails identically on the merge base when run alone; #200873 documents the same pre-existing failure. - Full build and packed install smoke pass. - Production: 46 lines added, 271 removed; tests: net -439 lines. Known follow-ups, not changed here: a deleted requester can leave an owed wake retrying (pre-existing); `ensureSubagentControllerOwnsRun` still compares the recorded store path for kill/steer control. (cherry picked from commit 714129c) Release adaptation: retain baseline deleted session identity allowlist and omit incoming unrelated restored-running-child test since baseline has no restart-interrupted sweep owner. Requester batch dependency #200873 selected immediately before. Follow-up: no later #200760 mention through pinned main; store kill/steer authority checks remain intentionally unchanged. Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit d361b6ff3c0a18a6a3f4431c67ddf2f0129c352b)
…led replies (#204089) ## Problem When a child (subagent) result could not be handed to its parent turn, `recordRequiredCompletionNotice` wrote the notice as customType `run-failed-before-reply`. The Control UI renders that type as a failed reply: a red "Couldn't finish this reply" badge with "Report a bug". This happened even when no reply was running and the child ended days earlier. Seen in production. Child deliveries suspended by the old store-path veto (removed in #200760) stayed suspended. They expired after the 7-day retention, and the expiry sweep put red failed-reply badges under unrelated later turns. One notice was for a child that had been **killed** on purpose and had no captured result. The badge showed a raw session key, a run id, the word `killed`, and the text "…then retry or resend your request", but there was no request to retry. #200760 fixed the root cause of the suspension. This PR fixes how the remaining failure, expiry and idle-expiry notices are shown. ## Solution All changes are in the notice owner, `recordRequiredCompletionNotice`, and its copy: - **Killed or cancelled child with no captured result → no notice.** The function filters each batch member: `endedReason === "subagent-killed"`, not a steer restart, and no captured result text. Live siblings in the same batch still get their notice. A killed child that holds a captured result still shows it. There are no per-caller checks. - **Child-delivery notices use `customType: "subagent-completion"`**, the child-result row kind the function already writes for `kind === "result"`. No UI reader treats this type as a run error, so the red badge and "Report a bug" go away. No new customType. Old stored rows render as before. - **Model context: unchanged.** The design planned `excludeFromContext: true` for all notices. That rested on `packages/agent-core/.../session.ts` excluding every `run-failed-before-reply` row. That is one reader only. The SQLite model-context projection and `cli-runner/session-history.ts` read only `excludeFromContext`. So an unconsumed failure notice did reach the parent model, as `docs/tools/subagents/announce.md` documents ("available to the requester model if it never consumed the original result"). The existing conditional stays as it was: the notice enters model context only while a batch member's result is unconsumed (local review finding, round 3). - **Copy:** "<child label> finished on <date> UTC, but its result couldn't be added to this conversation automatically. Details are below." The heading makes no "saved result is below" claim, because a private `completionTarget=parent` handoff or an uncaptured child has only identity and status. Each child section starts with its session key and run id, then the label and status. The heading label is bounded to 200 characters, so a long label cannot push the ids out of the 512-character header or the 32,000-character limit (local review findings, rounds 1-3). - **Yielded requester** (a requester that ended its turn waiting on the child): stays a run error, because no reply was made. Its copy (`child_completion_delivery_failed`) now reads "This reply was waiting for a child agent whose result couldn't be added to this conversation automatically. Check the child session for its outcome." It no longer says "retry or resend your request". Accepted edge cases (no code for them): - A yielded batch now writes a run-error row and a separate child row. - A retry across the upgrade can duplicate one legacy row, because dedupe is scoped per customType. ## Impact - Child-delivery failure, expiry and idle-expiry notices show as neutral rows, not as failed replies. - An intentional kill writes no notice. - No schema, stored-row, protocol or dependency change. ## Evidence - New unit test `subagent-registry.store-replaced.test.ts` › "records a child-result notice for live children and none for a killed child": - Base `f595f0237a35`: **red**. It writes the incident row, `run-failed-before-reply`, "…retry or resend your request", `Child agent:main:subagent:killed … killed`. - Head: green. - Updated the existing tests that pinned `run-failed-before-reply` for child-delivery notices. The gateway and e2e assertions that check for *no* failed reply stay as they are. - `ocx test` on touched tests and every test that imports a changed source or test-support file (29 files). oxfmt and oxlint pass. `pnpm check:changed` passes except the dead export scan, which flags `scripts/lib/docker-e2e-watchdog.mjs: parseTimeoutMs`. That file is not in this diff. - Not ours: - `subagent-registry-worker.test.ts` › "releases serialized payloads…" (GC retention) fails on base `f595f0237a35` too. - `subagent-registry-lifecycle.test.ts` failed on different tests in two loaded runs. It passed alone on head and on base. - Real-product E2E: isolated scratch Gateway from source, real agent turns on Claude through the Control UI. The agent spawned two children; state was edited so one child was killed with no result and both deliveries were suspended for more than 7 days. Then the real sweeper ran `discardExpiredSubagentDelivery`. - Before (base): both children show the red "Couldn't finish this reply" + "Report a bug", the killed one included. - After (head): the ok child shows a neutral System row with its result and no badge. The killed child writes no row. Co-authored-by: Ayaan Zaidi <[email protected]>
…led replies (openclaw#204089) ## Problem When a child (subagent) result could not be handed to its parent turn, `recordRequiredCompletionNotice` wrote the notice as customType `run-failed-before-reply`. The Control UI renders that type as a failed reply: a red "Couldn't finish this reply" badge with "Report a bug". This happened even when no reply was running and the child ended days earlier. Seen in production. Child deliveries suspended by the old store-path veto (removed in openclaw#200760) stayed suspended. They expired after the 7-day retention, and the expiry sweep put red failed-reply badges under unrelated later turns. One notice was for a child that had been **killed** on purpose and had no captured result. The badge showed a raw session key, a run id, the word `killed`, and the text "…then retry or resend your request", but there was no request to retry. openclaw#200760 fixed the root cause of the suspension. This PR fixes how the remaining failure, expiry and idle-expiry notices are shown. ## Solution All changes are in the notice owner, `recordRequiredCompletionNotice`, and its copy: - **Killed or cancelled child with no captured result → no notice.** The function filters each batch member: `endedReason === "subagent-killed"`, not a steer restart, and no captured result text. Live siblings in the same batch still get their notice. A killed child that holds a captured result still shows it. There are no per-caller checks. - **Child-delivery notices use `customType: "subagent-completion"`**, the child-result row kind the function already writes for `kind === "result"`. No UI reader treats this type as a run error, so the red badge and "Report a bug" go away. No new customType. Old stored rows render as before. - **Model context: unchanged.** The design planned `excludeFromContext: true` for all notices. That rested on `packages/agent-core/.../session.ts` excluding every `run-failed-before-reply` row. That is one reader only. The SQLite model-context projection and `cli-runner/session-history.ts` read only `excludeFromContext`. So an unconsumed failure notice did reach the parent model, as `docs/tools/subagents/announce.md` documents ("available to the requester model if it never consumed the original result"). The existing conditional stays as it was: the notice enters model context only while a batch member's result is unconsumed (local review finding, round 3). - **Copy:** "<child label> finished on <date> UTC, but its result couldn't be added to this conversation automatically. Details are below." The heading makes no "saved result is below" claim, because a private `completionTarget=parent` handoff or an uncaptured child has only identity and status. Each child section starts with its session key and run id, then the label and status. The heading label is bounded to 200 characters, so a long label cannot push the ids out of the 512-character header or the 32,000-character limit (local review findings, rounds 1-3). - **Yielded requester** (a requester that ended its turn waiting on the child): stays a run error, because no reply was made. Its copy (`child_completion_delivery_failed`) now reads "This reply was waiting for a child agent whose result couldn't be added to this conversation automatically. Check the child session for its outcome." It no longer says "retry or resend your request". Accepted edge cases (no code for them): - A yielded batch now writes a run-error row and a separate child row. - A retry across the upgrade can duplicate one legacy row, because dedupe is scoped per customType. ## Impact - Child-delivery failure, expiry and idle-expiry notices show as neutral rows, not as failed replies. - An intentional kill writes no notice. - No schema, stored-row, protocol or dependency change. ## Evidence - New unit test `subagent-registry.store-replaced.test.ts` › "records a child-result notice for live children and none for a killed child": - Base `3baee0bb1290`: **red**. It writes the incident row, `run-failed-before-reply`, "…retry or resend your request", `Child agent:main:subagent:killed … killed`. - Head: green. - Updated the existing tests that pinned `run-failed-before-reply` for child-delivery notices. The gateway and e2e assertions that check for *no* failed reply stay as they are. - `ocx test` on touched tests and every test that imports a changed source or test-support file (29 files). oxfmt and oxlint pass. `pnpm check:changed` passes except the dead export scan, which flags `scripts/lib/docker-e2e-watchdog.mjs: parseTimeoutMs`. That file is not in this diff. - Not ours: - `subagent-registry-worker.test.ts` › "releases serialized payloads…" (GC retention) fails on base `3baee0bb1290` too. - `subagent-registry-lifecycle.test.ts` failed on different tests in two loaded runs. It passed alone on head and on base. - Real-product E2E: isolated scratch Gateway from source, real agent turns on Claude through the Control UI. The agent spawned two children; state was edited so one child was killed with no result and both deliveries were suspended for more than 7 days. Then the real sweeper ran `discardExpiredSubagentDelivery`. - Before (base): both children show the red "Couldn't finish this reply" + "Report a bug", the killed one included. - After (head): the ok child shows a neutral System row with its result and no badge. The killed child writes no row. Co-authored-by: Ayaan Zaidi <[email protected]>
…led replies (#204089) When a child (subagent) result could not be handed to its parent turn, `recordRequiredCompletionNotice` wrote the notice as customType `run-failed-before-reply`. The Control UI renders that type as a failed reply: a red "Couldn't finish this reply" badge with "Report a bug". This happened even when no reply was running and the child ended days earlier. Seen in production. Child deliveries suspended by the old store-path veto (removed in #200760) stayed suspended. They expired after the 7-day retention, and the expiry sweep put red failed-reply badges under unrelated later turns. One notice was for a child that had been **killed** on purpose and had no captured result. The badge showed a raw session key, a run id, the word `killed`, and the text "…then retry or resend your request", but there was no request to retry. All changes are in the notice owner, `recordRequiredCompletionNotice`, and its copy: - **Killed or cancelled child with no captured result → no notice.** The function filters each batch member: `endedReason === "subagent-killed"`, not a steer restart, and no captured result text. Live siblings in the same batch still get their notice. A killed child that holds a captured result still shows it. There are no per-caller checks. - **Child-delivery notices use `customType: "subagent-completion"`**, the child-result row kind the function already writes for `kind === "result"`. No UI reader treats this type as a run error, so the red badge and "Report a bug" go away. No new customType. Old stored rows render as before. - **Model context: unchanged.** The design planned `excludeFromContext: true` for all notices. That rested on `packages/agent-core/.../session.ts` excluding every `run-failed-before-reply` row. That is one reader only. The SQLite model-context projection and `cli-runner/session-history.ts` read only `excludeFromContext`. So an unconsumed failure notice did reach the parent model, as `docs/tools/subagents/announce.md` documents ("available to the requester model if it never consumed the original result"). The existing conditional stays as it was: the notice enters model context only while a batch member's result is unconsumed (local review finding, round 3). - **Copy:** "<child label> finished on <date> UTC, but its result couldn't be added to this conversation automatically. Details are below." The heading makes no "saved result is below" claim, because a private `completionTarget=parent` handoff or an uncaptured child has only identity and status. Each child section starts with its session key and run id, then the label and status. The heading label is bounded to 200 characters, so a long label cannot push the ids out of the 512-character header or the 32,000-character limit (local review findings, rounds 1-3). - **Yielded requester** (a requester that ended its turn waiting on the child): stays a run error, because no reply was made. Its copy (`child_completion_delivery_failed`) now reads "This reply was waiting for a child agent whose result couldn't be added to this conversation automatically. Check the child session for its outcome." It no longer says "retry or resend your request". Accepted edge cases (no code for them): - A yielded batch now writes a run-error row and a separate child row. - A retry across the upgrade can duplicate one legacy row, because dedupe is scoped per customType. - Child-delivery failure, expiry and idle-expiry notices show as neutral rows, not as failed replies. - An intentional kill writes no notice. - No schema, stored-row, protocol or dependency change. - New unit test `subagent-registry.store-replaced.test.ts` › "records a child-result notice for live children and none for a killed child": - Base `f595f0237a35`: **red**. It writes the incident row, `run-failed-before-reply`, "…retry or resend your request", `Child agent:main:subagent:killed … killed`. - Head: green. - Updated the existing tests that pinned `run-failed-before-reply` for child-delivery notices. The gateway and e2e assertions that check for *no* failed reply stay as they are. - `ocx test` on touched tests and every test that imports a changed source or test-support file (29 files). oxfmt and oxlint pass. `pnpm check:changed` passes except the dead export scan, which flags `scripts/lib/docker-e2e-watchdog.mjs: parseTimeoutMs`. That file is not in this diff. - Not ours: - `subagent-registry-worker.test.ts` › "releases serialized payloads…" (GC retention) fails on base `f595f0237a35` too. - `subagent-registry-lifecycle.test.ts` failed on different tests in two loaded runs. It passed alone on head and on base. - Real-product E2E: isolated scratch Gateway from source, real agent turns on Claude through the Control UI. The agent spawned two children; state was edited so one child was killed with no result and both deliveries were suspended for more than 7 days. Then the real sweeper ran `discardExpiredSubagentDelivery`. - Before (base): both children show the red "Couldn't finish this reply" + "Report a bug", the killed one included. - After (head): the ok child shows a neutral System row with its result and no badge. The killed child writes no row. Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit d66eeff) Release adaptation: port the child notice assertion into the stable split wake fixture without changing cohort tests. #204748 is a focused fixture clock companion; #204178 and #204260 are later history redesigns, and other audit matches address separate features or fixtures. Co-authored-by: RomneyDa <[email protected]>
Problem
Finished subagent results were dropped by identity checks that run after the work is done:
Previous fixes exempted one case at a time.
Fix
Delete both refusal classes. A finished result is delivered to the requester chat by
(requesterAgentId, requesterSessionKey).isStoreCurrent/retireReplacedStore, the store branch inisSubagentCompletionDeliveryAllowed,suspendReplacedStoreNotificationsand its store-owner registration, the post-announce store block, and thestoreReplacedplumbing through the completion mutation kernel and receipt admission.requiredCompletionEntriesand the authority throws. fix: preserve subagent results under each requester turn #200873 already splits settle batches by retained operator turn; within a batch,runWithSubagentCompletionBatchAuthoritynow runs under retained custody only when every member has the same live source and permission ceiling, and otherwise at the System write-only baseline, which settle turns already use after every Gateway restart. It never borrows a sibling's permissions.User impact
Subagent results no longer disappear after config edits or Gateway restarts. A continuation turn that lost its original operator custody runs at the baseline permission instead of being dropped; this already happens after every restart.
Accepted tradeoffs (maintainer decision)
session.storeis changed to a different database that has its own session with the same key, a pending result from the old store is delivered to that session. This reverses the automatic suspension from fix: keep child notifications out of replaced session stores #152828. Delivery has no stored identity that separates a moved store from an unrelated one; adding one is a schema change and is out of scope here.Evidence
subagent-registry.requester-delivery.test.ts, red on the merge base (zero settle turns) and green with the fix: a finished child with a mismatched recordedrequesterStorePathand a live requester is delivered through the real in-process dispatcher.subagent-control.publication.test.tsnow asserts that a revoked owner's result is delivered at the baseline.test/gateway-subagent-completion-restart.e2e.test.ts(real Gateway restart): 8 of 9 cases pass.announcing-crashfails identically on the merge base when run alone; fix: preserve subagent results under each requester turn #200873 documents the same pre-existing failure.Known follow-ups, not changed here: a deleted requester can leave an owed wake retrying (pre-existing);
ensureSubagentControllerOwnsRunstill compares the recorded store path for kill/steer control.