Skip to content

fix(agent): raise default and deep-mode turn budgets#650

Merged
kevincodex1 merged 2 commits into
Gitlawb:mainfrom
euxaristia:fix/raise-default-turn-budget
Jul 13, 2026
Merged

fix(agent): raise default and deep-mode turn budgets#650
kevincodex1 merged 2 commits into
Gitlawb:mainfrom
euxaristia:fix/raise-default-turn-budget

Conversation

@euxaristia

@euxaristia euxaristia commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Problem

The default per-run tool-turn budget was 50. For larger multi-step tasks that span several files, agents hit the ceiling and stopped mid-task, returning a "remaining work" summary (via the max-turns final-answer prompt) instead of finishing the job. A user hit exactly this on a multi-file feature (cloud sync, WebSocket bridge, QR pairing, PWA endpoint logic, verification): the agent reported "ran out of turns" with a checklist of unfinished items.

Separately, the deep preset also carried MaxTurns: 50, identical to the default. Its description promises "a larger turn budget," but on the turn-budget axis it was no different from a normal run.

Fix

  • defaultMaxTurns: 50 to 80 (internal/config/resolver.go). This is the budget most runs use, including the interactive TUI and plain zero exec, so it is the change that addresses the reported case.
  • deep preset MaxTurns: 50 to 160 (internal/modelregistry/modes.go), so deep is a genuine 2x the default again.

Both remain overridable per-session with /turns or --max-turns, still bounded by MaxTurnsCeiling (500). Precedence is unchanged: an explicit --max-turns still wins over a mode preset.

Testing

  • go build ./...
  • go test ./internal/config/... ./internal/modelregistry/...

Summary by CodeRabbit

  • Improvements
    • Increased the default tool-turn budget per run from 50 to 80.
    • Increased the maximum turns available in the deep mode from 50 to 160.
    • You can still adjust the per-session turn limit using /turns.

The default per-run tool-turn budget of 50 was still too low for larger
multi-step tasks that span several files: agents hit the ceiling and
stopped with a "remaining work" summary instead of finishing. Raise the
default from 50 to 80.

The "deep" preset also carried MaxTurns: 50, identical to the default, so
its "larger turn budget" promise no longer held on the turn-budget axis.
Raise it to 160 so deep runs get a genuinely larger budget again.

Users can still override per-session with /turns or --max-turns (bounded
by MaxTurnsCeiling).
@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 6284982c-62dd-482a-a949-abc453c3bcb9

📥 Commits

Reviewing files that changed from the base of the PR and between 35ceaa4 and e144d24.

📒 Files selected for processing (1)
  • internal/cli/exec_test.go

Walkthrough

The per-run default tool-turn budget increases from 50 to 80, while the deep mode preset increases from 50 to 160. The configuration comment and CLI test expectation are updated accordingly.

Changes

Turn Budget Defaults

Layer / File(s) Summary
Update tool-turn limits and validation
internal/config/resolver.go, internal/modelregistry/modes.go, internal/cli/exec_test.go
The general default increases to 80 turns, the deep preset’s MaxTurns increases to 160, and the CLI test expects the updated value.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

  • Gitlawb/zero#349: Earlier changes to per-run tool-turn defaults and turn-resolution behavior.

Suggested reviewers: anandh8x, Vasanthdev2004

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately summarizes the main change: increasing the default and deep-mode turn budgets.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@internal/modelregistry/modes.go`:
- Line 42: Update the deep mode assertion in the relevant test in exec_test.go
to expect overrides.MaxTurns (gotMaxTurns) to equal 160 instead of 50, matching
the deep preset’s MaxTurns value and applyExecMode behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 073a9baa-fea6-4ad0-a830-aa3988cded9d

📥 Commits

Reviewing files that changed from the base of the PR and between 1af5882 and 35ceaa4.

📒 Files selected for processing (2)
  • internal/config/resolver.go
  • internal/modelregistry/modes.go

Comment thread internal/modelregistry/modes.go

@Vasanthdev2004 Vasanthdev2004 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tiny and clean — just bumping two constants. defaultMaxTurns goes 50 -> 80 and deep-mode MaxTurns 50 -> 160, both still well under the MaxTurnsCeiling=500 clamp, so there's no unbounded-loop risk; the diff is constants-only with no control-flow change, and the exec_test assertion was updated to match. Builds, vet, and gofmt are clean, and the config/modelregistry packages plus the updated cli test all pass (the remaining cli failures are the pre-existing "provider anthropic requires model" noise that reproduces on main). Approving.

@kevincodex1 kevincodex1 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.

LGTM

@kevincodex1
kevincodex1 merged commit 635c93a into Gitlawb:main Jul 13, 2026
7 checks passed
@euxaristia
euxaristia deleted the fix/raise-default-turn-budget branch July 17, 2026 21:05
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.

3 participants