fix: skip already-run cron catchup after restart#102004
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 7, 2026, 11:57 PM ET / July 8, 2026, 03:57 UTC. Summary PR surface: Source +40, Tests +108. Total +148 across 2 files. Reproducibility: yes. source-level: current main starts runMissedJobs before maintenance recompute, and isRunnableJob returns true for due nextRunAtMs before comparing the previous cron slot to lastRunAtMs. I did not run a live Gateway restart in this read-only review. Review metrics: none identified. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land one narrow cron scheduler fix that preserves failed/skipped retry behavior, stale successful-slot dedupe, later missed-slot replay, and exact-boundary replay, after real behavior proof and exact-head CI are clean. Do we have a high-confidence way to reproduce the issue? Yes, source-level: current main starts runMissedJobs before maintenance recompute, and isRunnableJob returns true for due nextRunAtMs before comparing the previous cron slot to lastRunAtMs. I did not run a live Gateway restart in this read-only review. Is this the best way to solve the issue? Yes, with proof still missing: this branch fixes the runnable gate while preserving later and exact-boundary missed-slot replay better than simpler duplicate guards. The best merge path still needs real behavior proof and clean exact-head CI. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 757d7a0de321. Label changesLabel justifications:
Evidence reviewedPR surface: Source +40, Tests +108. Total +148 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
Closes #101988
What Problem This Solves
Fixes an issue where users with successful cron jobs could receive duplicate startup catch-up runs after a Gateway restart when the persisted due slot had already completed.
Why This Change Was Made
Startup catch-up now treats a stale successful cron due slot as already covered only when no later cron occurrence has been missed. The check still replays legitimate missed cron slots, including a slot due exactly at restart time, and leaves failed/skipped retry and backoff behavior unchanged.
User Impact
Users should no longer see duplicate scheduled cron output after restarting the Gateway when the current schedule window already completed successfully. Missed later cron windows still catch up instead of being silently advanced away.
Evidence
git diff --checknode scripts/run-vitest.mjs src/cron/service.restart-catchup.test.ts(18 tests passed)node scripts/run-vitest.mjs src/cron/service/timer.regression.test.ts(66 tests passed).agents/skills/autoreview/scripts/autoreview --mode local(clean: no accepted/actionable findings)AI-assisted by Codex.