Repository navigation
fix(cron): automation runs fail after sessions_yield on a spawned subagent - #197667
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: needs maintainer review before merge. What this changesTreat scheduler-owned yields as ordinary turn settlement while preserving existing child delivery. Example: An automation spawns a child returning PINEAPPLE-42 and calls sessions_yield.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Regression provenanceRegression provenance — verified: source commit Merge readiness✅ Ready for maintainer review This PR fixes a current automation settlement regression and resolves the earlier child-delivery blocker; one non-blocking test-fixture concern remains. Priority: P1 Before mergeNone. Findings
Agent review detailsHow this fits togetherThe requester settlement owner receives agent results and accepted child receipts, then releases child completion obligations through the subagent registry. flowchart TD
A[Scheduled automation] --> B[Spawn child]
B --> C[Sessions yield]
C --> D[Requester settlement]
D --> E[Subagent registry]
E --> F[Existing completion delivery]
Technical reviewBest possible solution: Keep the shared scheduler classification in the existing settlement owner, with an optionally fully typed regression fixture. Do we have a high-confidence way to reproduce the issue? Current-main source establishes the mismatch between scheduler-owned yield and registry continuation requirements; the contributor also records matching base failures through cron.run. Is this the best way to solve the issue? The production change repairs the shared settlement decision directly and preserves ordinary interactive yields and existing delivery owners. Full review comments:
Overall correctness: patch is correct AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against bbed5e958a8d. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +17, Tests +60. Total +77 across 3 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. Review metrics
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 HistoryReview history (2 earlier review cycles)Reviewed November 12, 2026, 10:51 AM ET / 15:51 UTC (Revision 3). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
bba66bd to
a0433a7
Compare
|
Addressed the review of
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…wned helper (openclaw#197667) (cherry picked from commit b461970) Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit f71e56c4e01d2f17905fd51bb581222c7b89820f)
What Problem This Solves
Fixes: an automation run fails with
accepted continuation children could not transfer terminal deliverywhen it spawns a subagent and then callssessions_yield.User Impact
Automations that delegate to a subagent and then yield now finish successfully, in both isolated and in-session placements. Today these runs are recorded as failed even though the subagent completes, and the failure counts toward the job's error backoff and failure alerts. Ordinary chat yields are unchanged.
Why This Change Was Made
This is a regression from #185445. That change made an automation's
sessions_yieldend the turn with a scheduler-ownedyieldedresult instead of an error. The path intentionally doesn't mark the turn's children as yielded, because the scheduler (not an interactive requester continuation) owns child output. But the run still reportedmeta.yielded, sosettleRequesterRunasked the registry to transfer the children to a yielded continuation. The registry refuses that for unmarked children (the defaultexpectsCompletionMessage: truespawn), and the run threw.The scheduler-owned check (a cron run session key, or a scheduled placement on the run) is now one shared predicate, used by both the yield tool and settlement. Settlement treats a scheduler-owned yield as an ordinary turn end, the same path a non-yielding automation that spawned the same children already takes. Child completion delivery is unchanged: isolated runs collect the child's answer through the handoff from #197695, and in-session runs deliver it into their session as before.
#185445's tests missed this because its scheduler delivery fixture used a child with
completion.required: false, which never reaches the refusing check.Evidence
Live runs on isolated Gateways on an AWS Crabbox lease, with a real model (
clawrouter/anthropic/claude-opus-5-5) and synthetic data. Each automation spawns one subagent that repliesPINEAPPLE-42, then (except the control) yields; triggered withcron.runmode: "force". PR heada0433a71vs basemain5cef30a3, run sequentially:main, spawn then yielderror:accepted continuation children could not transfer terminal deliveryokin 8.8 s, summaryPINEAPPLE-42okin 6.6 s, summarySPAWNEDsession:agent:main:main)main, spawn then yielderror:Session event execution failed(Embedded agent failed before reply: accepted continuation children could not transfer terminal delivery)okin 7.9 sdeliveredintoagent:main:mainopenclaw-tools.requester-yield.test.tsyields through the real tool, then runs real settlement against the real registry, for a cron-run session and an in-session automation (scheduled placement bound to the run). The child is released to ordinary delivery. Both cases fail onmainwith the exact error.cron/session-run, and cron automation-yield delivery.pnpm tsgo:core,pnpm tsgo:test:src, oxlint, oxfmt and the test-lines ratchet pass.