Skip to content

Cron schedule updates don't recalculate nextRunAtMs #10594

@manclawd-ux

Description

@manclawd-ux

Bug Description

When updating a cron job's schedule expression via cron.update, the nextRunAtMs timestamp is not recalculated. The old stale timestamp remains in jobs.json, causing the scheduler to skip runs until the old timestamp is reached.

Steps to Reproduce

  1. Create a cron job with schedule 0 */1 * * * (every hour)
  2. Let it run at 10:00
  3. Update the schedule to 0 */2 * * * (every 2 hours)
  4. Observe that nextRunAtMs still points to 11:00 instead of 12:00
  5. The job runs at 11:00 (wrong) then jumps to 13:00

Expected Behavior

When the schedule expression is updated, nextRunAtMs should be recalculated based on the new schedule.

Actual Behavior

nextRunAtMs retains the old value. The scheduler only recalculates after a job runs.

Workaround

Restart the gateway (openclaw gateway restart) — this forces full recalculation of all job timestamps.

Environment

  • OpenClaw version: latest (npm)
  • Node: v25.5.0
  • OS: Ubuntu Linux

Impact

Missed cron runs when schedules are updated. In our case, 5 hourly writer runs and 2 publisher runs were skipped over ~6 hours.

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