Repository navigation
fix: deliver subagent results after the requester yields - #155348
Conversation
Retain the original restricted operator source at registered completion custody, independently of spawning execution. Release on committed settlement or revocation; preserve exact-row, batch, cancellation and retry ownership. Related: #143334 Co-authored-by: jalehman <[email protected]>
OpenClaw-Publication: b1f1b29c-a435-4aa0-9508-5d44d8fe2a05 Co-authored-by: jalehman <[email protected]>
bd80ab2 to
db1de7b
Compare
|
Codex review: needs maintainer review before merge. Reviewed September 22, 2026, 10:48 AM ET / 14:48 UTC (Revision 6). ClawSweeper reviewWhat this changesRetains a subagent’s original operator permissions until its result reaches the yielded requester, with cleanup, retry handling, regression coverage, and documentation. Merge readiness✅ Ready for maintainer review The fix remains necessary on current main. Source review and the supplied Gateway observations support the repair, with no actionable correctness or security finding. Maintainer discussion explicitly confirms that the related merged work does not supersede it. Priority: P1 Review scores
Verification
How this fits togetherOpenClaw’s subagent registry tracks delegated work after the requesting agent yields. When children finish, it passes their results through Gateway admission to resume the requester under the original permission limits. flowchart TD
A[Requester spawns child] --> B[Registry retains completion authority]
A --> C[Requester yields]
B --> D[Child result ready]
C --> D
D --> E{Source and batch still authorized?}
E -->|Yes| F[Gateway resumes requester]
E -->|No| G[Reject result delivery]
F --> H[Committed settlement releases authority]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +237, Tests +298, Docs +14. Total +549 across 14 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep completion authority with the existing registry until settlement, while preserving permission ceilings, revocation, and fresh admission after restart. Do we have a high-confidence way to reproduce the issue? Yes: source shows the missing registry-owned authority hold, and the supplied before-fix Gateway trace demonstrates rejection after the requester yields. This review did not execute a current-main reproduction. Is this the best way to solve the issue? Yes: extending the existing registry and shared continuation owner repairs the lifetime mismatch without adding configuration, a competing delivery path, or persisted authority. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 50ea1795fc80. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (5 earlier review cycles)
|
Keep the continuation owner within the line-cap gate after the current-main refresh. Move only unchanged type declarations and type imports into a coherent sibling contract module; runtime behavior is unchanged. Co-authored-by: jalehman <[email protected]>
Real-Gateway proof at
|
| Cell | Observed result |
|---|---|
| Normal: parent yielded and execution settled before child response released | child completed once; result delivered without restart; exactly one visible PROOF_PARENT_RESULT: PROOF_CHILD_RESULT; 8.166s |
tasks.cancel while child held |
cancelled; cancellation notice delivered; no successful child result; 11.280s |
| Operator role revoked while child held | actor disconnected/child cancelled; cancellation notice delivered; no successful child result; 11.392s |
| Restart during accepted, held synthesis | same retained child result delivered once; child invocation count remained one; 58.145s |
Normal parent af7c85ca-bf24-4816-ab51-2db3fa1d7a23, child 9a002853-4cc8-4e77-ba1b-0c7d1837ae2f, task 4225895a-146d-4037-91ad-8f09ef502f3b. All four cases returned agent.wait: {status: "ok", yielded: true} before release. Normal made one child and one synthesis model request.
The BEFORE proof was also reproduced on implementation base 7ad0839 before production edits: retained success result, delivery blocked by inactive operator authority. Its observation-test exit0 did not mean product delivery worked.
Control limits: the repaired restart case interrupts admitted synthesis rather than waiting for the old rejected wake. It emits interruption/failure text, makes three parent-side model requests, and then emits exactly one successful result; this is not interruption-free UX. Cross-source and stale-member negatives reject the continuation callback in registered-boundary tests, not an additional live mixed-principal E2E cell. No claim that every #143334 starvation/restart symptom is fixed.
The same exact-head command passed core typecheck, focused lint (zero warnings/errors), formatting, conflict/line-cap guards, and 479 tests in 16 files / four Vitest shards (86.56s). Fresh independent AutoReview: scoped-clean at P0–P2. Earlier pre-rebase selected gates also covered all25 core-test typecheck graphs; that is historical evidence, not current-head full CI.
Provider run, lease tbx_01m33dy6qtgx64sx7sc82amh4c. Combined command exit0, 696.884s including source build; lease stopped/read back completed02:20:56UTC. All owned leases are stopped. Portal metadata synchronization timed out; the actual command receipt succeeded.
The bundle contains sanitized RPC/task receipts, actual parent text, the replay, command/environment receipts, full-tree equivalence and limitations. Terminal transport interleaved shell trace with dumped JSON; only exact known script trace bytes were removed, and all decoded IDs/task projections/model counts matched independent test summaries.
Download verification: all12 files returned HTTP200 with matching SHA256; remote manifest matched byte-for-byte. Signed artifact links expire 2026-09-29.
CI fixture follow-up — 01bfacf84d3d2fa12f85639cad9895c09e7abb01
The original CI failure reproduced locally: two native-spawn fixture failures, 14 passing tests. Those fixtures claimed real delegated authority but omitted its live receipt predicate when constructing the Gateway caller; the new registration check correctly rejected the incomplete identity. The worker fixture also supplied a no-op receipt callback.
The follow-up changes only the test fixture (+8/−1): carry the real registry-backed predicate and forward the worker callback. Existing successful-launch, token, capability-revalidation and lineage assertions remain unchanged. No production behavior, authorization guard, or timeout changed; main had the same fixture, so no rebase was needed.
65 tests across five focused/sibling files passed, including the originally failing file and pending-preparation/caller-closure controls. All selected check:changed gates passed, including the owning agents-other typecheck, assertion safety, formatting and lint (zero warnings/errors). Fresh independent AutoReview is scoped-clean at P0–P2.
The four-cell real-Gateway proof below remains explicitly bound to d224400, whose production code is byte-identical in this test-only follow-up; it was not rerun or relabeled as a new-head execution. New exact-head CI passed at 14:38:04 UTC. At 14:39 UTC, both the CI check and aggregate openclaw/ci-gate status were SUCCESS, no checks were failed/pending, and GitHub reported OPEN/non-draft/MERGEABLE/CLEAN. Hosted revision-5 review at this same head found no actionable findings and accepted the unchanged-production proof. No merge or deployment was performed.
Carry the real delegated-run receipt predicate through local and worker caller identities. Keep the existing accepted-launch and lineage assertions; do not weaken production admission or replace receipt authority with an unconditional success. Co-authored-by: jalehman <[email protected]>
Related: #143334
What Problem This Solves
Fixes: a completed subagent’s result is retained but never delivered when its requester yields and the spawning execution releases its operator authority.
User Impact
User impact: yielded requesters receive the completed child result without restarting the Gateway. Cancellation and operator revocation still stop child execution and deliver cancellation notices. No configuration or data migration is required.
This addresses the reproduced inactive-operator-authority mechanism, not every queued-input starvation or restart-time timeout reported in the linked issue.
Why This Change Was Made
The existing registry retains the original restricted completion context while its source is live, independently of the execution that spawned the child. It shares the delayed-session-reply capture mechanism, transfers custody across same-task replacement or a freshly admitted explicit retry, and releases it after committed settlement, retirement, or source/Gateway revocation. Failed persistence does not discard custody.
Successful result batches validate every original source and exact registry member. Cancellation-only notices retain their existing independent cancellation caller; mixed waves cannot borrow another or revoked operator’s source. Retired callbacks fail closed. Role/device/profile, scope-ceiling, execution and Gateway guards remain enforced. Unchanged dispatch types move to a sibling contract module to satisfy the source-size gate after the main refresh.
Evidence
CI fixture follow-up (
01bfacf84d3d2fa12f85639cad9895c09e7abb01): repaired the two native-spawn test identities missing their real live receipt authority, without changing production code or weakening assertions. The original two failures reproduced; 65 focused/sibling tests and all selected changed-file gates passed, with fresh independent AutoReview clean at P0–P2. Exact-head CI passed; bothopenclaw/ci-gatesurfaces are green (September 22, 14:39 UTC readback). The runtime proof below remains ond2244005, with byte-identical production in this fixture-only follow-up.Real-Gateway proof and downloadable manifest for
d2244005a9a5bdf204c5e18e144172d3d1adf088: normal completion delivered exactly once without restart; cancellation and role-revocation controls both cancelled the child and delivered the notice; restart recovered the retained result without rerunning the child. Four strict cases passed. All12 published artifacts were downloaded and SHA256-verified; links expire2026-09-29.Same-head core typecheck, lint (zero warnings/errors), formatting, conflict/line-cap guards, and 479 tests in16 files passed. Registered-boundary negatives cover stale/mixed sources, scope retention, persistence rollback, replacement, settlement and fresh retry. These are not extra live mixed-principal E2E cells.
BEFORE proof, independently reproduced on implementation base
7ad0839before production edits. Registered-boundary and retained-retry regressions failed before the repair and passed afterward. Earlier pre-rebase verification also passed all31 selected gates, including all25 core-test typecheck graphs; that is historical evidence, not current-head full CI.Fresh independent AutoReview: no actionable P0–P2 findings in the final combined patch. Hosted CI/review is separate; no full-CI or merge-readiness claim.
Only the external authentication service and model HTTP/SSE responses are fixtures; actual Gateway admission, registered spawn/yield tools, execution, registry, durable tasks and successor dispatch are exercised. All owned Testboxes were stopped and cleanup read back. Portal metadata sync timed out, but command receipts succeeded. Restart proof intentionally interrupts admitted synthesis: interruption/failure text precedes exactly one successful result, so this is not a claim of interruption-free UX.
Contributor credit: @jalehman (Josh Lehman), who directed this investigation and fix.
Work sessions
View the OpenClaw team session