Skip to content

fix(cron): record interrupted startup runs#71547

Merged
vincentkoc merged 2 commits into
mainfrom
resolve-cron-leftovers
Apr 25, 2026
Merged

fix(cron): record interrupted startup runs#71547
vincentkoc merged 2 commits into
mainfrom
resolve-cron-leftovers

Conversation

@vincentkoc

Copy link
Copy Markdown
Member

Summary

  • record cron jobs found with persisted runningAtMs on gateway startup as interrupted failed runs instead of replaying or silently clearing them
  • disable interrupted one-shot jobs and emit a finished/error cron event so run history/failure delivery paths can see the interruption
  • recover flat cron schedule shorthand (cron, tz, staggerMs, aliases) in the cron tool before gateway validation

Fixes #59056
Fixes #61343
Fixes #63657
Fixes #59301
Supersedes #57640

Validation

  • pnpm test:serial src/cron/service.restart-catchup.test.ts src/agents/tools/cron-tool.flat-params.test.ts src/agents/tools/cron-tool.test.ts passed before the clean rebase
  • OPENCLAW_LOCAL_CHECK_MODE=throttled pnpm check:changed attempted twice; both attempts timed out waiting for unrelated local heavy-check locks before tsgo:core could start

@vincentkoc vincentkoc marked this pull request as ready for review April 25, 2026 11:14
@openclaw-barnacle openclaw-barnacle Bot added the agents Agent runtime and tooling label Apr 25, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@openclaw-barnacle openclaw-barnacle Bot added size: M maintainer Maintainer-authored PR labels Apr 25, 2026
@greptile-apps

greptile-apps Bot commented Apr 25, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR changes gateway restart behavior so that cron jobs found mid-run at startup are recorded as failed (error) at their original runningAtMs rather than silently cleared or replayed. Interrupted recurring jobs are now skipped by runMissedJobs (same as one-shot jobs were before), a finished/error event is emitted so failure delivery paths fire, and one-shot jobs are additionally disabled. A separate fix extends recoverCronObjectFromFlatParams to include flat schedule shorthand keys (cron, tz, staggerMs, aliases) so they survive the flat-params recovery path before gateway normalization.

Confidence Score: 4/5

Safe to merge; logic is well-tested and no critical defects found.

No P0 or P1 issues found. The interrupted-run marking, skip-in-runMissedJobs, emit-inside-lock, and flat-schedule-key recovery all follow established patterns in the codebase and are covered by the updated test suite.

No files require special attention.

Reviews (1): Last reviewed commit: "fix(cron): record interrupted startup ru..." | Re-trigger Greptile

@vincentkoc vincentkoc merged commit 9242713 into main Apr 25, 2026
66 checks passed
@vincentkoc vincentkoc deleted the resolve-cron-leftovers branch April 25, 2026 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling maintainer Maintainer-authored PR size: M

Projects

None yet

1 participant