fix(cron): keep recurring backoff stable after reload#74068
Conversation
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Keep open for explicit maintainer handling, not cleanup close: this member-authored draft is still draft/conflicting and now conflicts with the current main and release contract that recurring cron backoff honors configured Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Canonical path: Close this PR as superseded by #93051. So I’m closing this here and keeping the remaining discussion on #93051. Review detailsBest possible solution: Close this PR as superseded by #93051. Do we have a high-confidence way to reproduce the issue? Yes for the review finding: source inspection shows the PR removes configured Is this the best way to solve the issue? No. The patch changes only recompute and would diverge from current runtime scheduling, docs, and release behavior; the safer path is to preserve configured backoff or make a coordinated maintainer-approved contract change. Security review: Security review cleared: The diff changes only cron scheduling logic and a focused test, with no dependency, workflow, secret, permission, package, or artifact execution surface touched. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against 5361e5a0b455. |
Greptile SummaryThis PR adds gateway-level validation of cron expressions for both The two new tests directly lock in the pre-mutation rejection contract for both the Confidence Score: 5/5Safe to merge — the fix is narrowly scoped to gateway pre-validation and backed by new targeted tests. No P0 or P1 findings. The validation logic is straightforward, the placement in the handler sequence is correct (after schema/timestamp validation, before delivery assertion and service mutation), nil-schedule is safely short-circuited, and the catch-all in cronScheduleValidationError is acceptable given that every exception computeNextRunAtMs can throw for a cron-kind schedule is genuinely an invalid-request condition. No files require special attention. Reviews (4): Last reviewed commit: "fix(cron): reject invalid schedule edits..." | Re-trigger Greptile |
| function isCronScheduleParseError(err: unknown): err is Error { | ||
| return ( | ||
| (err instanceof TypeError || err instanceof RangeError) && | ||
| (err.message.startsWith("CronPattern:") || err.message.startsWith("CronDate:")) | ||
| ); | ||
| } |
There was a problem hiding this comment.
Croner error detection tied to message string prefixes
isCronScheduleParseError detects Croner failures by matching the error message against "CronPattern:" and "CronDate:" prefixes. If a future Croner release rewords or restructures its error messages, the defensive catch in addCronJobWithValidation / updateCronJobWithValidation would silently stop working — Croner TypeError/RangeError instances that no longer match the prefix would fall through the throw err branch and revert to the original gateway-crash behavior. Consider adding a comment pinning the expected Croner version (or a snapshot of the exact prefix format) so the fragility is visible during dependency upgrades.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/gateway/server-methods/cron.ts
Line: 103-108
Comment:
**Croner error detection tied to message string prefixes**
`isCronScheduleParseError` detects Croner failures by matching the error message against `"CronPattern:"` and `"CronDate:"` prefixes. If a future Croner release rewords or restructures its error messages, the defensive catch in `addCronJobWithValidation` / `updateCronJobWithValidation` would silently stop working — Croner `TypeError`/`RangeError` instances that no longer match the prefix would fall through the `throw err` branch and revert to the original gateway-crash behavior. Consider adding a comment pinning the expected Croner version (or a snapshot of the exact prefix format) so the fragility is visible during dependency upgrades.
How can I resolve this? If you propose a fix, please make it concise.650363a to
9503c75
Compare
9503c75 to
29c1eb7
Compare
29c1eb7 to
189784e
Compare
8964ed6 to
42a2c40
Compare
This comment was marked as low quality.
This comment was marked as low quality.
|
Thanks. I narrowed the PR body to #74459 and kept the fix at the gateway boundary so invalid cron schedules are rejected before |
42a2c40 to
d5e2045
Compare
|
Codex review: needs maintainer review before merge. What this changes: The PR imports cron schedule computation into the gateway cron handler, validates cron schedules before Maintainer follow-up before merge: This is an active contributor PR with a narrow, plausible fix and no clear blocking defect; the next action is maintainer review and targeted validation, especially deciding whether gateway-only validation is sufficient for the linked issue scope. Review detailsBest possible solution: Land this gateway-boundary validation if maintainers accept the scope, then handle any broader service-level transactional hardening for pre-existing invalid persisted jobs as a separate, explicit follow-up if needed. Acceptance criteria:
What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 8cf724a381a3. |
|
Thanks. I agree broader CronService transactional hardening or repair for already-persisted invalid jobs is separate from this PR. This PR intentionally fixes #74459 at the gateway boundary: submitted invalid cron schedules are rejected before Local proof: |
d5e2045 to
4da928c
Compare
4da928c to
3c9437a
Compare
e56554d to
32ead20
Compare
|
This pull request has been automatically marked as stale due to inactivity. |
|
Thanks @ai-hpc. Closing as superseded by the current cron retry contract. Commit This draft removes the configured schedule during recomputation, so it would now regress current runtime and documented behavior rather than fix it. If a distinct reload defect remains, please open a focused current-main issue with before and after timing plus persisted-state evidence. |
Summary
cron.retry.backoffMsto recurring jobs after reloadVerification