Repository navigation
feat(cron): optionally skip missed recurring jobs at startup - #135071
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed September 1, 2026, 7:41 AM ET / 11:41 UTC. ClawSweeper reviewWhat this changesThis PR adds an optional Merge readinessKeep open for maintainer handling: current main still uses normal startup catch-up, while this maintainer-authored, protected PR adds the reviewed opt-in behavior with no blocking defect found. Priority: P2 Review scores
Verification
How this fits togetherThe Gateway cron service reads durable automation schedules at startup, determines which overdue jobs should run, and persists schedule state before ordinary timer ticks can deliver work. This change lets an operator choose to advance missed recurring work instead of executing it after downtime. flowchart LR
A[Stored automation schedules] --> B[Gateway cron startup]
B --> C[Startup catch-up evaluation]
C --> D{Skip missed recurring enabled?}
D -->|Yes| E[Persist next future occurrence]
D -->|No| F[Reserve catch-up work]
E --> G[Regular timer tick]
F --> G
G --> H[Automation delivery]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +47, Tests +85, Docs +3, Generated 0. Total +135 across 11 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Land the documented opt-in at the cron startup owner, retaining false/unset catch-up and one-shot semantics as covered by the branch. Do we have a high-confidence way to reproduce the issue? Yes: the startup call chain and durable-row boundary establish a focused scenario with an overdue recurring job and an enabled option; the supplied comment also reports that isolated Gateway restart scenario. Is this the best way to solve the issue? Yes: placing the decision in startup catch-up and persisting the recomputed schedule is the narrow owner-boundary solution, preventing the first normal timer tick from replaying the skipped occurrence. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 1855fe0f4e48. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
|
Config-surface approval note: the |
Add cron.skipMissedJobs (default false). Recompute and commit missed recurring schedules in the startup owner before returning the catch-up plan, so the first regular timer tick cannot replay stale occurrences. Keep one-shot catch-up, future schedules, and active-run ownership intact. Align config validation, help, labels, docs, and persistence regressions. Discovery source: NetEase Youdao's LobsterAI patch stack (https://github.com/netease-youdao/LobsterAI).
ab07d73 to
ecb4c6e
Compare
|
Live proof (real gateway restarts from this branch's built dist, isolated
Note: the @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Merged via squash.
|
…w#135071) * feat(cron): optionally skip missed recurring jobs at startup Add cron.skipMissedJobs (default false). Recompute and commit missed recurring schedules in the startup owner before returning the catch-up plan, so the first regular timer tick cannot replay stale occurrences. Keep one-shot catch-up, future schedules, and active-run ownership intact. Align config validation, help, labels, docs, and persistence regressions. Discovery source: NetEase Youdao's LobsterAI patch stack (https://github.com/netease-youdao/LobsterAI). * docs(config): refresh generated config baseline for cron.skipMissedJobs
What Problem This Solves
After Gateway downtime, recurring automations can run stale reminders or digests during startup catch-up, producing unwanted messages and model calls. Catch-up limits only pace the stale work; they do not let an operator opt out.
Why This Change Was Made
Add the approved
cron.skipMissedJobsoption, defaulting to false. Startup schedule preparation fast-forwards runnable recurring jobs with the existing scheduler helper, commits the authoritative runtime rows, and excludes those jobs from catch-up. The durable update is essential: an empty plan alone would let the first regular scheduler tick replay the expired slot. The change uses the existing row-scoped SQLite transaction and respects active-run ownership.Discovery source: NetEase Youdao's LobsterAI patch stack (github.com/netease-youdao/LobsterAI). The implementation follows current main's runtime ownership and persistence architecture, not the older patch structure.
User Impact
With
cron.skipMissedJobs: true, missedcron/everyoccurrences are dropped in favor of the next future occurrence. This avoids stale work at the cost of intentionally not catching up. One-shotatjobs keep their catch-up semantics. Unset/false preserves the existing default. Types, validation, Settings help/labels, and docs describe the option. No storage schema or migration changes.Evidence
The seven targeted test files passed (74 tests), and the edited file passed a final 5-test rerun after a callback-variable lint correction.
pnpm check:changedexited 0 without skip flags. Final autoreview is scoped-clean at P0. Regression coverage includes empty and mixed startup plans, durable future timestamps for cron/every, history-only missed cron, unchanged future schedules and run history, overdue one-shot execution, and no replay on the first regular tick. Existing restart/backoff/concurrency tests cover the unchanged default and sibling ownership paths. Full Gateway/channel live proof is not claimed; the tests use the real cron startup owner, SQLite store, and first regular tick with mocked execution callbacks.Commands:
The initial environment lacked executable links and later failed collection on
zod/v4; the permittedpnpm installrepaired dependencies. The first full check found one test-variable shadowing issue, which was corrected and revalidated. No checks or assertions were weakened. Pre-fix regression failure was verified by base/diff reasoning, as allowed by the worker contract; the initial pre-fix executions stalled before assertions.