From 0e2c51dd666bb82da360d60eca8183f50394ab34 Mon Sep 17 00:00:00 2001 From: Offbeat-Breed <34660465+fxinfo24@users.noreply.github.com> Date: Wed, 26 Aug 2026 21:43:34 +0600 Subject: [PATCH] feat: raise agent iteration turn budgets (30/20/50 -> 100/100/200) Long multi-step agentic runs were hitting the turn ceilings and truncating real work. Raises SUBAGENT_DEFAULT_MAX_TURNS 30->100, DEFAULT_GOAL_MAX_TURNS 20->100, QueryConfig/FrozenQueryConfig.max_turns 50->200, and DEFAULT_MAX_TURNS 50->200. Independent of the compaction work in #903; split out for separate review/revert. --- src/agent/run_agent.py | 4 +++- src/goals/goals.py | 4 +++- src/query/config.py | 4 ++-- src/server/agent_server.py | 4 +++- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/agent/run_agent.py b/src/agent/run_agent.py index 2149680f3..f93a72c88 100644 --- a/src/agent/run_agent.py +++ b/src/agent/run_agent.py @@ -35,7 +35,9 @@ # Fallback max turns for subagents when no explicit limit is set. # Prevents unbounded loops that appear as hangs to the user. -SUBAGENT_DEFAULT_MAX_TURNS = 30 +# Raised 30 -> 100: real multi-step subagent work was hitting the cap and +# truncating before completion. +SUBAGENT_DEFAULT_MAX_TURNS = 100 @dataclass diff --git a/src/goals/goals.py b/src/goals/goals.py index 5e70cfced..1a3dd857e 100644 --- a/src/goals/goals.py +++ b/src/goals/goals.py @@ -57,7 +57,9 @@ #: Turn budget backstop (donor default). CC ships unbounded; the budget #: pauses (never clears) so ``/goal resume`` continues with a fresh budget. -DEFAULT_GOAL_MAX_TURNS = 20 +#: Raised 20 -> 100: goal runs were exhausted at the cap before finishing +#: multi-step tasks. +DEFAULT_GOAL_MAX_TURNS = 100 #: Claude Code's documented condition cap (docs/en/goal). GOAL_CONDITION_MAX_CHARS = 4000 diff --git a/src/query/config.py b/src/query/config.py index 48e034cf2..eea57a216 100644 --- a/src/query/config.py +++ b/src/query/config.py @@ -10,7 +10,7 @@ class QueryConfig: model: str = "claude-sonnet-4-6" max_tokens: int = 16384 - max_turns: int = 50 + max_turns: int = 200 effort: str = "high" temperature: float | None = None stop_sequences: list[str] | None = None @@ -41,7 +41,7 @@ class QueryConfig: class FrozenQueryConfig: model: str = "claude-sonnet-4-6" max_tokens: int = 16384 - max_turns: int = 50 + max_turns: int = 200 effort: str = "high" temperature: float | None = None stop_sequences: tuple[str, ...] | None = None diff --git a/src/server/agent_server.py b/src/server/agent_server.py index 4c94e9f1d..7b52ab04b 100644 --- a/src/server/agent_server.py +++ b/src/server/agent_server.py @@ -97,7 +97,9 @@ #: Default agent-loop turn ceiling for an interactive session. Shared by the #: dataclass default below and the ``--max-turns`` CLI flag (agent_server_cli.py) #: so the two can't drift apart from independently hand-edited literals. -DEFAULT_MAX_TURNS = 50 +#: Raised 50 -> 200: interactive sessions were capped mid-task on long +#: agentic runs. +DEFAULT_MAX_TURNS = 200 _SHUTDOWN = object() # sentinel pushed onto the worker inbox to stop it