From 92b02d9b9f28e552eaf5752cf9cc4adbc4289e0b Mon Sep 17 00:00:00 2001 From: Dev-4 Date: Wed, 25 Nov 2026 05:00:56 +0000 Subject: [PATCH] docs: stop claiming a both-flags-off run is uncapped (#1268) start.md closed the caps section with "the run behaves exactly as before", which AGENTDESCENT_MAX_CALLS (#1181) and the MCP per-Ticket budget (#1214) made false. State the per-run clamp, keep the --max-calls 0 sentence verbatim, and put the cumulative Ticket arithmetic only in the MCP clause. Cite runstore.py:228-266, plugin-design.md:595-612 and mcp.py:440-490. --- docs/start.md | 17 +++++++++-- tests/test_start_caps_truth.py | 53 ++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+), 2 deletions(-) create mode 100644 tests/test_start_caps_truth.py diff --git a/docs/start.md b/docs/start.md index d93a675b..b3237aa0 100644 --- a/docs/start.md +++ b/docs/start.md @@ -134,8 +134,21 @@ agentdescent evolve spec.json --max-calls 40 agentdescent evolve spec.json --max-usd 5 --usd-per-call 0.02 ``` -`--max-calls 0` is a real limit — no calls at all — not "unset". Leave both -flags off and the run behaves exactly as before. +`--max-calls 0` is a real limit — no calls at all — not "unset". Leaving both +flags off means *this command names no cap*; it does not mean the run is +uncapped. An operator who exports `AGENTDESCENT_MAX_CALLS=N` clamps every run +this process starts to `N`, including one that names no cap of its own: a +caller's `--max-calls` can lower that number but never raise it, and the clamp +is **per run**, so a second `agentdescent evolve` from the same shell gets the +ceiling again (`agentdescent/runstore.py:228-266`, `_clamped_max_calls`). + +The one place the number is spent cumulatively is a run the MCP server's +`start` launches: one worker session is one Ticket, the ceiling is handed out +once, and a second run in the same Ticket is granted only what is left. +`call_limit` then carries `ticket: {ceiling, spent, remaining}`, and a spent +Ticket refuses another `start` rather than launch a run that cannot charge a +call ([plugin design](plugin-design.md) — `docs/plugin-design.md:595-612`, +`agentdescent/mcp.py:440-490`, `_call_limit_payload`). The walkthrough that loads a dataset, calls a model, and evolves an instruction is in [Quickstart — dataset to skill](quickstart-skill.md). That path evolves a diff --git a/tests/test_start_caps_truth.py b/tests/test_start_caps_truth.py new file mode 100644 index 00000000..b2cc973b --- /dev/null +++ b/tests/test_start_caps_truth.py @@ -0,0 +1,53 @@ +"""`start.md`'s caps paragraph must not promise an uncapped run (#1268). + +The page said that leaving both flags off makes "the run behave exactly as +before" — but ``AGENTDESCENT_MAX_CALLS`` clamps every run the process starts, +including one that names no cap of its own (``runstore._clamped_max_calls``, +plugin-design's "operator ceiling on model calls", +``tests/test_operator_run_cap.py``). A reader who believes the old sentence +plans a run the environment then stops early. + +One assertion per claim, and the wrong-phrase assertion is negative: rewording +the paragraph is allowed, keeping the specific false promise is not. +""" + +from __future__ import annotations + +import re +from pathlib import Path + +REPO_ROOT = Path(__file__).resolve().parents[1] +START = REPO_ROOT / "docs" / "start.md" + +#: The sentence that is true and must survive verbatim: ``0`` is a limit, not +#: "unset" (``evolvespec._cap_value``, #1166). +ZERO_CAP_SENTENCE = ( + "`--max-calls 0` is a real limit — no calls at all — not \"unset\"." +) + +#: The false promise the page carried until #1268. +FALSE_PROMISE = "behaves exactly as before" + + +def _caps_paragraph() -> str: + """The paragraph that starts at the ``--max-calls 0`` sentence.""" + text = START.read_text(encoding="utf-8") + start = text.index("`--max-calls 0` is a real limit") + end = text.find("\n\n", start) + return text[start:end if end != -1 else len(text)] + + +def test_the_caps_paragraph_does_not_promise_an_unchanged_run(): + para = _caps_paragraph() + assert FALSE_PROMISE not in para, para + + +def test_the_caps_paragraph_states_that_no_cap_is_not_uncapped(): + para = _caps_paragraph() + assert "AGENTDESCENT_MAX_CALLS" in para, para + assert re.search(r"does not mean the run is\s+uncapped", para), para + + +def test_the_zero_cap_sentence_is_still_verbatim(): + """Control: the half of the paragraph that was already true stays as written.""" + assert ZERO_CAP_SENTENCE in _caps_paragraph()