Skip to content

feat(cron): add configurable max_repeat safeguard for cron job repeats (#59333) - #60476

Open
webtecnica wants to merge 1 commit into
NousResearch:mainfrom
webtecnica:feat/59333-recurrance-limit
Open

feat(cron): add configurable max_repeat safeguard for cron job repeats (#59333)#60476
webtecnica wants to merge 1 commit into
NousResearch:mainfrom
webtecnica:feat/59333-recurrance-limit

Conversation

@webtecnica

Copy link
Copy Markdown
Contributor

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

@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have comp/cron Cron scheduler and job management area/config Config system, migrations, profiles labels Jul 7, 2026
(cherry picked from commit 14567b14cdd04171747420006b0a895c1833b858)
@webtecnica
webtecnica force-pushed the feat/59333-recurrance-limit branch from 14567b1 to 494b94b Compare July 11, 2026 12:49

@teknium1 teknium1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 at hermes_cli/kanban_db.py:134.
  • The cap only runs on creation. cronjob(action="update") writes a supplied repeat directly at tools/cronjob_tools.py:944-949, and update_job() persists it at cron/jobs.py:1319,1387-1388; this bypasses the safeguard.
  • The new except Exception: pass around cap application silently permits an uncapped job if validation/import fails.
  • Please add cron.max_repeat to DEFAULT_CONFIG and document it; neither hermes_cli/config.py:2673-2740 nor website/docs/user-guide/features/cron.md:558-575 currently 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.

Comment thread cron/jobs.py
from cron.scheduler import _apply_max_repeat_to_job
_apply_max_repeat_to_job(job)
except Exception:
pass

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/config Config system, migrations, profiles comp/cron Cron scheduler and job management P3 Low — cosmetic, nice to have sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Use config for BLOCK_RECURANCE_LIMIT

3 participants