Skip to content

feat(config): Add configurable maxTurns with default of 50#47

Merged
gricha merged 1 commit intomainfrom
feat/configurable-max-turns
Jan 30, 2026
Merged

feat(config): Add configurable maxTurns with default of 50#47
gricha merged 1 commit intomainfrom
feat/configurable-max-turns

Conversation

@gricha
Copy link
Member

@gricha gricha commented Jan 30, 2026

Summary

  • Add maxTurns config option to warden.toml at both defaults and per-trigger levels
  • Increase default from 5 to 50 to prevent error_max_turns during thorough analysis
  • Precedence: trigger.maxTurns > defaults.maxTurns > hardcoded default (50)

Example

version = 1

[defaults]
maxTurns = 30

[[triggers]]
name = "thorough-review"
event = "pull_request"
actions = ["opened"]
skill = "security-review"
maxTurns = 100  # override for this trigger

Test plan

  • Added schema validation tests for maxTurns
  • All existing tests pass

@vercel
Copy link

vercel bot commented Jan 30, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
warden Ready Ready Preview, Comment Jan 30, 2026 6:23pm

Request Review

Copy link
Contributor

@sentry-warden sentry-warden bot left a comment

Choose a reason for hiding this comment

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

find-bugs

find-bugs: Found 1 issue (1 medium)


⏱ 69.5s · 175.6k in / 3.1k out · $0.38

options: SkillRunnerOptions
): Promise<HunkAnalysisResult> {
const { maxTurns = 5, model, abortController, pathToClaudeCodeExecutable } = options;
const { maxTurns = 50, model, abortController, pathToClaudeCodeExecutable } = options;
Copy link
Contributor

Choose a reason for hiding this comment

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

🟠 10x increase in maxTurns default may cause resource exhaustion

The default maxTurns value was increased from 5 to 50. This 10x increase could lead to significantly longer execution times and higher API costs if the analysis gets stuck in a loop or takes many iterations. While 5 turns may have been too restrictive for complex analysis, 50 turns without any timeout or cost guard could be excessive.

Suggested fix: Consider a more moderate increase (e.g., 15-20) or add a cost/time guard to prevent runaway analysis. Also consider making this configurable per-skill if different skills have different complexity needs.

Suggested change
const { maxTurns = 50, model, abortController, pathToClaudeCodeExecutable } = options;
const { maxTurns = 15, model, abortController, pathToClaudeCodeExecutable } = options;

warden: find-bugs

Allow maxTurns to be configured in warden.toml at both the defaults
level and per-trigger. This prevents error_max_turns when skills need
more agentic turns for thorough analysis.

Precedence: trigger.maxTurns > defaults.maxTurns > hardcoded default (50)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@gricha gricha force-pushed the feat/configurable-max-turns branch from 731788c to 1cc166b Compare January 30, 2026 18:22
@gricha gricha merged commit b4503ea into main Jan 30, 2026
13 checks passed
@gricha gricha deleted the feat/configurable-max-turns branch January 30, 2026 18:31
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