fix(cron): cap LLM job iterations separately - #33305
Open
Dev-TechT wants to merge 1 commit into
Open
Conversation
Add a cron-specific max_iterations resolver so scheduled LLM jobs no longer inherit large interactive agent.max_turns values by default. Document cron.max_iterations/HERMES_CRON_MAX_ITERATIONS and cover default, override, invalid, and run_job propagation paths.
4 tasks
teknium1
reviewed
Jul 13, 2026
teknium1
left a comment
Contributor
There was a problem hiding this comment.
Thanks for isolating the cron-agent iteration resolution and adding propagation coverage.
Problems
- The claimed ticker-starvation failure mode is no longer present on current main: the production in-process scheduler calls
tick(..., sync=False)atcron/scheduler_provider.py:179, andcron/scheduler.py:3704-3761dispatches jobs to persistent pools without waiting. A cron-specific cap may still be useful for cost control, but the rationale should be updated to the current execution model. - The new documented
HERMES_CRON_MAX_ITERATIONSoverride conflicts with the non-secret configuration rule inAGENTS.md:102-106; behavioral settings belong inconfig.yaml. - The proposed test hard-codes the default 30. Prefer asserting the behavioral relationship—that cron does not inherit a large
agent.max_turns—over freezing a default literal.
Suggested changes
- Re-scope to the verified cost/control objective, use
cron.max_iterationsas the configuration surface, and update the resolution tests accordingly.
Automated hermes-sweeper review.
| # intentionally separate from agent.max_turns so a high interactive | ||
| # chat cap cannot let one recurring job monopolize the scheduler tick. | ||
| # Also overridable via HERMES_CRON_MAX_ITERATIONS env var. | ||
| "max_iterations": 30, |
Contributor
There was a problem hiding this comment.
Please do not add the documented HERMES_CRON_MAX_ITERATIONS override. AGENTS.md:102-106 requires non-secret behavioral settings to be configured through config.yaml; keep this feature on cron.max_iterations only.
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.
Summary
max_iterationscap for LLM-backed scheduled jobsagent.max_turnsvalues by defaultcron.max_iterations/HERMES_CRON_MAX_ITERATIONSand cover default, override, invalid, and run-job propagation pathsWhy
A high interactive turn limit is useful in chat, but a recurring cron job inheriting it can monopolize the gateway cron ticker and delay unrelated due jobs. Cron should have a conservative scheduler-safe default unless the operator explicitly opts into a higher cron-specific limit.
Test Plan
python -m pytest tests/cron/test_cron_inactivity_timeout.py::TestCronRunLimits -q -o 'addopts='-> 6 passedpython -m pytest tests/cron/test_cron_inactivity_timeout.py -q -o 'addopts='-> 17 passedpython -m py_compile cron/scheduler.py tests/cron/test_cron_inactivity_timeout.py hermes_cli/config.py-> passedgit diff --check-> passedpython -m pytest tests/cron/test_cron_inactivity_timeout.py tests/cron/test_scheduler.py -q -o 'addopts='-> 142 passed, 3 failed in existing Matrix delivery-target expectations unrelated to this diff (thread_id/ extra Matrix home channel pollution)Notes
cron.max_iterationsorHERMES_CRON_MAX_ITERATIONS.action_requiredwith no runnable jobs.