-
-
Notifications
You must be signed in to change notification settings - Fork 53k
Closed
Description
Bug Description
When the gateway restarts, the cron scheduler incorrectly recalculates nextRunAtMs for jobs that already ran earlier that day. Instead of scheduling the next run for tomorrow, it skips a day.
Steps to Reproduce
- Have a cron job scheduled for daily at 07:00 (e.g.,
0 7 * * *) - Let the job run successfully at 07:00 on Day 1
- Restart the gateway later on Day 1 (e.g., at 21:22)
- Observe that
nextRunAtMsis now set to Day 3 instead of Day 2
Evidence
| Event | Timestamp | nextRunAtMs |
|---|---|---|
| Job runs successfully | Feb 6, 07:00 | Set to Feb 7, 07:00 ✅ |
| Gateway restarts | Feb 6, 21:22 | — |
| After restart | — | Changed to Feb 8, 07:00 ❌ |
The run history shows:
runAtMs: 1770321600002 (Feb 6, 07:00 AEDT)nextRunAtMsin run entry: 1770408000000 (Feb 7, 07:00 AEDT) ✅nextRunAtMsin current job state: 1770494400000 (Feb 8, 07:00 AEDT) ❌
Expected Behavior
After gateway restart, the scheduler should preserve the correct nextRunAtMs or recalculate it correctly as the next occurrence of the cron expression (Feb 7, 07:00).
Actual Behavior
The scheduler skips a day and sets nextRunAtMs to Feb 8 instead of Feb 7.
Environment
- OpenClaw version: 2026.2.3-1
- OS: macOS 26.2 (arm64)
- Node: v25.5.0
- Cron expression:
0 7 * * * - Timezone: Australia/Melbourne
Workaround
Manual intervention required. Attempted cron action:update with patched state, but state appears to be read-only or immediately recalculated.
Additional Notes
This bug causes scheduled jobs to miss their expected runs, which is critical for daily automation tasks like morning briefings.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels