← Back to PRs

#6827: fix: cron scheduler cleanup orphaned .tmp files on startup

by fatelei open 2026-02-02 03:07 View on GitHub →
Cluster: Cron Job Fixes
fix #6814 <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR adds startup cleanup for orphaned `*.tmp` cron store files (left behind by interrupted `saveCronStore` writes) by introducing `cleanupOrphanedTempFiles(storePath)` in `src/cron/store.ts` and calling it from `ensureLoaded()` before reading the cron jobs store. The change fits the existing persistence approach in `src/cron/store.ts` where writes are done via a temp file + rename; this adds a best-effort guard to prevent old temp artifacts from accumulating across runs (fixing #6814). <h3>Confidence Score: 4/5</h3> - This PR is reasonably safe to merge; it adds best-effort temp-file cleanup with low blast radius. - Changes are small and localized, but there is a plausible behavioral gap where cleanup is skipped on the in-memory cache fast-path, and the cleanup function fully suppresses errors which could hide operational problems. - src/cron/service/store.ts (cleanup call placement), src/cron/store.ts (error visibility during cleanup) <!-- greptile_other_comments_section --> <sub>(4/5) You can add custom instructions or style guidelines for the agent [here](https://app.greptile.com/review/github)!</sub> **Context used:** - Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8)) - Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=0d0c8278-ef8e-4d6c-ab21-f5527e322f13)) <!-- /greptile_comment -->

Most Similar PRs