Repository navigation
Description
Implementation: AgentDescent (ours) — do not pick up; the pair PR is dispatched separately.
plan names a call cap the operator ceiling will clamp away: with AGENTDESCENT_MAX_CALLS=2 and a 52-call estimate it prints up to 52 agent calls and next: … --max-calls 52 with warnings: [], so the first run a user starts from that line stops after two calls. #1219 fixed this class for a cap the spec declares (_declared_cap, cli.py:2430); the ceiling is consulted nowhere on the advice path, even though start already clamps to it and names it.
Measured at eb9acd5e8e417241cec2a60517c7f89272b0d5be, fresh clone, AGENTDESCENT_HOME inside the run dir, spec = tests/test_evolvespec.py::_dir_spec (12 tasks, 4 held out, 3 rounds x 2 workers, estimate upper bound 52); CLI rows through python3 -m agentdescent.cli:
$ AGENTDESCENT_MAX_CALLS=2 python3 -m agentdescent.cli plan plain.json
plan: 12 tasks (4 held out), 3 rounds x 2 workers, up to 52 agent calls (no $ estimate: pass --usd-per-call)
next: agentdescent plan plain.json --probe, then agentdescent evolve plain.json --max-calls 52
$ AGENTDESCENT_MAX_CALLS=2 python3 -m agentdescent.cli plan plain.json --json
"warnings": []
$ AGENTDESCENT_MAX_CALLS=2 python3 -m agentdescent.cli plan capped10.json
plan: 12 tasks (4 held out), 3 rounds x 2 workers, up to 52 agent calls (no $ estimate: pass --usd-per-call)
next: agentdescent plan capped10.json --probe, then agentdescent evolve capped10.json --max-calls 10
# capped10.json = the same spec plus "evolve": {"max_calls": 10}
$ python3 -m agentdescent.cli plan plain.json
plan: 12 tasks (4 held out), 3 rounds x 2 workers, up to 52 agent calls (no $ estimate: pass --usd-per-call)
next: agentdescent plan plain.json --probe, then agentdescent evolve plain.json --max-calls 52
# control, no ceiling: stdout and stderr byte-identical to the ceiling row
Following the first row's own advice:
$ AGENTDESCENT_MAX_CALLS=2 python3 -m agentdescent.cli evolve plain.json --max-calls 52 --json
# rc 0, state "done", two calls spent
stop_reason: 'budget'
stop_detail: 'max_calls (AGENTDESCENT_MAX_CALLS): 2 call(s) made, cap 2'
$ AGENTDESCENT_MAX_CALLS=2 python3 -m agentdescent.cli status 20261124-051650-fbfe15
20261124-051650-fbfe15 done round 0/3 calls=2 best=0.000 skill_dir:… [budget: max_calls (AGENTDESCENT_MAX_CALLS): 2 call(s) made, cap 2]
Same root, second face — the Ticket remainder is known before the run, and the tool surface still reports success with no warning. Ceiling 2, Ticket spent (spent: 2, remaining: 0):
Tools.plan(spec, max_calls=5) -> ok: true
call_limit: {"max_calls": 0, "max_calls_requested": 5, "max_usd": null, "source": "AGENTDESCENT_MAX_CALLS", "ticket": {"ceiling": 2, "remaining": 0, "spent": 2}}
warnings: []
estimate.agent_calls_upper_bound: 52
Tools.start(spec, max_calls=5) -> ok: false
error: AGENTDESCENT_MAX_CALLS=2 is already spent by this worker's Ticket (2 calls over 1 run); no run may start. Start the next Ticket in a new server session, or raise the ceiling.
Add the enforced cap to the advice:
plan'snext:line and--json.nextnever name a call cap above the enforced one: the smallest of the requested number, the spec's declared cap (fix(cli): plan's next line must not raise a cap the spec already set #1219) and whatstartwould enforce (Ticket remainder, operator ceiling);- when the ceiling or the remainder lowers the advice,
warningsnames the enforced number and its source (e.g.AGENTDESCENT_MAX_CALLS=2 caps this run at 2 calls; the plan estimates 52), so the humanplanprints it aswarning: …and--jsoncarries it; Tools.planwhen the Ticket remainder is 0 returnsok: falsewith_ticket_refusal's exact sentence, the same bytesstartgives, instead ofok: truewithmax_calls: 0;- enforcement is untouched:
estimate.agent_calls_upper_bound,call_limit's numbers and every stop reason stay exactly as they are; no model or network call.
Anchors at eb9acd5e: _declared_cap cli.py:2430, _capped_evolve_next cli.py:2456, plan_payload cli.py:2306, Tools.plan mcp.py:919, _ticket_refusal mcp.py:608.
Acceptance: a 2-call ceiling with a 52-call estimate never prints --max-calls 52, and names 2 in warnings and in --json.next; a spec that declares 10 still yields --max-calls 10 and adds no warning while the ceiling is above it; a spent Ticket makes Tools.plan refuse in start's exact sentence; an uncapped run's plan text and JSON stay byte-identical to today; a test fails on main first; docs/changelog.
Activity
HugoXK commentedon Nov 24, 2026
Claim: AgentDescent Dev-1 · base
22ea7528915a761c579dc4c7f47d8444c159cd8a· branchagent/1252-plan-ceiling-advice.Red test at that base, new
tests/test_plan_advice_ceiling.py(5 failed, 3 controls passed):assert 'agentdescent…--max-calls 11' == 'agentdescent…--max-calls 2'— the advice still names the structural bound while the ceiling is 2. Draft PR follows.fix(cli): advise the call cap the run will actually enforce (#1252)