Repository navigation
Description
Summary
The default subagent turn budget — defaultChildLimits.MaxTurns = 12 (engine/agent/subagent.go:182) — is too low. Subagents repeatedly exhaust it mid-task and stop without producing a result. A survey of comparable AI coding clients shows 12 sits below even general-purpose tool-calling SDK defaults, and far below coding-specific agents. Recommendation: double the main-session budget (50/200 → 100/400) and set subagents to half the new main (12/40 → 50/200), leaving MaxRunTokens as the real cost brake.
Problem
Current defaults (engine/agent/subagent.go:182-185):
var defaultChildLimits = session.Limits{
MaxTurns: 12,
MaxToolCalls: 40,
MaxConsecutiveFailures: 3,
}vs the main session (internal/app/build.go:78-79): MaxTurns: 50, MaxToolCalls: 200.
Observed live (Opus panel review): a Spec-adherence reviewer subagent ran 1m 8s · ↑173.9K input tokens · 12 tools and terminated stop:max-turns → (subagent produced no summary). It spent its entire 12-turn budget fetching the PR diff and never reached the review. This is the reported, recurring symptom — "my subagents keep hitting their max turns."
The comment calls the 12-turn cap "deliberately tight ... a subagent is a one-shot, focused investigation: it must not run away." That intent is right, but the value is mis-calibrated: a realistic read-only review arc (fetch diff → read N files → reason → report) is 20-40 turns, so 12 fails the common case rather than just catching runaways.
Field survey (default agent-loop turn/iteration caps)
Researched defaults across frontier and OSS coding agents:
| Client | Default turn/iteration cap | Notes |
|---|---|---|
| OpenAI Agents SDK | 10 (DEFAULT_MAX_TURNS) |
strictest; general-purpose, not coding-specific |
| mecatl subagent (today) | 12 | below the general-purpose floor |
LangChain AgentExecutor |
15 (max_iterations) |
general-purpose; known to trip on real repo tasks |
| Cursor agent | 25 tool-call checkpoint | soft "Continue" prompt; 200 in Max mode |
| GitHub Copilot (IDE agent) | 25 requests/turn | chat.agent.maxRequests, up to 100 |
| Copilot coding agent (cloud) | wall-clock 59 min | no step count |
| OpenHands | 500 (max_iterations) |
coding-specific |
| Goose (Block) | 1000 (DEFAULT_MAX_TURNS) |
coding-specific |
| Cline / Roo Code | unlimited (allowedMaxRequests) |
secondary maxConsecutiveMistakes=6 |
| AutoGPT | math.inf |
continuous mode |
| SWE-agent | disabled | cost-bound (per_instance_cost_limit=$3) |
| Claude Code / Anthropic Agent SDK / OpenAI Codex | no hard cap | budget-bound; docs cite max_turns=30 as a typical production value |
Read: the only defaults at/below 12 are general-purpose SDKs (OpenAI Agents 10, LangChain 15). Every coding-specific agent is either uncapped (relying on a cost/token budget) or generous (500-1000). The prevailing pattern is no hard turn cap, with a token/cost budget as the primary brake — and a turn cap, where present, as a runaway-loop guard set well above the common-case arc.
Why mecatl can safely raise it
mecatl already has the correct primary brake: Deps.MaxRunTokens / StopBudget — a cumulative token ceiling inherited by every child engine (childEngineDepsForProvider does not clear it), plus per-call tighten-only max_tokens. So the turn cap is NOT the cost limiter here; the token budget is. That means the turn cap's only job is to stop a genuinely runaway loop, which it can do from a much more generous value.
Recommendation
Double the main-session budget, then set subagents to half of the new main:
Main session (internal/app/build.go:78-79):
defaultMaxTurns = 100 // was 50
defaultMaxToolCalls = 400 // was 200Subagent (engine/agent/subagent.go:182-185) — half the new main:
var defaultChildLimits = session.Limits{
MaxTurns: 50, // was 12 (= half of new main's 100)
MaxToolCalls: 200, // was 40 (= half of new main's 400)
MaxConsecutiveFailures: 3, // unchanged
}Rationale:
- Keeps the deliberate "subagents are tighter than the parent" relationship (exactly half), while giving a subagent a realistic budget for fetch → read → reason → report.
- The new main (100 turns) moves toward the "generous / budget-bound" posture of coding-specific agents and Anthropic's own no-hard-cap default; the new subagent floor (50) matches the current main-session value, which has not been reported as too low.
MaxRunTokensremains the binding cost ceiling, so this does not risk cost blowout — it just stops failing the common case.
Per-call subagentArgs.MaxTurns / WithChildLimits stay tighten-only, so an operator can still clamp specific subagents lower; this only moves the floor when nothing is specified.
Complementary (not a substitute)
This pairs with the two sibling findings — raising the cap alone is not the whole fix:
- the subagent-max-turns-no-summary issue (salvage partial output on a
max-turnsstop; parent should inline context it already holds so children don't re-fetch), - and the agency issue Spurious GPT-5.5 refusal: OpenAI adapter drops the Responses API
phasefield #46 / its Opus sibling (model announces fan-out but doesn't act).
Together: inline context + a realistic turn budget + salvage-on-stop.
Found via a field survey (two research agents) on 2026-06-11.
Activity