Repository navigation
fix: require current subagent control to cancel descendant tasks - #149082
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 real behavior proof before merge. Reviewed September 17, 2026, 1:08 AM ET / 05:08 UTC (Revision 16). ClawSweeper reviewWhat this changesThe PR requires current control when cancelling descendant tasks, separates ACP executions that reuse request IDs, and preserves cleanup ownership after an accepted stop. Merge readiness⛔ Blocked before merge - 4 items remain This remains a useful, unmerged cancellation repair that current main does not provide. No discrete introduced bug was established; backend authority proof and retained-state recovery evidence remain incomplete. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s task registry connects background work to its controlling session and execution. Cancellation passes through the subagents tool to Gateway or ACP runtime owners, which stop the selected work and record its outcome. flowchart TD
A[Session cancellation request] --> B[Current controller check]
B --> C[Selected task and execution]
C --> D[Gateway or ACP runtime]
D --> E{Stop accepted}
E -->|Yes| F[Retain exact cleanup ownership]
E -->|No| G[Report refusal]
F --> H[Record terminal outcome]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +501, Tests +2199, Docs +11. Total +2711 across 51 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep cancellation with the existing task and runtime owners, requiring current authority for new stops while preserving exact-execution cleanup and a proven recovery path for retained ACP records. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main uses retained task links to authorize cancellation without rechecking current controller ancestry. No runtime reproduction was executed during this read-only review. Is this the best way to solve the issue? Yes at the owner level: the patch reuses controller checks, binds execution identity, and separates stop acceptance from cleanup; merge readiness still depends on backend and retained-state evidence. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 9c32bda3c01e. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (15 earlier review cycles; latest 8 shown)
|
Preserve the reviewed current-controller cancellation scope and include the synthetic model catalog fixture correction for production-boundary validation.
Merge d4580e1 to include the managed handoff fixture lint repair and consolidation from #149423 and #149427. Preserve all four reviewed task edit payloads, including the synthetic model-catalog fixture, and the unchanged authority and producer owners. Validation: all 32 focused cases, formatting, and targeted lint passed, including the previously failing managed handoff fixture.
Merge 83f9484 while preserving the reviewed current-controller cancellation code, tests, and documentation. The identical model-catalog fixture is already present on main. Validation: all 32 focused scope and production-boundary cases passed, along with the selected local changed-file gates. The cancellation, run-generation, and process-stop owners remain unchanged.
|
Merged via squash.
|
…nclaw#149082) * fix: require current subagent control to cancel descendant tasks * test: use task facades in cancellation fixtures * test: align cancellation fixtures with execution ownership * test: give ACP cancellation fixtures execution backing * test: share terminal subagent cancellation fixtures * test: await native hook relay publication readiness * test: use owned relay handles for readiness checks
What Problem This Solves
A former controller could cancel descendant work through retained task links, and stale ACP task IDs could stop newer executions that reused a run ID. A native stop accepted by the Gateway could also be reported as declined if caller authority changed while the run unwound.
User Impact
New cancellation effects require current control and stay bound to the selected execution. Accepted native stops retain their cleanup claim through delayed settlement. Historical listing and completion-recipient waiting remain available.
A canonical ACP task's recorded owner retains control over its exact execution after a navigation-parent change. Core cancellation refuses older ACP task records without execution-instance metadata and directs the caller to the current task or ACP session controls.
Why This Change Was Made
The cancellation path follows current controller ancestry and carries the selected task, backing instance, and authority checks through asynchronous runtime handoffs. Gateway controllers record actual stop acceptance so later caller revocation cannot turn an accepted stop into a false refusal; untouched targets still require current authority. The drain path preserves the original cleanup claim until terminal observation settles it.
Distinct ACP executions receive distinct task and flow records. Lifecycle callbacks use an optional task ID to narrow existing run/runtime/session selection to the canonical task and matching managed projections; omission preserves run-scoped behavior. Run-ID lookup selects the current execution while exact task-ID reads preserve history. No terminal task is reopened, and no schema, retention, configuration, or dependency change is required.
Evidence
The branch includes main through 90b421a, including the existing worktree-fixture repair. The original 50 cancellation paths and every added/removed line are preserved; shared-file changes were checked for compatible ownership and error handling.
CI on f3f7af6 passed UI performance and all selected jobs except one initial native-hook relay publication assertion. Two adjacent renewal tests now await the existing relay readiness promise before checking the same stored locator, keeping the held-renewal, unregister, expiry, and cleanup assertions unchanged. The complete 21-case lifecycle file, targeted lint, and independent P0–P2 review pass. CI then caught that the public handle type does not expose readiness; both fixtures now use the existing owned registration entry point, which forwards the same runtime parameters. Both matching CI compiler stripes, all 21 lifecycle cases, core lint, formatting, and independent P0–P2 review passed on that correction. This is a test synchronization repair; production cancellation behavior is unchanged. Full CI35182437542 passed on final head1fda8e18f41b90dbf1cbabdd075039c4e87751d9.
The production implementation passed its complete changed-file gate and full build. CI exposed outdated test fixtures: direct registry imports, missing ACP execution-instance metadata, and pauses around the old combined drain wrapper. The fixtures now use the existing facades, explicit instance identity, and an observer that pauses after the real drain without extending its deadline. The first fixture refresh passed all 73 selected tests and its complete changed-file gate. The final two-file correction reproduces all seven original failures and passes all 19 focused cases, including exact execution-instance assertions. A final cleanup moves seven repeated terminal-result envelopes into the existing typed test support, preserves every scenario and assertion, and passes the current count-based size guard. Its 21 focused cases, independent P0–P2 review, and complete changed-file check passed on Blacksmith Testbox (exit 0). The preceding fixture check also passed. Both one-shot leases stopped successfully; their Actions jobs may display cancellation during provider-owned cleanup.
The complete-candidate review's actionable legacy ACP finding was reproduced and fixed, and independent review of that repair and extraction delta found no P0–P2 issues. Other reported ownership cases were checked against the existing recorded-owner contract and eight real-manager compatibility cases.
The final ACP/task suite passed 46 cases. Both legacy same-run-ID regressions—new work already running and new work accepted but still queued—fail on the preceding candidate and pass with the repair using identical fixtures. Gateway fixture extraction preserved all 349 registrations and all 13 moved case bodies, with 16 selected cases passing before and after. Earlier integrated proofs covered production-boundary spawning, follow-up/resume/adoption, exact cancellation, delayed terminal settlement, held admission, and worker placement.
Earlier real-process probes established the original ownership defects and verified the then-current fixes. Revoked requests left descendant heartbeats running; allowed requests issued SIGTERM and settled cancellation. Those probes precede the final lifecycle changes and remain historical component evidence. The original native witness proved false refusal after an accepted stop, not lost final settlement; a separate held-admission regression proves cleanup-claim preservation through drain timeout.
Final manager/Gateway proofs use isolated state and synthetic adapters. They do not establish final-candidate provider inference, ACP bridge transport, or real channel authentication. The build's hard checks passed with an existing advisory startup-CSS warning.