Repository navigation
fix(cron): protect recreated reminders from stale active runs - #114756
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 27, 2026, 6:14 PM ET / 22:14 UTC. ClawSweeper reviewWhat this changesThe PR records deletion of an in-flight cron job so its later completion cannot write outcome or delivery state into a newly created reminder that reuses the same ID. Merge readinessKeep this PR open for maintainer review. The focused patch appears correct and its supplied durable-store proof covers the direct, queued, scheduled, and startup paths; however, the branch is behind current Priority: P2 Review scores
Verification
How this fits togetherOpenClaw cron persists reminder definitions, admits executions in process, then applies terminal results back to stored jobs. The changed active-run marker separates a deleted original job from a same-ID replacement so the old completion cannot mutate the replacement. flowchart LR
A[Persisted reminder] --> B[Admitted cron run]
B --> C[Active-run marker]
A --> D[Remove original job]
D --> E[Durable removal marker]
D --> F[Same-ID replacement]
C --> G[Run completes]
E --> G
G --> H[Apply outcome only to original run]
F --> I[Replacement remains independent]
Decision needed
Why: The patch has no discrete code defect from this review, but it changes in-flight-to-persisted-job ownership and carries the protected Before merge
Agent review detailsSecurityNone. PR surfaceSource +29, Tests +212. Total +241 across 7 files. View PR surface stats
Review metricsNone. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Refresh the branch onto current Do we have a high-confidence way to reproduce the issue? Yes. Start a cron run, remove its job after admission, recreate a job with the same explicit ID before the original completes, then release the original run and verify that the replacement keeps its own history and schedule. Is this the best way to solve the issue? Yes. Recording durable deletion on the already-admitted active marker is the narrowest owner-boundary fix: it avoids changing persisted job shape or adding a compatibility path while protecting both manual and timer completion boundaries. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 15ab1334f42f. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (2 earlier review cycles)
|
8482ed9 to
93fe321
Compare
|
Merged via squash.
|
Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
Fixes an issue where users who remove a running scheduled reminder and recreate the same explicit job ID can have the original execution overwrite or consume the newly created reminder. The stale run could incorrectly attach its completion, delivery history, or failure status to the replacement across direct manual runs, queued runs, scheduled timer runs, and startup catch-up.
Why This Change Was Made
The cron active-run registry previously distinguished durable schedule edits but not a durable job deletion. Record deletion on the exact admitted run only after its removal commits, keep its active marker until real completion, finalize old scheduled and queued outcomes against the original job snapshot, and leave a same-ID replacement completely independent. Apply the same ownership invariant to ordinary removals and transactional agent-job deletions, including uncertain commits; rollbacks and idle jobs remain unchanged. No public config, plugin API, Gateway protocol, dependency, SQLite schema, migration, or compatibility surface changes.
User Impact
Operators can safely remove and recreate a reminder while its previous run is finishing. The replacement stays enabled, keeps its own schedule and untouched run/delivery history, and fires normally; the old execution still receives its correct terminal result without duplicate delivery.
Evidence
main:62baf451c14c98dc8ab70e5050083a8efb18823b.deleteAfterRunreplacement cases failed on unmodified production.pnpm check:changedpassed production and test typechecking, targeted lint, formatting, plugin/dependency guards, native state schema, database-first, runtime imports, webhook, and pairing checks.tbx_01kyjq52wf8c3hc9bw4ynnxy97; exact reviewed patch; user command exit0.Refreshed latest-main proof
62baf451c14c98dc8ab70e5050083a8efb18823b.5e8555a7c9b7ceefc2e1be2df57c6251f4411af8.93fe321608c2d62f6f47e8f36dadf2428063e5e9.tbx_01kyjsdndw4k04t7a6nxpwsw5n.main, incorporated fix: prevent cron and Workboard lifecycle races #114744, and reran exact-head ownership stress, the complete cron/Gateway/CLI regression surfaces, and independent review.