Skip to content

Cron scheduler should catch up missed runs after gateway restart #10596

@kurthamm

Description

@kurthamm

Problem

When the gateway is down during a scheduled cron run, the job is silently skipped. On restart, the scheduler just sets nextRunAtMs to the next occurrence without executing the missed run or logging that it was skipped.

Observed behavior

  • Gateway down at 8:00 AM when Morning Briefing cron was scheduled
  • Gateway restarts at 1:00 PM
  • Scheduler sees 8:00 AM has passed, sets next run to tomorrow 8:00 AM
  • No indication the run was missed — lastStatus still shows "ok" from prior day
  • User sees empty Discord channels and thinks crons are broken

Expected behavior

Option A: Catch-up mode — If a cron scheduled time was missed by < X hours (configurable), run it immediately on startup

Option B: Missed run logging — At minimum, log that scheduled runs were skipped during downtime and set lastStatus: "skipped" with reason

Option C: Both — Catch up for time-sensitive jobs, log for all

Suggested implementation

schedule:
  kind: cron
  expr: "0 8 * * *"
  catchUp: true              # Run if missed within window
  catchUpWindowMs: 3600000   # 1 hour grace period

Impact

Users relying on daily briefings, monitors, or time-sensitive scans get no output and no indication why. Debugging requires comparing lastRunAtMs timestamps manually to realize runs were skipped.

Environment

  • OpenClaw 2026.2.3-1
  • 22 cron jobs configured
  • Gateway runs as systemd user service

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions