Repository navigation
fix(sessions): preserve paused task ownership when a parent resumes work - #149283
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. Reviewed September 15, 2026, 10:12 PM ET / September 16, 2026, 02:12 UTC (Revision 6). ClawSweeper reviewWhat this changesAdds an explicit sessions_send resume mode that continues a paused child while preserving its original task identity, completion recipient, and registry-owned delivery. Merge readiness✅ Ready for maintainer review This PR remains useful: current main lacks explicit parent-owned task resume. The refreshed authority evidence supports the proposed boundary, and no blocking introduced defect was found. Priority: P1 Review scores
Verification
How this fits togetherSession tools let agents coordinate work through the Gateway. This change connects a parent's continuation request to the existing child-task registry before execution, so completion settles the original delegated task. flowchart TD
A[Parent continuation request] --> B[Session visibility checks]
B --> C[Current controller and paused task checks]
C --> D[Gateway input preparation]
D --> E[Atomic task ownership transfer]
E --> F[Successor execution]
F --> G[Original task completion recipient]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +473, Tests +1133, Docs +9. Total +1615 across 24 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Keep explicit parent-authorized resume on the existing registry replacement path, with ordinary messages retaining their separate semantics and historical task recovery tracked separately. Do we have a high-confidence way to reproduce the issue? Yes, from source: a parent sends to a yielded child through sessions_send, whose ordinary provenance selects no task tracking and cannot adopt the paused task. No failing current-main execution was run in this read-only review. Is this the best way to solve the issue? Yes. An explicit mode expresses continuation intent while reusing the existing atomic replacement owner; automatically adopting ordinary messages would violate their established semantics. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 6bde86083706. LabelsLabel 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)
|
|
@clawsweeper re-review Please review The import cycle, description assertion, and generated prompt fixtures are repaired. Exact-candidate validation passed 214 focused tests, the complete architecture gate, all seven prompt snapshots, typed lint, core types, and all 19 affected test-type graphs. The body retains the instrumentation and restart-proof limits. The separately reproduced native PR-tooling failures have an upstream fix in #149294; new hosted CI is pending. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
1cc1b89 to
b83128b
Compare
|
@clawsweeper re-review Please review The updated PR body records 249 exact-candidate focused tests, typed lint, core and all 19 affected test-type graphs, complete architecture checks, seven current prompt snapshots, and scoped-clean P0-P2 autoreview. All prior authority proof and instrumentation/restart limits remain explicit. Fresh hosted CI is pending. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
b83128b to
1c79749
Compare
|
@clawsweeper re-review Please review The updated body records 263 focused tests under CI's Node 24.19.0, including current-main complete-answer regressions; supported typed lint covering the formerly failing fixture; core and 19 affected test-type graphs; the full architecture gate; seven current prompt snapshots; and scoped-clean P0-P2 autoreview. Authority/completion proof and its instrumentation/restart limits remain explicit. Fresh exact-head CI is pending. |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
🦞👀 Re-review progress:
|
1c79749 to
c899b56
Compare
|
@clawsweeper re-review Please review Exact-candidate validation: 263 focused tests, all three stripes from the failed core-lint job (3/5, 4/5, 5/5; 12,139 files), supported typed lint, core plus 19 affected test-type graphs, complete architecture checks, seven current prompt snapshots, and scoped-clean P0-P2 autoreview. The body preserves the production-boundary authority evidence and instrumented-provider/restart limits, and explicitly notes local Node24.19.0 versus the failed CI lane's24.20.0. Fresh hosted CI is pending. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review Current-head authority proof after the owner-authored main mergeTested Reran on this exact head with Node 24.19.0: node scripts/run-vitest.mjs run --config test/vitest/vitest.gateway-server.config.ts src/gateway/server.sessions-send-resume.test.ts
# 1 file passed; 5 tests passed; exit 0The passing cases cover unrelated controller rejection, completion-disabled rejection, parent revocation during preparation, successor cancellation after adoption before input consumption, and one authorized task-owned completion. These execute real Gateway admission, registry replacement, and SQLite custody. Provider commands and announcement transport remain instrumented; no real-model delivery or full restart round trip is claimed. The body's broader 263-test/types/architecture/lint-stripe results belong to predecessor |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
52f1243 to
88d6291
Compare
|
@clawsweeper re-review Exact-head authority proof after the upstream fixture repairCandidate 374 selected tests passed on this candidate, including all five production-path Gateway authority/completion cases, ordinary messaging, task settlement, 92 wrapper tests, the checkpoint-warning case, and voice-call routing. Final focused receipts use the installed Node 24.19.0 binary directly. The full repository changed-file gate and independent P0–P2 autoreview passed. Details and reproduction commands are in the updated PR body. The five Gateway cases prove foreign-controller rejection, completion-disabled rejection, parent revocation during preparation, successor cancellation after adoption before input consumption, and authorized completion of the original task with exactly one task-owned announcement. Gateway admission, registry replacement, and SQLite input custody are real; provider commands and announcement transport are instrumented. No live-model/requester delivery or full restart round trip is claimed. An initial local wrapper attempt captured mise installation diagnostics in otherwise-empty stderr. The complete 92-case rerun passed with a direct installed Node path, without source changes or weakened assertions. The previous hosted failures remain historical; fresh exact-head hosted CI is still required. |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
🦞👀 Re-review progress:
|
…ork (openclaw#149283) * feat(sessions): resume parent-owned paused tasks (openclaw#148295) * fix(sessions): verify resume authority and align tool contracts * test(sessions): align resume fixtures with yielded task lifecycle * fix(sessions): require task-owned completion before resume
Related: #148295
What Problem This Solves
A parent agent can tell a paused worker to continue, receive a new execution, and still be left waiting on the original delegated task after that execution finishes.
User Impact
Parents can explicitly continue their paused native tasks with
sessions_send(mode: "resume")and receive completion through the original task owner. Status questions and ordinary messages keep their existing behavior.Resume requires an existing task-owned completion obligation. Runs with completion explicitly disabled are rejected, including when eligibility changes before adoption. The tool does not promise a result that has no delivery owner.
This is an opt-in tool mode. It does not change configuration, database schemas, permissions, or the plugin SDK. It does not repair previously stranded production tasks.
Why This Change Was Made
Ordinary inter-session messages do not adopt paused tasks. The new mode validates the admitted caller's controller lineage and the exact paused task and session incarnation, then uses the registry's replacement operation before accepting execution.
The successor retains the stable task identity, original requester, and pending completion batch. Admission returns the execution and task IDs; the registry delivers the eventual result. No competing message-reply watcher is started. Foreign callers, stale targets, and tasks that are no longer eligible are rejected.
The CI repair moves the resume binding's data type into its leaf module to remove a static import cycle, and updates the exact description assertion and generated tool-contract fixtures. The rebase preserves main's requester-yield settlement changes and automation timeout contract. Caller, generation, and successor checks remain intact.
Evidence
Candidate:
88d6291881c8b5847353b5964daaa8ece683ffb1.Tested base:
174bbf31b588d3483d6773ce420afcf13e9e8936.Authority and completion proof through final effects
The five cases in
src/gateway/server.sessions-send-resume.test.tspassed on this exact candidate. They invokesessions_sendthrough a real isolated Gateway, admission, registry replacement, and SQLite input custody:Cancellation deliberately leaves the Gateway abort signal untouched, isolating the successor-ownership check. That cleanup interrupts unconsumed input while its receipt remains pending. Helper tests also cover completion eligibility changing after binding.
These are production-path boundary tests, not a live-model delivery demonstration. Paused state is seeded; provider execution and announcement transport are instrumented. No full requester-delivery or restart round trip is claimed. Earlier completion-eligibility RED/GREEN receipts remain historical evidence; they were not relabeled as a fresh before-change run.
Current-candidate validation
374 selected tests passed, using the installed Node 24.19.0 executable directly for the final receipts:
The repository's full
check-changedselection passed against the pinned base. This includes core and core-test typechecking, formatting, prompt snapshots, all three dead-export scans, dependency and plugin boundary guards, runtime import-cycle checks, core lint, scripts lint, and the selected storage/auth checks. Core lint checked 23,865 files and scripts lint checked 1,020 files, both with zero warnings/errors. No lint limits or assertions were weakened.The changed-file gate was invoked through
mise exec [email protected]; its inherited PATH can resolve a mise shim, so uniform Node patch-version parity across that gate's subprocesses is not asserted. The final focused test receipts use an absolute Node 24.19.0 path. An initial wrapper attempt failed four empty-stderr checks because mise installed a runtime inside isolated fixture homes. Removing shim interception from the test process PATH, without changing source, produced the complete 92/92 wrapper pass. The failed attempt is retained rather than counted as a pass.Full independent P0–P2 autoreview returned scoped-clean, with no accepted/actionable findings. All four PR commits remain patch-equivalent through the rebase. The owner-authored prior merge is preserved in a local recovery branch. Dependency manifest, lockfile, and workspace-policy hashes are unchanged from the prior candidate; no dependency installation or versioned dependency edit was needed for this refresh.
Upstream CI repair and remaining hosted gate
Prior head
52f1243d73ce0b2fbec99a91e2710b0b1501216bcompleted hosted CI with three failing jobs: a checkpoint-warning observation, voice-call realtime routing, and nine PR alias-wrapper fixture cases. The aggregate gate reported those failures; it was not a fourth independent defect. Those historical failures are not cleared by local non-reproduction alone.The wrapper failures came from inherited dependency-materialization fixture setup. The first two upstream repairs, #149481 and #149488, composed into duplicate setup and an
EEXISTfailure. Reopened #149477 landed as476fa7a270e4aeef5d485efaa7b92ae62341cd3c, removing the duplicate call. This tested base contains that commit and exactly one initialization. The complete 92-case wrapper suite now passes on this PR candidate; this PR adds no separate fixture workaround.The prior checkpoint-warning case passed in main runs
35008423225and35022476007, and now passes locally on this candidate. The voice-call case also passes locally. These focused results do not establish a particular flake mechanism or reproduce the prior hosted runtime and full shard selection.The base retains the earlier #149349 Codex fixture correction, #149423 line-cap repair, complete-answer delivery work, and task-settlement contracts. It also forwards the inherited spawn-model auto-selection field through the in-process creation path. No unrelated production-state repair is included.
Fresh exact-head hosted CI and ClawSweeper review remain required. No full local product build, live Gateway change, or PR merge is claimed.
Reproduction
Use the installed Node 24.19.0 binary first in PATH, without a mise shim ahead of it. Final focused suites were invoked with
node scripts/run-vitest.mjs run --config <owning-config> <test-paths>; Gateway handler selection was:node scripts/run-vitest.mjs run \ --config test/vitest/vitest.gateway-methods-isolated.config.ts \ src/gateway/server-methods/agent.test.ts \ -t 'handles .*followups|disposes resume runtime|registers normally when a follow-up|keeps one task when a completed child wakes its requester' node scripts/run-vitest.mjs run \ --config test/vitest/vitest.gateway-server.config.ts \ src/gateway/server.sessions-send-resume.test.ts \ src/gateway/server.private-completion.test.ts node scripts/run-vitest.mjs run \ --config test/vitest/vitest.tooling.config.ts test/scripts/pr-wrappers.test.ts node scripts/check-changed.mjs --base 174bbf31b588d3483d6773ce420afcf13e9e8936