Skip to content

fix(agent): treat absent or zero maxTurns as unlimited - #563

Merged
huichen merged 1 commit into
mainfrom
claude/unlimited-turns
Sep 12, 2026
Merged

huichen merged 1 commit into
mainfrom
claude/unlimited-turns

Conversation

@huichen

@huichen huichen commented Sep 12, 2026 •

Copy link
Copy Markdown
Collaborator

~/.future/agent/settings.json documents maxTurns: 0 as unlimited and DEFAULT_MAX_TURNS is 0, but the agent startup path floored any non-positive value to a hard-coded 50. Anyone who never set maxTurns (or set 0) was stopped mid-task with the "Reached the turn limit (50)" error.

  • agent/src/cli.rs: pass settings.max_turns through unchanged — no hidden floor at startup.
  • agent/src/agent/run_loop.rs: add a test that max_turns: 0 keeps running past 50 tool-call rounds (fails if a floor is reintroduced).

Positive values still cap the run exactly as before.

Checks (in the worktree, origin/main up to date): cargo fmt -p future-agent --check, cargo clippy -p future-agent --all-targets -- -D warnings, cargo test -p future-agent. The 31 failures in that full run are pre-existing on this Windows host (Linux-sandbox tests, shell/path tests, a Windows file-in-use error) and reproduce identically on unmodified main; the new and touched tests pass.

The startup path floored a non-positive maxTurns to 50, while the run loop already treated 0 as unlimited (DEFAULT_MAX_TURNS), so the documented zero-means-unlimited setting silently capped runs at 50 tool-call rounds. Pass the setting through unchanged and add a test that runs past 50 rounds.
@huichen
huichen enabled auto-merge (squash) September 12, 2026 03:51
@huichen
huichen merged commit 322e6de into main Sep 12, 2026
12 checks passed
@huichen
huichen deleted the claude/unlimited-turns branch September 12, 2026 03:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant