Skip to content

fix(cron): avoid recomputeNextRuns on forceReload#9393

Open
matthewpapa07 wants to merge 1 commit intoopenclaw:mainfrom
matthewpapa07:fix/cron-force-reload
Open

fix(cron): avoid recomputeNextRuns on forceReload#9393
matthewpapa07 wants to merge 1 commit intoopenclaw:mainfrom
matthewpapa07:fix/cron-force-reload

Conversation

@matthewpapa07
Copy link

@matthewpapa07 matthewpapa07 commented Feb 5, 2026

Fixes cron timer never running jobs by skipping recomputeNextRuns on forceReload. When forceReload is used each tick, recomputeNextRuns advanced nextRunAtMs into the future, so dueCount stayed 0 forever.

Greptile Overview

Greptile Summary

This PR changes src/cron/service/store.ts to skip recomputeNextRuns(state) when ensureLoaded() is called with { forceReload: true }. This aligns with the timer loop in src/cron/service/timer.ts, which force-reloads the cron store on every tick before calling runDueJobs(). The intent is to prevent recomputeNextRuns from continually advancing job.state.nextRunAtMs during repeated force reloads, which could otherwise keep jobs from ever becoming due.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk.
  • The change is a small, localized conditional around recomputeNextRuns that only affects the { forceReload: true } path used by the timer tick; it prevents a confirmed starvation mode without changing job execution or persistence logic.
  • No files require special attention

(2/5) Greptile learns from your feedback when you react with thumbs up/down!

@matthewpapa07
Copy link
Author

some cronjobs were broken for me. this patch fixes them. Took a while to find this because my bot kept hallucinating that cron was working

@danielheyman
Copy link

Tested locally — this fix works!

Was hitting the exact bug described in #10269 where cron jobs would never execute. Applied this patch to both bundled JS files (gateway-cli-D_*.js and gateway-cli-c_*.js) and cron scheduler immediately started working.

Both systemEvent and agentTurn jobs now fire correctly. Would love to see this merged! 🙏

@danielheyman
Copy link

Also fixes #10439 (cron scheduler not executing jobs after gateway restart).

Copy link

@ducminhn ducminhn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR fixes issue with cron jobs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments