Repository navigation
fix(cron): defer auto-disable notifications until persistence - #118384
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 3, 2026, 5:41 AM ET / 09:41 UTC. ClawSweeper reviewWhat this changesThe branch defers cron schedule-error auto-disable notifications until cron state persists, and prevents manual-run eligibility checks from advancing schedule-error state or disabling jobs. Merge readinessThis PR is still necessary: current Priority: P2 Review scores
Verification
How this fits togetherCron scheduling recomputes each job’s next run and may auto-disable invalid schedules after repeated failures. Timer, read, mutation, and manual-run entry points own persistence; they must publish agent-facing notifications only after that durable write succeeds. flowchart TD
A[Cron job store] --> B[Schedule recomputation]
B --> C{Schedule valid?}
C -->|Repeated error| D[Queue auto-disable notification]
C -->|Valid| E[Update next run]
D --> F[Persist or restore cron state]
E --> F
F -->|Write succeeds| G[Notify agent and wake timer]
F -->|Write fails| H[Restore prior state]
I[Manual-run preflight] --> J[Advisory recomputation without error transition]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +49, Tests +115. Total +164 across 7 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Merge the branch after the remaining exact-head checks pass, preserving Do we have a high-confidence way to reproduce the issue? Yes. The PR provides a focused current-head runtime proof through Is this the best way to solve the issue? Yes. Deferring notifications at the existing AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 0fbddda540e1. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
|
Merged via squash.
|
…aw#118384) * fix(cron): defer auto-disable notifications until persistence * fix(cron): emit disable notifications only after durable roster commits --------- Co-authored-by: Peter Steinberger <[email protected]>
Closes #118345
What Problem This Solves
Fixes an issue where cron jobs could be auto-disabled and notify listeners before the updated schedule-error state was durably persisted. Manual-run preflight could also mutate a job while only checking whether a run should proceed.
Why This Change Was Made
Cron maintenance notifications are now deferred until
persistOrRestoresucceeds, so failed writes cannot publish speculative auto-disable or schedule changes. Manual-run preflight skips schedule-error side effects because it is an advisory read-shaped check.User Impact
Cron jobs no longer emit premature auto-disable notifications when persistence fails, and manual-run checks do not unexpectedly disable jobs or advance their schedule-error counters.
Evidence
node scripts/run-vitest.mjs src/cron/service/ops.test.ts src/cron/service/jobs.schedule-error-isolation.test.ts— 60 tests passed.createCronServiceState->add->inspectManualRunDispositionwith an invalid timezone:{ reason: not-due, enabled: true, scheduleErrorCount: 2, enqueueSystemEventCalls: 0, requestHeartbeatCalls: 0 }.oxfmt --checkandgit diff --checkpassed.autoreview --mode uncommitted --engine codexcompleted cleanly with no accepted/actionable findings.Proof boundary: the runtime proof covers the production manual-preflight seam and its notification/state invariants; the focused tests cover persistence rollback and schedule-error isolation paths. Broader CI remains GitHub's responsibility.