Skip to content

fix(cron): cap LLM job iterations separately - #33305

Open
Dev-TechT wants to merge 1 commit into
NousResearch:mainfrom
Dev-TechT:fix/cron-llm-max-iterations
Open

fix(cron): cap LLM job iterations separately#33305
Dev-TechT wants to merge 1 commit into
NousResearch:mainfrom
Dev-TechT:fix/cron-llm-max-iterations

Conversation

@Dev-TechT

@Dev-TechT Dev-TechT commented May 27, 2026

Copy link
Copy Markdown

Summary

  • add a cron-specific max_iterations cap for LLM-backed scheduled jobs
  • stop cron runs from inheriting 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

Why

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 passed
  • python -m pytest tests/cron/test_cron_inactivity_timeout.py -q -o 'addopts=' -> 17 passed
  • python -m py_compile cron/scheduler.py tests/cron/test_cron_inactivity_timeout.py hermes_cli/config.py -> passed
  • git diff --check -> passed
  • broader cron signal: python -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

  • This intentionally changes the default for LLM-backed cron jobs: operators who need a higher cron cap can set cron.max_iterations or HERMES_CRON_MAX_ITERATIONS.
  • Fork PR workflows are waiting for upstream authorization, so GitHub Actions currently show action_required with no runnable jobs.

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.
@alt-glitch alt-glitch added type/feature New feature or request P2 Medium — degraded but workaround exists comp/cron Cron scheduler and job management comp/cli CLI entry point, hermes_cli/, setup wizard labels May 27, 2026

@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 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) at cron/scheduler_provider.py:179, and cron/scheduler.py:3704-3761 dispatches 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_ITERATIONS override conflicts with the non-secret configuration rule in AGENTS.md:102-106; behavioral settings belong in config.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_iterations as the configuration surface, and update the resolution tests accordingly.

Automated hermes-sweeper review.

Comment thread hermes_cli/config.py
# 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,

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.

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.

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

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard comp/cron Cron scheduler and job management P2 Medium — degraded but workaround exists 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.

3 participants