Skip to content

fix(cli): advise the call cap the operator ceiling enforces - #1254

Merged
Birfy merged 4 commits into
mainfrom
agent/1252-plan-ceiling-advice
Nov 24, 2026
Merged

Birfy merged 4 commits into
mainfrom
agent/1252-plan-ceiling-advice

Conversation

@HugoXK

@HugoXK HugoXK commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #1252.

What changed

plan's next: and --json.next now name the smallest of the structural bound, the spec's declared cap (#1219) and the call cap the run will actually enforce, so a 2-call AGENTDESCENT_MAX_CALLS ceiling no longer produces --max-calls 11 with warnings: []; when the ceiling lowers the advice, warnings says so (AGENTDESCENT_MAX_CALLS=2 caps this run at 2 calls; the plan estimates 11), and a malformed ceiling is the config answer evolve would raise instead of a traceback. The MCP face: a spent Ticket makes Tools.plan refuse in start's exact sentence and bytes, instead of answering ok: true with max_calls: 0. Reporting only — estimate.agent_calls_upper_bound, call_limit's numbers, enforcement and every stop reason are untouched, and an uncapped plan's text and JSON do not change.

Not a goal: algorithms run's own next: (the issue names the plan surface) and any change to what is enforced.

Draft: #1238 and #1250 are the two ready PRs in the owner-click queue.

Verification at the tip

Tip SHA: 7917e76
Ran:

  • red first at 22ea7528915a761c579dc4c7f47d8444c159cd8a: new tests/test_plan_advice_ceiling.py → 5 failed, 3 controls passed (assert 'agentdescent…--max-calls 11' == 'agentdescent…--max-calls 2')
  • tests/test_plan_advice_ceiling.py → pass (8 passed; 14 passed with the fix(cli): plan's next line must not raise a cap the spec already set #1219 rows)
  • plan/CLI family (test_plan_next_respects_spec_cap, test_plan_text_output, test_plan_probe, test_plan_headroom_shape, test_first_run_caps, test_cli_algorithms_run, test_demo) → pass (136 passed)
  • Ticket/cap family (test_mcp_ticket_cap, test_mcp_call_limit, test_mcp_ticket_remainder_label, test_operator_run_cap, test_mcp) with test_changelog_fragments and test_api_reference → pass (164 passed)
  • python -m tools.changelog_fragments check → 33 changelog fragment(s) OK
  • python -m tools.gen_api_docs --check → docs/api.md is up to date
  • pytest -q (full suite at this tip) → 21 failed, 8085 passed, 51 skipped, 526 warnings in 2005.70s (0:33:25); the 21 are the four known environment files only (test_sandbox_container.py 12, test_era_srbench.py 6, test_genesis_example.py 2, test_wheel_smoke.py 1), the same set the base run produces, and none of them touch cli.py, mcp.py or the new test file
    Not run:
  • mkdocs build --strict → not applicable (no docs change)
  • wheel smoke / real-model check → not needed for a reporting-only change

Correction (appended; tip unchanged)

The plan/CLI family bullet above names seven files and reports 136 passed; those seven files alone are 128. The 136 was the same run with the new file's 8 rows added, so the bullet counted tests/test_plan_advice_ceiling.py a second time. Seven-file figure: 128 passed. Every other number in the evidence block measures as written.

Correction, closing the stale sha (append-only; nothing above changes): the Tip SHA: line above is not the reviewed head — review request 7129820256 named the live head 29b2a1ec3e9fb9f07da0f68f02606ee624898ba9. The plan/CLI family bullet's 136 is those seven files' 128 plus the new file's 8; --collect-only gives 128 at both 7917e762 and 29b2a1ec. Every other number and section stands as written.

@HugoXK HugoXK added bug Something isn't working area:plugins Host plugins and installers: Claude Code, Codex, DSH, OpenCode, MCP server area:cli The agentdescent command line (cli.py, doctor, plan/evolve/status/apply) labels Nov 24, 2026
HugoXK and others added 4 commits November 24, 2026 05:38
`plan` builds `next: --max-calls N` from the structural bound and the spec's
declared cap, but never consults `AGENTDESCENT_MAX_CALLS`, which
`runstore.launch` (and the MCP `start`) clamps to: with a 2-call ceiling the
advice names 11 and the first run it recommends stops at 2. The MCP face is
the Ticket remainder: a spent Ticket made `plan` answer `ok: true` with
`max_calls: 0` while `start` refused in one sentence.

Red at 22ea752: 5 failed, 3 controls passed.
`plan` sized `--max-calls` from the structural bound and the spec's declared
cap only, so with `AGENTDESCENT_MAX_CALLS=2` it advised 11 calls for a run
`runstore.launch` clamps to two. Name the smallest of those two and the
enforced ceiling, and say in `warnings` which number the ceiling enforces; a
malformed ceiling is the config answer `evolve` would raise. The MCP face: a
spent Ticket makes `plan` answer with `start`'s own refusal instead of
`ok: true` with `max_calls: 0`. Enforcement, the estimate and every stop
reason are untouched.
…ecessary

`_advised_cap` returns before the dollar case, so the declared number it reads
is always an int; spell that with the min() instead of a directive this repo
does not run.
@HugoXK

HugoXK commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator Author

State change in this turn: draft true → false on this PR (GraphQL markPullRequestReadyForReview). Reason: the review set at the live head is complete and the ready queue needs a second card.

Live head 29b2a1ec3e9fb9f07da0f68f02606ee624898ba9, base 28ded70d8cf7063f0abf2b07e20921316d28430e, mergeable: CLEAN.

29b2a1ec is a merge of main into 7917e762, so the change under review is that tip's diff — nothing new was added after it. All ten checks are complete and none is failing.

One correction to the body, which follows in a separate append-only edit by its author: the plan/CLI family is 128 passed, not 136 — 136 counted the new test file's 8 a second time. Everything else in the body's evidence block measures as written.

The body's Tip SHA: line is superseded by this comment.

@HugoXK
HugoXK marked this pull request as ready for review November 24, 2026 11:13
@HugoXK

HugoXK commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator Author

Review request at head 29b2a1ec3e9fb9f07da0f68f02606ee624898ba9, base 28ded70d8cf7063f0abf2b07e20921316d28430e.

29b2a1ec is a merge of main into 7917e762, so the change is that tip's. What was verified at this head, in case it saves you a run:

  • tests/test_plan_advice_ceiling.py — 8 passed.
  • The seven-file plan/CLI family — 128 passed. The body's 136 is wrong: it counted the new test file's 8 twice. --collect-only gives 128 at this head and 128 at 7917e762, and all 128 pass. The body gets an append-only correction; the behaviour numbers in it are right.
  • Behaviour, same spec, AGENTDESCENT_MAX_CALLS=2: base prints next: … --max-calls 11 with warnings: []; this head prints next: … --max-calls 2 and warnings: ['AGENTDESCENT_MAX_CALLS=2 caps this run at 2 calls; the plan estimates 11'], with estimate.agent_calls_upper_bound still 11 — the ceiling is advised without rewriting the estimate.
  • Uncapped plan, no ceiling set: text and JSON identical between base and this head (2765 bytes each, tmp path normalised), so the new advice cannot perturb a run that has no cap.

No UI surface: plan's terminal advice and --json text only. All ten checks on 29b2a1ec are complete and none is failing.

@github-actions github-actions Bot added risk:T3 Risk tier T3 (core loop, release, process; needs Danyang's click), set by the controller agent-pr Pull request opened by an agent labels Nov 24, 2026
@HugoXK

HugoXK commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator Author

Body edit, no push: the plan/CLI family bullet names seven files and reports 136 passed; those seven alone are 128, since 136 = 128 + 8 counts the new test file's rows a second time. Appending one correction that names 128; Tip SHA: and the rest of the evidence block stay as written.

@HugoXK

HugoXK commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator Author

Body edit, no push. The 128 correction already landed on this body (comment 7129877511), so this edit adds no second correction section: it appends one closing line only — the body's Tip SHA: is stale, review request 7129820256 named the live head 29b2a1ec…, and the seven-file plan/CLI total is 128 passed (--collect-only at both 7917e762 and 29b2a1ec; 136 = 128 + 8). Every section above stays exactly as it is.

@Birfy

Birfy commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

Review (Birfy)

Tip SHA: 29b2a1e
Ran:

  • .github/scripts/risk_gate.py --repo ThinkFlowLab/agentdescent --pr 1254 → T3 (size 326 lines / 4 files > 250 / 12 allowed for T2)
  • pytest -q -o addopts='' tests/test_plan_advice_ceiling.py at this tip → 8 passed
  • python -m tools.changelog_fragments check → 37 changelog fragment(s) OK
  • python -m tools.gen_api_docs --check → docs/api.md is up to date
  • Required CI at this tip (build, test 3.9–3.13) → SUCCESS
    Not run:
  • Full offline suite locally — the CI test matrix is the line
    Findings:
  • No actionable defects. plan's next: and --json.warnings now name the smallest of the structural bound, the spec's declared cap, and the operator ceiling, and a spent Ticket makes MCP plan refuse in start's exact sentence. Estimate and enforcement are unchanged.
    Verdict: PASS

@Birfy
Birfy merged commit f1dcbe6 into main Nov 24, 2026
12 checks passed
@Birfy
Birfy deleted the agent/1252-plan-ceiling-advice branch November 24, 2026 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-pr Pull request opened by an agent area:cli The agentdescent command line (cli.py, doctor, plan/evolve/status/apply) area:plugins Host plugins and installers: Claude Code, Codex, DSH, OpenCode, MCP server bug Something isn't working risk:T3 Risk tier T3 (core loop, release, process; needs Danyang's click), set by the controller

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cli: plan's next: names a call cap the operator ceiling will clamp away

2 participants