feat(cron): add configurable max_repeat safeguard for cron job repeats (#59333) - #60476
Open
webtecnica wants to merge 1 commit into
Open
feat(cron): add configurable max_repeat safeguard for cron job repeats (#59333)#60476webtecnica wants to merge 1 commit into
webtecnica wants to merge 1 commit into
Conversation
(cherry picked from commit 14567b14cdd04171747420006b0a895c1833b858)
webtecnica
force-pushed
the
feat/59333-recurrance-limit
branch
from
July 11, 2026 12:49
14567b1 to
494b94b
Compare
teknium1
reviewed
Jul 15, 2026
teknium1
left a comment
Contributor
There was a problem hiding this comment.
Thanks for adding a guardrail around accidental high cron repeat counts. The core idea addresses behavior still present on current main: create_job() stores the supplied repeat value directly at cron/jobs.py:1203-1205.
Problems
- This does not close #59333: that issue concerns Kanban's
BLOCK_RECURRENCE_LIMIT, which remains hard-coded athermes_cli/kanban_db.py:134. - The cap only runs on creation.
cronjob(action="update")writes a supplied repeat directly attools/cronjob_tools.py:944-949, andupdate_job()persists it atcron/jobs.py:1319,1387-1388; this bypasses the safeguard. - The new
except Exception: passaround cap application silently permits an uncapped job if validation/import fails. - Please add
cron.max_repeattoDEFAULT_CONFIGand document it; neitherhermes_cli/config.py:2673-2740norwebsite/docs/user-guide/features/cron.md:558-575currently exposes this setting.
Suggested changes
- Re-scope/correct the issue reference, centralize repeat validation in
cron.jobs, apply it on create and update, and add integration tests for both paths.
This is an automated hermes-sweeper review.
| from cron.scheduler import _apply_max_repeat_to_job | ||
| _apply_max_repeat_to_job(job) | ||
| except Exception: | ||
| pass |
Contributor
There was a problem hiding this comment.
Swallowing every failure here silently creates an uncapped job, which defeats the safeguard. Please validate or log/reject failures instead of using except Exception: pass.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add configurable max_repeat safeguard for cron jobs. Reads cron.max_repeat from config (default 1000). Clamps repeat.times at job creation and logs warning. Closes #59333