feat: configurable max_turns via agent TOML (closes #66) - #88
Conversation
Closes jrswab#66 — Adds max_turns field to AgentConfig. Defaults to 50 when unset. Validates that negative values are rejected. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughThis PR adds an optional ChangesConfigurable Max Conversation Turns
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~25 minutes Merge Risk: ⚪ Minimal · up to Configured turn limits, the 50-turn default, and invalid-value rejection are consistently handled across the reviewed paths. No actionable merge risk remains. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Out of Scope Changes checkExplanation The README adds an Atlas Cloud provider and documents Atlas Cloud model names. This change has no demonstrated connection to issue Full details: Docstring CoverageExplanation Docstring coverage is 30.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 20 functions across 7 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Fifty turns once stood in stone, Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
internal/agent/agent_test.go (1)
172-222: 💤 Low valueOptional: Consider asserting MaxTurns defaults to 0 here.
The
TestLoad_MinimalConfigtest currently checks that optional fields are zero/nil/empty when unset. Adding an assertion like:if cfg.MaxTurns != 0 { t.Errorf("MaxTurns = %d, want 0", cfg.MaxTurns) }would document the "unset" behavior more explicitly. Not critical since zero is already validated in
TestValidate_TopLevelMaxTurnsZeroAndPositive, but it'd round out the coverage.🤖 Prompt for 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. In `@internal/agent/agent_test.go` around lines 172 - 222, Add an assertion in TestLoad_MinimalConfig to explicitly verify the default for MaxTurns is zero: check cfg.MaxTurns and call t.Errorf("MaxTurns = %d, want 0", cfg.MaxTurns) if it's non-zero; this goes inside the TestLoad_MinimalConfig function alongside the other zero-value checks (referencing cfg.MaxTurns in that test).
🤖 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.
Nitpick comments:
In `@internal/agent/agent_test.go`:
- Around line 172-222: Add an assertion in TestLoad_MinimalConfig to explicitly
verify the default for MaxTurns is zero: check cfg.MaxTurns and call
t.Errorf("MaxTurns = %d, want 0", cfg.MaxTurns) if it's non-zero; this goes
inside the TestLoad_MinimalConfig function alongside the other zero-value checks
(referencing cfg.MaxTurns in that test).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: b66ab487-cf3d-43ea-ae27-f9f53ccb38ce
⛔ Files ignored due to path filters (1)
docs/src/tools/built-in.mdis excluded by!docs/**
📒 Files selected for processing (10)
AGENTS.mdREADME.mdcmd/agents.gocmd/agents_test.gointernal/agent/agent.gointernal/agent/agent_test.gointernal/tool/tool.gointernal/tool/tool_test.gopkg/runner/run.gopkg/runner/run_test.go
Closes #66
Changes
Summary
This PR makes the agent conversation limit configurable through
max_turnsin agent TOML files. The default remains 50 turns when unset or zero. Negative values are rejected, and configured limits are displayed and enforced.Changelog
Added
max_turnstoAgentConfig.Max Turnsoutput inaxe agents show.max_turnsto the agent scaffold template.Changed
cfg.MaxTurnswith a 50-turn fallback.max_turnsand its default.max_turnssetting.Removed
TestScaffold_IncludesTopLevelTimeout, replaced by max-turns coverage.