Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions docs/start.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
53 changes: 53 additions & 0 deletions tests/test_start_caps_truth.py
Original file line number Diff line number Diff line change
@@ -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()
Loading