fix(cron): cancel active cron task runs#90671
Conversation
|
Codex review: needs maintainer review before merge. Reviewed June 5, 2026, 9:08 AM ET / 13:08 UTC. Summary PR surface: Source +118, Tests +297. Total +415 across 9 files. Reproducibility: yes. by source inspection: current main routes cron task cancellation through the generic non-CLI branch and falls through to the unsupported-runtime response. I did not run a live current-main cron job in this read-only review. Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land one focused Gateway-owned cron cancellation implementation that aborts active isolated cron runs, leaves main-session cron rows non-cancellable with clear operator guidance, preserves timeout cleanup, and then close the sibling attempts after merge. Do we have a high-confidence way to reproduce the issue? Yes by source inspection: current main routes cron task cancellation through the generic non-CLI branch and falls through to the unsupported-runtime response. I did not run a live current-main cron job in this read-only review. Is this the best way to solve the issue? Yes, this appears to be the best narrow fix: the Gateway owns the live cron AGENTS.md: found and applied where relevant. Codex review notes: model gpt-5.5, reasoning high; reviewed against 520992a1defd. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +118, Tests +297. Total +415 across 9 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
Closing this PR as superseded by current While trying to rebase it, the conflicts were all in the cron cancellation implementation surfaces. Current
The current Issue #90630 is still open; maintainers can close it separately if the current |
Summary
Fixes #90630.
openclaw tasks cancelfor cron task records through the live Gatewaytasks.cancelmethod, because the active cron abort signal is process-ownedThis is an alternative focused fix to #90666 and #90669. #90669 only routes cron through the ACP branch. #90666 is closer, but it couples cancellation state to the duplicate-run active job marker and returns early from the timeout trigger after operator abort, which can remove the watchdog cleanup path for runners that ignore abort.
Verification
node scripts/run-vitest.mjs src/tasks/task-executor.test.ts src/gateway/server-methods/tasks.test.ts src/cron/service/timer.test.ts src/commands/tasks.test.tsnode scripts/run-vitest.mjs src/cli/program/register.status-health-sessions.test.ts src/commands/tasks.test.tspnpm exec oxfmt --check --threads=1 src/tasks/cron-task-cancel.ts src/tasks/task-registry.ts src/cron/service/timer.ts src/cron/service/ops.ts src/commands/tasks.ts src/tasks/task-executor.test.ts src/gateway/server-methods/tasks.test.ts src/cron/service/timer.test.ts src/commands/tasks.test.tsgit diff --check.agents/skills/autoreview/scripts/autoreview --mode localReal behavior proof
Behavior addressed: a running isolated cron task listed by the task ledger can now be cancelled through the Gateway-owned cron runtime instead of falling through to
Task runtime does not support cancellation yet.Real environment tested: local OpenClaw source checkout on this branch, exercising the real task ledger, active cron cancellation handle, and cancellation executor in a non-test Node process with an isolated
OPENCLAW_STATE_DIR.Exact steps or command run after this patch:
OPENCLAW_STATE_DIR=$(mktemp -d /tmp/openclaw-cron-proof-XXXXXX) node --import tsx -e '<script creating a running cron task row, registering its active cron abort handle, then calling cancelDetachedTaskRunById>'.Evidence after fix:
Observed result after fix: the running cron task row was cancelled, the underlying AbortSignal was aborted with
Cancelled by operator., and the task ledger status becamecancelledwith the same terminal error. Focused regression shards also passed and cover Gateway cancellation of an active cron handle, childless active cron task cancellation, explicit non-cancellable main-session cron behavior, CLI Gateway routing, and watchdog timeout cleanup after operator abort.What was not tested: a live installed
openclaw gatewaysmoke on this laptop was blocked by an already-running local Gateway/dist startup timeout, and Testbox-through-Crabbox was blocked by the localcrabboxbinary failing basic sanity checks before lease creation.