You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add cheap hard limits per task: a maximum number of turns and a maximum cost/token budget, instead of complex stuck-detection (see Harness Engineering, Part 4: "skip stuck-detection machinery, but ship cheap caps").
Behavior
First check what already exists on main (step/turn limits, usage tracking, pricing) and extend rather than duplicate.
max_turns: stop the loop cleanly after N model turns.
Budget: max total tokens and/or max cost in USD per task from provider-reported usage; cost uses a configurable per-model price table (unknown model → token budget only, warn once).
Warn the model once at ~80% of a budget so it can wrap up; at 100%, stop cleanly with a clear message and defined exit status, recorded in output, JSON events, trajectory and OpenTelemetry if enabled.
Subagents/workers count against the parent's budget.
Flags + config keys consistent with existing patterns; sensible defaults (turn cap on, cost cap off unless set).
Tests
Turn cap stops at N.
Token budget stops the run; 80% warning injected once.
Cost computed from usage + price table.
Worker usage counts toward the parent.
Unknown model price → token budget fallback.
Do not refactor unrelated code. No CHANGELOG edits.
Slice in progress: #246 adds the token budget (--token-limit / token_limit, status TokenLimitExceeded), the one-time 80% budget warning (message + budget.warning event), and delegate/worker token accounting against the parent's budget. Step limit, cost limit with a price table, and the unpriced-model warning were already on main.
Still left for this issue:
Decide on and add a default-on turn cap (needs telling an unset step_limit apart from an explicit 0, and changes behaviour for existing configs).
Show the token limit in the --check limits line and in init-config output.
Forward --token-limit through eval, attempts and workflow stages where the other limits are forwarded.
Decision from Vic: keep the turn cap off by default (no default-on turn cap). Remaining work for this issue: show the token limit in --check output and init-config, and pass --token-limit through eval, attempts and workflow stages.
Activity
vicgupta commentedon Oct 30, 2026
Slice in progress: #246 adds the token budget (
--token-limit/token_limit, statusTokenLimitExceeded), the one-time 80% budget warning (message +budget.warningevent), and delegate/worker token accounting against the parent's budget. Step limit, cost limit with a price table, and the unpriced-model warning were already on main.Still left for this issue:
step_limitapart from an explicit 0, and changes behaviour for existing configs).--checklimits line and ininit-configoutput.--token-limitthrough eval, attempts and workflow stages where the other limits are forwarded.Merge pull request #246 from vicgupta/amf/issue-236
vicgupta commentedon Oct 30, 2026
Decision from Vic: keep the turn cap off by default (no default-on turn cap). Remaining work for this issue: show the token limit in
--checkoutput andinit-config, and pass--token-limitthrough eval, attempts and workflow stages.Show the token limit in --check and init-config; forward it through e…
Merge pull request #247 from vicgupta/amf/issue-236