Repository navigation
Closed
Labels
area:cliThe agentdescent command line (cli.py, doctor, plan/evolve/status/apply)The agentdescent command line (cli.py, doctor, plan/evolve/status/apply)area:evolveThe evolve loop: evolution, async_evolve, aggregator, population, policies, strategiesThe evolve loop: evolution, async_evolve, aggregator, population, policies, strategiesarea:runstoreRun store, ledger, checkpoint, resume and replayRun store, ledger, checkpoint, resume and replayenhancementNew feature or requestNew feature or request
Description
Slice of #963 (the other three parts are already delivered: nested refusal #1080, MCP write confinement #985, CLI write dirs #1087). This is the budget half, narrowed to what a run can actually enforce offline.
Problem
A host worker (dsh-superagent Executor Session, Claude Code, Codex, DSH) can start an evolution run that spawns many workers/calls. Today the budget knobs are partly there — max_seconds exists, and budget_usd only produces an overshoot warning between rounds (evolvespec.budget_round_overshoot_warning) — but nothing stops a run that keeps calling. Measured on main: max_calls, max_usd and max_tokens appear 0 times in runners.py and 0 times as enforced knobs in evolvespec.py. So "the run spends without a cap" is still true.
Scope (one slice)
- Accept
max_callsandmax_usdas run-level limits (spec/knob + CLI flag), validated: non-negative numbers,0meaning "no calls/spend at all", a bad value refused with one readable message. - Enforce both inside the run: the runner counts calls and accumulates usd per call; when either limit would be exceeded the next call is not made, the round winds down normally (no traceback, no half-written artifact) and the run records
stop_reasonnaming the limit that fired (budget), plus which one and the observed value. - Surface it where a reader looks first: the run's
status.jsonandagentdescent statusoutput carry the stop reason; a capped run is not reported as a success. max_concurrencyis not in this slice; it stays in feat(mcp): host-worker guard — nested-run refusal, write-dir confinement, per-Ticket budget #963.
Acceptance criteria
- With
max_calls: 1against a fake worker that would call 5 times: exactly 1 call happens, the run ends,status.jsonhasstop_reason= the budget reason, andagentdescent statusprints it. No traceback, exit code documented in the help text. - With
max_usdbelow the cost of a second call: the second call does not happen, same record shape. - A run that finishes under both limits keeps
stop_reasonas it is today (no behaviour change when unset). - A negative or non-numeric value is refused at spec validation with a message naming the field and the value.
- Offline tests, deterministic, no new dependency, no network, no sandbox.
Non-goals
- No per-Ticket accounting store across runs, no controller/claim interaction, no change to how a run is merged or reviewed.
Partial: #963
Metadata
Metadata
Assignees
Labels
area:cliThe agentdescent command line (cli.py, doctor, plan/evolve/status/apply)The agentdescent command line (cli.py, doctor, plan/evolve/status/apply)area:evolveThe evolve loop: evolution, async_evolve, aggregator, population, policies, strategiesThe evolve loop: evolution, async_evolve, aggregator, population, policies, strategiesarea:runstoreRun store, ledger, checkpoint, resume and replayRun store, ledger, checkpoint, resume and replayenhancementNew feature or requestNew feature or request
Activity
HugoXK commentedon Nov 19, 2026
Claim:
agent/1166-budget-guard-> one PR againstmain,maintainer_can_modify: true. Owner on the board: AgentDescent Dev-1.Scope is the two limits in the body (
max_calls,max_usd) enforced inside the run with a namedstop_reason;max_concurrencyand any cross-run accounting stay in #963. Acceptance is checked row by row at the named tip, and the PR carriesPartial: #963so the parent is not closed by this slice.test(run): pin the status.json shape and document the new cap knob (#…
fix(run): refuse a run-level call cap on the async path (#1166)
fix(run): a cap refused inside a rollout is a stop, not a failure (#1166
Merge origin/main into agent/1166-budget-guard
feat(mcp): cap a run from the MCP surface -- `plan` and `start` take …
fix(cli): `--json evolve` and `--json show` report `stop_detail` (#1190…