Skip to content

fix(cron): bound runs before runner startup and retain cancellation - #188982

Merged
roboclaw-bot merged 1 commit into
mainfrom
roboclaw/team-r7-cron-codemode-wedge
Oct 31, 2026
Merged

roboclaw-bot merged 1 commit into
mainfrom
roboclaw/team-r7-cron-codemode-wedge

Conversation

@roboclaw-bot

@roboclaw-bot roboclaw-bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #143624, #123419. Adjacent watchdog work: #184460 and #160804.

What Problem This Solves

Fixes: an automation can remain running indefinitely when its runner never reports startup, and disabling it can fail to cancel after run tracking is retired.

User Impact

Finite automation deadlines now cover admission, setup, execution, and delivery. Disabling an active occurrence still cancels its exact runner after registry retirement, allowing another forced run after settlement. Busy-session waits now consume the configured job budget; unlimited jobs remain unlimited. Existing live-work and receipt fences remain in place.

Why This Change Was Made

The deferred watchdog previously armed only its setup timer, which lane waiting clears; the wall-clock timer started only at noteRunnerStarted. Start that timer at entry instead. Bind marker cancellation directly to its captured handle rather than looking it up in a registry that teardown can clear. This removes the superseded lookup helper and introduces no new state or options.

A reported shared-session automation remained running past its 1700-second deadline after a Code Mode bridge error, with no active agent run or terminal cron record. The journal confirms that sequence, but does not establish where its agent promise stopped. The bridge catch already settles its failed reply; this repair targets the independently reproduced cron timeout and cancellation gaps rather than changing recoverable tool-error semantics.

Evidence

  • Base: 298546d88934bf05bc7e208d13bf6ce2c538e3f2. Real cron timer/runner owners with held external runners: both no-start cases fail on base because no TimeoutError is raised; durable-disable-after-retirement fails because its controller remains un-aborted. Both pass after the fix, with terminal timed_out history, cleared runningAtMs, and successful forced re-admission after settlement.
  • 43 tests pass, each run separately with timeout 150, an explicit OPENCLAW_BUN_PATH, OPENCLAW_VITEST_RUNTIME=bun, node scripts/run-vitest.mjs <file> --maxWorkers=1:
    • timer.timeout-watchdog.test.ts: 10 tests, 11.17 s command wall time.
    • ops.disable-running.test.ts: 1 test, 8.05 s.
    • command-timeout.test.ts: 10 tests, 8.57 s, including real child-process termination and retained output.
    • session-run.test.ts: 14 tests, 8.27 s.
    • active-run-cancellation.test.ts: 8 tests, 1.39 s, retaining shutdown/suspension visibility and sibling isolation.
  • Touched-file core type-aware lint (config/tsconfig/oxlint.core.json), formatting, and git diff --check pass. The initial lint invocation using tsconfig.core.json failed during unrelated plugin declaration preparation: installed @openclaw/fs-safe declarations lack DirectoryMode and reject string dirMode. The supported core-lint configuration avoids that package-boundary preparation. Full typecheck and broad proof are delegated to PR CI under the host IO emergency; no dependencies, operator state, or Gateway were changed.
  • Fresh Codex autoreview of the complete local candidate against the base, with active-marker owner context: P0–P2 scoped-clean, no findings. Local ClawSweeper is unavailable on this host; the existing hosted ClawSweeper request was queued, so no duplicate request was posted.
  • Simplification: production −12 lines, tests −44 lines against the base. Replaced the obsolete unbounded-wait cases with the wall-clock invariant and extended the existing disable regression; no test-line allowance. Exact-head CI run 41161019407 passed at f216d0ccfb772c214a50b3a0dada3b3379e27248 (530 s from run creation to completion). Security/dependency publication gates also passed.

Requested by @steipete

Work sessions

Discussion, implementation and verification

Arm the job wall-clock watchdog before admission and bind marker cancellation directly to its run handle so registry retirement cannot strand an active occurrence.

Co-authored-by: steipete <[email protected]>
@clawsweeper

clawsweeper Bot commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@roboclaw-bot
roboclaw-bot marked this pull request as ready for review October 31, 2026 02:39
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: S labels Oct 31, 2026
@roboclaw-bot
roboclaw-bot enabled auto-merge (squash) October 31, 2026 02:43
@roboclaw-bot
roboclaw-bot merged commit 02e31ab into main Oct 31, 2026
190 checks passed
@roboclaw-bot
roboclaw-bot deleted the roboclaw/team-r7-cron-codemode-wedge branch October 31, 2026 02:49
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

Merged via squash auto-merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant