feat(p16): --max-rounds/--max-tokens -- the cap on a PAID run had no operator door

B2's free drill earned its keep on the first command. STATE.md, docs/2026-09-12-p14-kontekstsett.md
and the order all publish the same stress command ending "--max-rounds 8 --max-tokens 120000".
Measured: run.py accepts neither, all four --live-dry-run drills refused with "unrecognized
arguments", and main() never passed max_rounds/max_tokens to run_project at all -- so every CLI run
ever made was silently bound to _DEFAULT_MAX_ROUNDS=3 / _DEFAULT_MAX_TOKENS=100_000, with no way to
raise or lower the cap on a run being paid for. Three surfaces described a door that did not exist.

Widening, never breaking: both flags default to exactly those values, so every existing invocation
is byte-identical. Wired to BOTH dispatches -- run_portfolio takes the same two parameters and
main() dropped them there too -- and refused by name in report mode, which returns above every
dispatch (the F4 silent-drop gap).

Load-bearing MEASURED (6 arms, ALL RED before the fix), four mutations all red, green control
1669/5 (from 1663/5, superset, 0 removed), golden BYTE-UNCHANGED (ea8c534...).

MEASURED, REPORTED, NOT FIXED: single-project mode still requires --docs-dir even when
--bundle-dir is given and docs_dir is unused on the bundle path, so the documented command would
have refused for that reason too. The README's own form works; loosening the guard is its own call.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Kjell Tore Guttormsen 2026-09-14 12:10:59 +02:00
commit 5f94c92476
4 changed files with 198 additions and 0 deletions

View file

@ -2656,6 +2656,21 @@ def main(argv: list[str] | None = None) -> int:
help="the expert's reasoning behind --decision (required with it; an expert verdict is a "
"decision AND its reasoning)",
)
parser.add_argument(
"--max-rounds",
type=int,
default=_DEFAULT_MAX_ROUNDS,
help=(
"per-run round cap (P16 B2). DEFAULTS to what every CLI run was implicitly bound to "
"before this flag existed, so nothing changes unless it is stated"
),
)
parser.add_argument(
"--max-tokens",
type=int,
default=_DEFAULT_MAX_TOKENS,
help="per-run token cap (P16 B2). Same default, same reason as --max-rounds",
)
parser.add_argument(
"--live-dry-run",
action="store_true",
@ -2819,6 +2834,11 @@ def main(argv: list[str] | None = None) -> int:
# F4 class exactly: report mode returns above every dispatch, so an omission here is a
# silent drop and not a refusal.
"--mandate": args.mandate is not None,
# P16 B2, same rung: a cap stated in report mode binds nothing, and report mode returns
# above the dispatch that would have honoured it. Distinguishable only because the
# argparse default IS the historic value, so "stated" and "omitted" differ.
"--max-rounds": args.max_rounds != _DEFAULT_MAX_ROUNDS,
"--max-tokens": args.max_tokens != _DEFAULT_MAX_TOKENS,
}
if any(report_forbidden.values()):
print(
@ -3787,6 +3807,8 @@ def main(argv: list[str] | None = None) -> int:
client_factory=scripted_client_factory,
mandate=mandate,
mcp_servers=mcp_servers,
max_rounds=args.max_rounds,
max_tokens=args.max_tokens,
)
)
except (ValueError, FileNotFoundError, ValidationError) as exc:
@ -3867,6 +3889,8 @@ def main(argv: list[str] | None = None) -> int:
if args.embedder_config
else None
),
max_rounds=args.max_rounds,
max_tokens=args.max_tokens,
outbox_dir=args.outbox_dir,
run_id=args.run_id,
prepass_payload=prepass_payload,
@ -3943,6 +3967,8 @@ def main(argv: list[str] | None = None) -> int:
if args.embedder_config
else None
),
max_rounds=args.max_rounds,
max_tokens=args.max_tokens,
outbox_dir=args.outbox_dir,
run_id=args.run_id,
prepass_payload=prepass_payload,