Conversation
…_effort) A cron job may now carry its own agent turn budget. Long multi-phase jobs (browse → plan → generate → QA) legitimately need more turns than the shared `agent.max_turns` default, and raising the global value to suit them spends the same budget on every other job — and on every interactive session. - cron/jobs.py: `_normalize_job_max_turns` validates at the store choke point (positive int stored; 0/empty clears; garbage raises before the merge so nothing invalid persists). `create_job(max_turns=)` persists the key only when set, so pre-feature records stay byte-identical. - cron/scheduler.py: `_resolve_job_turn_limit` — the job's value wins over the config-resolved limit and is logged (`per-job max_turns override -> N`) so an operator can verify it applied; a garbage value in a hand-edited store warns and follows config instead of killing the tick. - CLI: `hermes cron create/edit --max-turns N` (0 clears on edit). Same CLI-only lane as `--reasoning-effort`: a turn budget is a spend decision, so it is deliberately absent from CRONJOB_SCHEMA and the model never sets it. - tests/cron/test_cron_job_max_turns.py: store contract + scheduler precedence (21 cases). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HQ7VR1qRcF6jQjQ7h6jsd1
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
Let a cron job carry its own agent turn budget:
hermes cron create/edit --max-turns N.Long multi-phase jobs (browse → plan → generate → QA) legitimately need more turns than the shared
agent.max_turnsdefault. Today the only lever is the global value, which spends the same budget on every other job and on every interactive session. This mirrors the existing per-jobreasoning_effortoverride end to end.Changes
_normalize_job_max_turnsvalidates at the store choke point: positive int stored;0/empty clears; anything else raises before the merge so nothing invalid persists.create_job(max_turns=)persists the key only when set, so pre-feature records stay byte-identical._resolve_job_turn_limit(job, config_limit): the job's value wins over the config-resolved limit and is logged (Job 'x': per-job max_turns override -> N) so an operator can verify it applied from the run log. A garbage value in a hand-edited store warns and follows config instead of killing the tick.--max-turnsoncron createandcron edit(0clears on edit);Max turns:shown in the create/edit summaries.cronjob()for the CLI, but deliberately absent fromCRONJOB_SCHEMA: same CLI-only lane asreasoning_effort— a turn budget is a spend decision, so the model never sets it.Motivation (real incident)
A three-phase daily content pipeline ran under
max_turns: 160/110/200set directly injobs.json(a local patch). After an update dropped the patch, every phase silently ran at the global 60 and the planner phase stopped mid-write two days in a row withreached the iteration limit. Raising the global to 200 works but is the wrong tool — it changes every job and every chat session.Test plan
pytest tests/cron/test_cron_job_max_turns.py tests/cron/test_scheduler.py tests/cron/test_jobs.py tests/cron/test_cron_reasoning_effort.py tests/tools/test_cronjob_tools.py→ all pass (375).hermes cron create --helpshows--max-turns.🤖 Generated with Claude Code
https://claude.ai/code/session_01HQ7VR1qRcF6jQjQ7h6jsd1