Repository navigation
Description
Motivation
The default session budgets are tuned for interactive use and are too tight for the headless, autonomous path (mecatequi solving a GitHub issue end-to-end). A real run hit the wall: a mecatequi run on a non-trivial atrium issue spent ~14 min exploring the codebase, reached turn 100 (stop=max_turns), and produced no patch — and because it was also near the 15-min wall-clock, both ceilings bit at once. The honest-failure path then mislabeled it (separate bug, filed elsewhere), but the root cause is the budget.
How we compare to other coding agents (turn = one LLM round-trip)
| Agent | Default turn cap |
|---|---|
| LangChain AgentExecutor (interactive) | 15 |
| mecatl (today) | 100 |
| Gemini CLI | 100/stream (+ unlimited session) |
| OpenHands (autonomous issue→PR, closest analog) | 500 |
| Goose | 1000 |
| Claude Agent SDK / Codex CLI | no cap (token-bounded) |
The agents that cap low all keep a human in the loop to click "continue." A headless agent has nobody, so it belongs with the autonomous crowd (OpenHands 500, Goose 1000), not the interactive one. We want to match Goose at 1000.
Proposed changes
All three constants live in internal/app/build.go:83 and feed defaultLimits() (build.go:~4750), shared by mecatequi, mecated, and mecatui via service.go's zero-Limits substitution.
-
defaultMaxTurns100 → 1000 — match Goose. -
defaultMaxToolCalls400 → 4000 — this must move with the turn cap. Today the ratio is 4 tool-calls/turn (400/100). If turns go to 1000 but tool-calls stays at 400, tool-calls becomes the new binding cap at ~turn 400 and the turn increase is mostly inert. Keeping the 4:1 ratio (→ 4000) preserves the intent. (Open to a different multiplier — 4:1 is just today's ratio held constant.) -
Leave
defaultMaxConsecutiveFailuresat 5. That's a distinct safety mechanism (it catches a stuck/erroring loop, resets on success); raising it would let a broken run thrash longer. Out of scope.
Timeout — two coupled ceilings, raise both
A bigger turn budget is useless if wall-clock kills the run first. The headless path has two timeouts that must move together (agent timeout strictly below job timeout, or the job SIGKILLs the binary mid-run with no summary):
- Agent
--timeout— default15mon the composite action (.github/actions/mecatequi/action.yml) and the reusable-workflow input (.github/workflows/mecatequi-reusable.yml). Propose30m–40mdefault for the headless path. - Reusable-workflow
implementjobtimeout-minutes: 20— must exceed the agent timeout. Propose45m(agent 40m < job 45m).
(Consumers can already override the agent timeout via the reusable-workflow input; this is about the default so the out-of-the-box headless experience isn't artificially fenced.)
Notes / scope
- All three binaries share the constants, so the turn/tool-call change is one edit in
build.go. The timeout change is in mecatl's.github/(reusable workflow + action defaults), not the binary. - The field trend is to bound by tokens/cost rather than turns (SWE-agent uses a $/instance budget; Codex/Claude SDK don't cap turns).
--max-run-tokensalready exists for that. Raising the turn/tool-call caps + timeout is the minimal fix; a follow-up could make tokens the primary bound and keep turns as a high runaway-loop backstop. Not required here. - Possible related follow-up (not required for this issue): expose
--max-turnsas a flag on mecatequi + a reusable-workflow input, mirroring mecated's existing per-requestLimits.max_turnsoverride. Mentioned for completeness.
Found via
mecatequi headless run on a real atrium issue hitting both stop=max_turns (100) and the 15-min wall-clock.
Activity
Merge pull request #83 from stacklok/mecatequi-headless-timeout-defaults