-
-
Notifications
You must be signed in to change notification settings - Fork 39.6k
Closed
Description
Environment
- OpenClaw version: 2026.2.3-1
- OS: macOS (arm64, Darwin 25.2.0)
- Node: v25.5.0
Description
After a fresh gateway stop+start, the cron scheduler's internal timer fires correctly (verified via cron.status showing nextWakeAtMs advancing every minute), but runDueJobs does not execute any jobs after the very first auto-triggered run.
Steps to Reproduce
- Create a simple test job:
openclaw cron add --name 'test-every-minute' --cron '* * * * *' --tz 'Asia/Shanghai' --session isolated --message 'Send a confirmation message' --delivery-mode none- Verify
cron.statusshowsnextWakeAtMsis set correctly - Wait for the first trigger — it fires successfully
- Wait for subsequent triggers — they never fire
cron.runs --id <jobId>shows only 1 entry (the first auto-fire)openclaw cron run <jobId> --forceworks every time
Observed Behavior
- Gateway startup calls
recomputeNextRuns, setting all jobs'nextRunAtMsto future times - First timer fires and executes one due job successfully
- After that, timer continues to fire every minute (visible via
cron.statusnextWakeAtMsadvancing) - But
runDueJobsfinds zero due jobs each time - The
nextRunAtMsinjobs.jsonkeeps getting pushed forward on each timer tick without any execution
Expected Behavior
Jobs should auto-fire on their schedule continuously, not just once after restart.
Source Analysis
Looking at gateway-cli-D_8miTjF.js:
computeNextRunAtMsforeverytype: usesschedule.anchorMs ?? nowMsas anchor, so without anchorMs it always computesnow + everyMs(always in the future)onTimer→runDueJobsfilters jobs wherenow >= nextRunAtMs, but ifnextRunAtMswas recomputed to future during a previous tick'spersist()call, the job is never due- The
cronexpression type (* * * * *) exhibits the same behavior, so it's not specific toeverytype
Workaround
Using heartbeat polling (HEARTBEAT.md) as a replacement for cron-scheduled tasks.
Additional Context
maxConcurrentRunsis default (1)- Heartbeat interval: 5 minutes
- All jobs use
wakeMode: next-heartbeat - 24 enabled jobs in the store
- The issue persists across full stop+start cycles (not just SIGUSR1 restarts)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels