fix: use LRU eviction for cron schedule cache instead of FIFO#39703
Conversation
Greptile SummaryThis PR fixes the cron schedule cache eviction policy from FIFO to true LRU by adding a
Confidence Score: 3/5
Last reviewed commit: a2dd5c5 |
|
This pull request has been automatically marked as stale due to inactivity. |
|
Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Keep this PR open. Current main still uses FIFO eviction for the cron evaluator cache: cache hits return without refreshing Map insertion order, and the full-cache path deletes the first insertion-order key. The PR remains a narrow implementation candidate, and the updated branch context addresses the earlier weak-test concern with key-level cache assertions. Security review found no CI, dependency, install, release, lockfile, or secret-handling changes in the supplied diff. Best possible solution: Review and land this PR, or land an equivalent maintainer patch, preserving the narrow delete/re-set promotion in What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against ef58307f843e. |
On cache hit, delete and re-set the entry to move it to the end of Map iteration order. This prevents frequently-accessed cron expressions (e.g. heartbeat schedules) from being evicted prematurely while rarely-used entries persist. Fixes openclaw#39679 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add hasCronInCacheForTest helper and assert specific cache entries survive or get evicted. The test now fails under FIFO but passes under LRU, directly verifying the promotion behavior.
00cb426 to
910255a
Compare
|
ProjectClownfish pushed a narrow repair to this branch so the original contributor path can stay canonical. Source PR: #39703 |
vincentkoc
left a comment
There was a problem hiding this comment.
Reviewed the current head. The cron cache change is narrow, Greptile's old weak-test thread is resolved/stale after the key-level assertions, and ClawSweeper's keep-open recommendation is satisfied by this branch.
Validation:
- Testbox tbx_01kqbf1p6xk0h7e9vxs3d2g1kg: OPENCLAW_TESTBOX=1 pnpm test:serial src/cron/schedule.test.ts
- Testbox tbx_01kqbf1p6xk0h7e9vxs3d2g1kg: OPENCLAW_TESTBOX=1 pnpm check:changed
Summary
resolveCachedCron(), delete and re-set the entry to move it to the end of Map iteration order*/5 * * * *heartbeats) from being evicted prematurelyTest plan
pnpm build && pnpm check && pnpm testall greenFixes #39679
🤖 Generated with Claude Code