Repository navigation
fix: cancel delegated tool waits when a turn stops - #188341
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 SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bb4d43cb6c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| @@ -1,6 +1,6 @@ | |||
| export const SESSION_WATCHDOG_WARNING_MS = 120_000; | |||
| export const SESSION_WATCHDOG_ABORT_FLOOR_MS = 5 * 60_000; | |||
| export const SESSION_WATCHDOG_QUIET_TOOL_MS = 15 * 60_000; | |||
| export const SESSION_WATCHDOG_QUIET_TOOL_MS = 3 * 60_000; | |||
There was a problem hiding this comment.
Publish existing media-tool deadlines before shortening the watchdog
For synchronous media generation, this now stops healthy work after three minutes, even when its provider timeout allows longer. For example, music-generate-tool.ts defaults to a 300,000 ms timeout, and media-generate-background-shared.ts:shouldDetachMediaGenerationTask explicitly keeps cron runs without a durable continuation synchronous. That path awaits generation in media-generate-background.ts, but never registers its provider deadline with the tool watchdog, so it receives this new 180,000 ms cutoff instead. Previously, a generation completing between three and five minutes could finish normally; now its requesting turn is cancelled before the result arrives. Register the existing execution-owner deadlines for these bundled callers as part of this policy change.
AGENTS.md reference: AGENTS.md:L52-L52
Useful? React with 👍 / 👎.
|
Codex review: needs changes before merge. What this changesThis PR forwards delegation cancellation, shortens silent-tool deadlines, and preserves cancellation errors after placement cleanup. Example: A user presses Stop while an openclaw delegation handler remains pending.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 2 items remain Keep this PR open: the cancellation fix is useful, but the shorter watchdog interrupts healthy synchronous media generation, and existing watchdog consumer tests fail. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherAgent tool calls enter the in-process Gateway and system agent; the session controller observes progress, requests cancellation, and retains writer custody until cleanup settles. flowchart LR
A[Requesting agent] --> B[OpenClaw delegation tool]
B --> C[In-process Gateway]
C --> D[System agent]
D --> C
E[Session watchdog] --> F[Lane cancellation and cleanup]
F --> B
Technical reviewBest possible solution: Keep the existing cancellation owners, publish synchronous media execution deadlines before shortening the shared watchdog, and migrate its consumer tests. Do we have a high-confidence way to reproduce the issue? Source confirms delegation omitted the Gateway abort signal and placement validation could mask cancellation; supplied regressions report red-before and green-after results, but no execution was performed during this review. Is this the best way to solve the issue? The cancellation and error-ordering changes reuse the right owners, but the shared timeout change needs existing media deadlines registered and affected consumer coverage migrated. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 5ed4aa230f89. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceAcceptance criteria:
What I checked:
PR surfaceSource +5, Tests 0, Docs +3. Total +8 across 8 files. Added test files: 0. View PR surface stats
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 October 30, 2026, 9:11 AM ET / 13:11 UTC. |
Forward turn cancellation to delegated Gateway waits, honor active tool deadlines without the quiet-tool extension, and preserve the original abort reason after placement cleanup. Silent tools without an owned deadline now stop after three minutes; registered waits and raw writer custody remain owned by the existing controller.
Restore the existing watchdog policy and documentation from main. Keep turn-abort propagation into delegated Gateway waits and preservation of the original cancellation reason after placement cleanup. Recovery preparation latency remains a separate follow-up.
bb4d43c to
6fb8cef
Compare
…w#188341) The openclaw delegate tool now forwards the turn's abort signal into its in-process Gateway wait, so stopping a turn (user stop or watchdog) ends a blocked delegated call instead of leaving it waiting. The embedded lane controller preserves the original abort reason when cleanup has already closed the placement claim, instead of reporting "session placement turn settlement is closed". Watchdog policy is unchanged. The ~224 s recovery preparation (about 140 s prompt and 83 s history preparation) is a separate follow-up.
…w#188341) The openclaw delegate tool now forwards the turn's abort signal into its in-process Gateway wait, so stopping a turn (user stop or watchdog) ends a blocked delegated call instead of leaving it waiting. The embedded lane controller preserves the original abort reason when cleanup has already closed the placement claim, instead of reporting "session placement turn settlement is closed". Watchdog policy is unchanged. The ~224 s recovery preparation (about 140 s prompt and 83 s history preparation) is a separate follow-up. (cherry picked from commit cd963a2) Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit 64eee00d56cd8ba199c35668c72e36f4b81d989c)
Source commits: cd963a2 (openclaw#188341), 90d82c2 (openclaw#188203), 65602ab (openclaw#188148). Release adaptation: formatting and import ordering only after bounded conflict resolution; no behavior changes or additional source hunks. Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit 217f1dc819fe353d5a4ee38f0c14ef84c97d6aab)
What Problem This Solves
A stopped turn could remain blocked waiting for the
openclawdelegation tool because its in-process Gateway call did not receive the turn's abort signal. Placement cleanup could then replace the original cancellation error with a closed-settlement error.User Impact
Stopping or canceling a turn now releases its delegated Gateway wait, and the original cancellation reason survives placement cleanup. Underlying execution cleanup retains its existing owner and writer custody.
Why This Change Was Made
This PR is narrowed to cancellation propagation and preservation of the original abort reason. It forwards the existing tool signal to
callInProcessGatewayTooland checks an already-established lane abort before checking a placement claim that cleanup may have closed. Live execution still checks placement authority.The watchdog is unchanged from main: its fifteen-minute quiet-tool allowance,
Math.maxdeadline aggregation, and quiet allowance after explicit tool deadlines remain intact. The watchdog tests, documentation, and five previously failing consumer suites are unchanged.The 224-second recovery preparation is a separate follow-up. The available timing evidence shows approximately 140 seconds in prompt preparation and 83 seconds in history preparation, with nearly identical timings in an unrelated session. It does not establish that preparation waited on the preceding turn's cleanup; this PR makes no preparation-latency claim.
Evidence
fdba74e2a71eaeb0fa24eca1b626f704abeb937c. Only the delegate tool, lane controller, and their two regression-test files differ from that base.No live Gateway or real-model end-to-end run was used. No configuration, schema, dependency, or timeout-policy changes are included.