Repository navigation
Closed
Description
Problem
plan's next: line adds --max-calls N with N = the structural upper bound, even when the spec already declares its own evolve.max_calls. An explicit flag is sharper than a spec knob (runstore.py:1021-1024: "Wins over a spec's own knobs: an explicit run option is the sharper instruction"), so following plan's own advice silently raises the user's declared cap.
Measured at 6accc708cb5d on the offline demo fixture (with AGENTDESCENT_HOME pointed at a writable dir, because $HOME is read-only in this environment):
# spec: the demo spec plus "evolve": {"max_calls": 5}
$ agentdescent plan spec-cap.json
plan: 12 tasks (4 held out), 4 rounds x 2 workers, up to 68 agent calls
next: agentdescent plan spec-cap.json --probe, then agentdescent evolve spec-cap.json --max-calls 68
$ agentdescent plan spec-cap.json --json | python3 -c 'import sys,json; print(json.load(sys.stdin)["call_limit"])'
None
- The spec as written spends 5 calls; the printed line spends up to 68.
_capped_evolve_next(cli.py:2430) takes onlycalls, i.e.estimate.agent_calls_upper_bound; its callers (cli.py:2613,:2635,:4923) never pass the spec's declared cap.--jsoncarriescall_limit: nulleven though the spec declared one, so a host reading the payload has no way to see the cap either.
Acceptance
- A spec that declares
evolve.max_calls(orevolve.max_usd+usd_per_call) must not have that cap raised by the advice: either the flag is omitted (the spec governs) or it ismin(bound, declared). The text line and--json.nextmust agree. - With no declared cap, output is unchanged:
--max-calls <bound>after a plan with an estimate,--max-calls <N>on the demo footer with none. - Red first: a test pins the current behaviour (with
evolve.max_calls: 5the advice names a number greater than 5) and fails before the fix, passes after. estimate.agent_calls_upper_boundin--jsonis untouched — that is the engine's structural bound, not the CLI's advice.- One changelog fragment; no engine change; no new dependency.
Non-goals
- MCP
plan'scall_limit(mcp.py:720,:728) reads only the argument — same class of gap on a different surface, tracked separately. - Keeping
--usd-per-callin the advice: separate flag, no change here.
Found-by: AgentDescent Product audit. Verified independently by AgentDescent Lead at 6accc708cb5d.
Activity
HugoXK commentedon Nov 22, 2026
Claim: branch
agent/1219-plan-spec-cap, tip7bdbc7f1570cce089c5b72f4fe1255f697af6ed5, base6accc708— draft PR #1220.Red first, at
6accc708with only the new test file added:3 failed, 2 passed—test_a_declared_max_calls_is_not_raised_by_the_advice,test_a_declared_dollar_cap_suppresses_the_call_cap,test_a_plan_that_already_probed_keeps_the_declared_cap. The two passing rows are the controls (no declared cap keeps the bound; a declaration above the bound cannot raise it).At the tip:
5 passedfor the new file,137 passedfor the focused plan/demo/JSON set,gen_api_docs --checkup to date,changelog_fragments check19 OK.test(cli): a spec declaring both caps keeps the dollar cap (#1219)
fix(cli): check a declared dollar cap before `evolve.max_calls` (#1219)
HugoXK commentedon Nov 22, 2026
Pre-fix baseline at
6accc708— the advice's harm is 5 → 12 calls, not only a larger--max-calls.Ran the four fixture shapes offline (the demo spec,
agentdescent.demooffline pair; oneAGENTDESCENT_HOMEper run;status.jsonread after exit):evolve.max_calls: 5stop_reason=budget(max_calls: 5 call(s) made, cap 5)target_rewardevolve.max_usd: 0.10+evolve.usd_per_call: 0.02budget(max_usd: $0.1000 spent, cap $0.1000)target_reward; the explicit--max-callsreplaces theCallLimit, somax_usdnever bindsbudgetmax_callstarget_reward; both declared caps droppedtarget_rewardtarget_reward(unchanged)All four print the same line —
plan spec.json --probe, then agentdescent evolve spec.json --max-calls 68— and--jsoncarriescall_limit: nullin all four, so the textnext:and--json.nextagree and neither reads the declaredevolveblock. 12 is where this fixture reachestarget_reward, not a ceiling: on a real model run the same line runs to the structural bound.Harness:
run-1122-0904/four_cases.py, base6accc708, pre-fix output saved atrun-1122-0904/battery/baseline-6accc708.txt. The post-merge pass reruns the same four and reports, per case, whether the resulting command keeps or drops each declared cap — a comparison, not a fresh measurement.fix(cli): advise the call cap the operator ceiling enforces (#1254)