Skip to content

Cron scheduler advances nextRunAtMs but doesn't execute jobs #10655

@jasper9

Description

@jasper9

Bug Description

The cron scheduler detects due jobs and advances their nextRunAtMs timestamp, but fails to actually execute/spawn the job sessions.

Environment

  • OpenClaw version: 2026.2.3-1
  • OS: macOS (Darwin 24.5.0 arm64)
  • Node: v25.5.0

Steps to Reproduce

  1. Create a cron job with schedule.kind: 'every' and short interval (e.g., 60000ms)
  2. Wait for the job to become due
  3. Observe that nextRunAtMs advances by the interval
  4. But lastRunAtMs never updates - job never executes

Evidence

Test Job (1 min interval):
- Created at: 1770404809447
- First nextRunAtMs: 1770408960009
- After due time passed: 1770409020006 (+60 sec)
- lastRunAtMs: undefined (never ran!)

Position Monitor (2 min interval):
- nextRunAtMs before: 1770408960000
- nextRunAtMs after: 1770409080000 (+120 sec)
- lastRunAtMs: unchanged from hours ago

Expected Behavior

When a job's nextRunAtMs is reached, the scheduler should:

  1. Execute the job (spawn session)
  2. Update lastRunAtMs with execution time
  3. Then advance nextRunAtMs

Actual Behavior

Scheduler skips step 1 and 2, only advances nextRunAtMs.

Workaround

Manual sessions_spawn works fine. Only the automatic cron scheduler loop is affected.

Additional Context

  • cron status shows enabled: true with correct job count
  • cron run <jobId> returns {ran: false, reason: 'not-due'} even when overdue
  • cron wake doesn't fix it
  • Gateway restart doesn't fix it
  • Jobs with explicit model in payload are affected
  • Both new jobs (Test Job) and existing jobs show same behavior

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