-
-
Notifications
You must be signed in to change notification settings - Fork 52.7k
Description
Bug Report
Description
When a cron job's schedule expression is updated mid-day via cron action=update, the scheduler miscalculates nextRunAtMs, skipping the next expected run entirely.
Steps to Reproduce
- Have a daily cron job running on schedule (e.g.,
30 3 * * *— 3:30 AM daily) - Job runs successfully at 3:30 AM on Day 1
- Mid-day on Day 1 (~9:20 AM), update the job's schedule to
30 4 * * *(4:30 AM) - Observe
nextRunAtMs— it should be set to Day 2 at 4:30 AM
Expected Behavior
After updating the schedule from 30 3 * * * to 30 4 * * * on Day 1, the next run should be Day 2 at 4:30 AM (the very next occurrence of the new schedule).
Actual Behavior
nextRunAtMs was set to Day 3 at 4:30 AM, completely skipping Day 2. The job did not fire on Day 2.
Timeline:
- Jan 29, 3:30 AM: Job fires successfully (old schedule
30 3 * * *) - Jan 29, ~9:20 AM: Schedule updated to
30 4 * * * - Jan 30, 4:30 AM: Job does NOT fire (skipped)
- Jan 31, 4:30 AM:
nextRunAtMsis set here
Observed State
{
"schedule": { "kind": "cron", "expr": "30 4 * * *" },
"state": {
"lastRunAtMs": 1769675400014,
"nextRunAtMs": 1769851800000,
"lastStatus": "ok"
}
}The gap between lastRunAtMs and nextRunAtMs is ~49 hours instead of the expected ~24 hours for a daily cron.
Impact
Any cron schedule update can silently skip the next occurrence, causing scheduled tasks to miss a day. In our case, this caused a critical daily inventory import to not run.
Environment
- Clawdbot version: 2026.1.24-3
- OS: Windows 10 (x64)
- Node: v24.13.0
Workaround
After updating a cron schedule, manually verify nextRunAtMs is correct. If it skipped a day, force-run the job or delete and recreate it.