Repository navigation
fix(cron): replay jobs missed during subsecond Gateway restarts - #117797
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 2, 2026, 12:48 AM ET / 04:48 UTC. ClawSweeper reviewWhat this changesChanges Gateway cron restart catch-up to include a scheduled slot already in progress during its first second, removes the unused strict helper, and adds boundary-focused regression coverage. Merge readinessThis PR remains necessary: current main still takes the strict previous-slot path during Gateway restart catch-up, which excludes a cron slot that started within the current second. The candidate reuses the established inclusive helper and adds focused restart coverage; the protected Priority: P1 Review scores
Verification
How this fits togetherCron jobs persist their most recent and next scheduled execution times. On Gateway startup, restart catch-up decides whether a missed cron slot should run, then hands the selected job to the normal execution and state-update path. flowchart LR
A[Persisted cron state] --> B[Gateway restart]
B --> C[Restart catch-up]
C --> D[Find latest scheduled slot]
D --> E{Missed since last run?}
E -->|Yes| F[Run job once]
E -->|No| G[Keep next schedule]
F --> H[Persist outcome]
Decision needed
Why: The patch is narrowly source-supported, but it changes a protected maintainer-owned Gateway recovery path that decides whether scheduled work runs after restart. Before merge
Agent review detailsSecurityNone. PR surfaceSource -11, Tests +65. Total +54 across 5 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the single inclusive previous-slot policy, land this focused restart-catch-up change after exact-head CI is green, and retain the new five-field, six-field, staggered, and startup-boundary regression coverage. Do we have a high-confidence way to reproduce the issue? Yes—current-main source shows the strict previous-slot calculation in the restart missed-slot path, while the existing inclusive helper covers the same boundary. The candidate adds a focused CronService startup case at 500 ms after the scheduled minute; this read-only review did not execute it. Is this the best way to solve the issue? Yes—the branch removes the duplicate strict policy and routes restart catch-up through the already-established inclusive scheduling owner instead of adding a new fallback or configuration surface. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 4f707d15d8fa. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
8f998aa to
9862dd3
Compare
|
Merged via squash.
|
…7797) Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
Fixes an issue where a scheduled automation silently failed to run after Gateway restart when the missed cron slot began less than one second earlier.
Why This Change Was Made
Use the existing canonical inclusive previous-slot owner in restart catch-up, matching the adjacent recovery path and compensating for Croner's documented whole-second previous-run semantics. Delete the obsolete strict helper and its internal barrel export, and keep the real Gateway regression in its own focused test module. Preserve existing stagger, timezone, daylight-saving, activation, duplicate-suppression, and error-backoff ownership.
User Impact
A job missed during the first second of its scheduled minute now runs once after restart instead of disappearing without an execution, notification, or recorded reason.
Evidence
04:02:00.500after a missed04:02:00slot invokes the scheduled job zero times instead of once.9862dd38811a21e722d1d6d1a4c3db378ad2f0c2: all three complete scheduling/restart owner suites pass 124/124, including five-field and six-field boundaries, 500/999 ms offsets, stagger, restart, activation, and backoff.gpt-5.6-solhigh-reasoning P0–P3 review: zero findings, confidence 0.94; native TruffleHog 3.96.0 secret scan clean.255, so final complete typecheck evidence will come from this PR's exact-head hosted CI.