From eabe79d072ac0281df84cd172c5055521fdd789b Mon Sep 17 00:00:00 2001 From: Branimir Georgiev <66906831+braboj@users.noreply.github.com> Date: Sat, 31 Oct 2026 21:45:09 +0200 Subject: [PATCH 1/2] feat(efficacy): run round 5d's arms at K = 15 and pin the CLI per run A run of `hand` or `short` now takes K up to 15 and builds from round 5's spec at its registered content, as a round-5 run does. `--cli` names the one CLI file every trial runs, every trial records the CLI's version, and a trial's environment turns the CLI's updater off. The CLI updated itself in the middle of round 5c; round 5d runs days later, so its trials run one pinned file instead of the launcher on PATH. Refs #89 Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01DpT5xPB8YTAMW2Msp4aPTX --- docs/architecture/06-runtime-view.md | 1 + docs/rounds/round-5d.md | 11 ++-- tests/efficacy/harness.py | 94 +++++++++++++++++++++++++--- 3 files changed, 92 insertions(+), 14 deletions(-) diff --git a/docs/architecture/06-runtime-view.md b/docs/architecture/06-runtime-view.md index 184a9ee..da95296 100644 --- a/docs/architecture/06-runtime-view.md +++ b/docs/architecture/06-runtime-view.md @@ -67,6 +67,7 @@ built. | Your global `CLAUDE.md`, hooks, memory, MCP | A scratch home and a minimal settings file | | The launching session's environment | Its variables, editor, active interpreter and credentials are removed; the names removed are recorded | | The model | Pinned by exact id; effort fixed | +| The CLI | Its updater off in every trial; its version recorded on every trial. `--cli` pins one file, so an update the launcher takes mid-round reaches no trial | | The builder's vendor | Never the judge's: each round names its builder models in its registration, none from the vendor of the rounds' judge | | The web | Web tools disallowed. The shell keeps its network, because every trial installs packages | | The templates repository | Not mounted | diff --git a/docs/rounds/round-5d.md b/docs/rounds/round-5d.md index 001f91b..67abd83 100644 --- a/docs/rounds/round-5d.md +++ b/docs/rounds/round-5d.md @@ -139,13 +139,14 @@ Done with this registration: - the harness reads `short` from its new file - the report already computes H6's contrast, `short` minus `hand`, paired, as it did for round 2 +- K up to 15 for a run of `hand` and `short`, with round 5's spec check +- `--cli` pins the CLI file every trial runs, the updater is off in every + trial, and every trial records the CLI's version; round 5d runs + `C:/efficacy/cli/claude-2.1.314.exe`, a copy of 2.1.314 kept where the + launcher's updater does not prune it -The harness and the report still gain, each with a self-test: +The report still gains, with a self-test: -- K up to 15 for a run of `hand` and `short`, with round 5's spec check; today - a run with no round-5 arm is capped at K = 5 and its spec is not checked -- the Claude CLI pinned at 2.1.314 for the round, with auto-update off and the - version recorded on every trial - round 5c's `none` trials read with their scores, judgings, security readings and tool lock, kept apart from round 5d's `none-1` to `none-3`, whose names they share diff --git a/tests/efficacy/harness.py b/tests/efficacy/harness.py index af1a902..ca8131e 100644 --- a/tests/efficacy/harness.py +++ b/tests/efficacy/harness.py @@ -80,6 +80,10 @@ ROUND5_ARMS = ("inline", "reference", "skills") ROUND5_K = 15 +# Round 5d runs `hand` and `short` under round 5's design: its K, its spec +# at its registered content, against round 5c's arms. +ROUND5D_ARMS = ("hand", "short") + # The release every generated arm is produced from, and the one the hybrid # arm's vendored templates are taken at, fixed before the first round: the # last 2.x, before the v3.0 split moves any template. @@ -338,6 +342,23 @@ class TrialError(Exception): """A trial could not be set up or run as the protocol requires.""" +# The CLI a run pins with `--cli`: one file, run as it is. The launcher on +# PATH updates itself in place, and an update in the middle of a round would +# change every trial after it without a trace in the records. +PINNED_CLI = {"path": None} + + +def cli_version(executable): + """What the CLI says its version is, as `2.1.314 (Claude Code)`.""" + proc = subprocess.run([executable, "--version"], capture_output=True, + text=True, encoding="utf-8", timeout=60) + version = proc.stdout.strip() + if proc.returncode != 0 or not version: + raise TrialError("%s did not say its version: %s" + % (executable, proc.stderr.strip()[:300])) + return version + + def agent_executable(): """The generator CLI's absolute path. @@ -345,8 +366,13 @@ def agent_executable(): command is a `.CMD` shim and `CreateProcess` resolves no extension: the run dies with "the system cannot find the file specified" before a single trial starts. Resolving it here fails with a sentence naming the - problem instead. + problem instead. A run given `--cli` uses that file and no other. """ + if PINNED_CLI["path"]: + if not os.path.isfile(PINNED_CLI["path"]): + raise TrialError("the pinned CLI %s is not a file, so no trial " + "can run" % PINNED_CLI["path"]) + return PINNED_CLI["path"] found = shutil.which("claude") if found is None: raise TrialError( @@ -954,6 +980,10 @@ def agent_environment(home, environ=None, temp=None): env["USERPROFILE"] = home env["XDG_CONFIG_HOME"] = os.path.join(home, ".config") env.update(GIT_WITHOUT_CREDENTIALS) + + # A trial never updates the CLI it runs under, so the version a run + # starts with is the one every trial records. + env["DISABLE_AUTOUPDATER"] = "1" if temp: env.update((name, temp) for name in TEMP_NAMES) return env @@ -1551,10 +1581,11 @@ def spec_digest(path): def spec_problem(arms, spec_name, digest): """Why a run of these arms may not build from this spec, or None. - A run holding a round-5 arm builds from the spec round 5 registers, at - the content it registers; any other run is not checked here. + A run holding a round-5 or round-5d arm builds from the spec round 5 + registers, at the content it registers; any other run is not checked + here. """ - if not set(arms) & set(ROUND5_ARMS): + if not set(arms) & set(ROUND5_ARMS + ROUND5D_ARMS): return None name, registered = ROUND5_SPEC if spec_name != name: @@ -1752,6 +1783,7 @@ def run_agent(workspace, name, prompt, record, root, home, options): "command": argv, "model": options.model, "effort": options.effort, + "cli_version": getattr(options, "cli_version", None), "budget_usd": options.budget, "timeout_s": options.timeout, "environment_removed": {"names": inherited_names(os.environ), @@ -1838,7 +1870,8 @@ def order(arms, k): def k_ceiling(arms): """The most blocks a run of these arms may hold.""" - return ROUND5_K if set(arms) & set(ROUND5_ARMS) else K_CEILING + return (ROUND5_K if set(arms) & set(ROUND5_ARMS + ROUND5D_ARMS) + else K_CEILING) def pending_trials(arms, k, start=None): @@ -2173,7 +2206,7 @@ def resume_checks(): except TrialError: checks.append(("--from an unknown trial refuses", True)) try: - pending_trials(arms, K_CEILING + 1) + pending_trials(["none", "hybrid"], K_CEILING + 1) checks.append(("a K past the escalation's ceiling refuses", False)) except TrialError: checks.append(("a K past the escalation's ceiling refuses", True)) @@ -2206,6 +2239,12 @@ def resume_checks(): refused = True checks.append(("a round-5 run takes K = %d and refuses more" % ROUND5_K, held == 5 * ROUND5_K and refused)) + try: + later = len(pending_trials(["hand", "short"], ROUND5_K)) + except TrialError: + later = None + checks.append(("a round-5d run of hand and short takes K = %d too" + % ROUND5_K, later == 2 * ROUND5_K)) blocked = {"outcome": "blocked", "reason": "planted", "void": {"dir": os.path.join("void", "none-1-planted")}} @@ -2404,7 +2443,8 @@ def dry_run_checks(): claude = os.path.join(stand_in, "claude.cmd" if os.name == "nt" else "claude") with io.open(claude, "w", encoding="utf-8") as handle: - handle.write("@echo off\r\n" if os.name == "nt" else "#!/bin/sh\n") + handle.write("@echo off\r\necho 0.0.0 (stand-in)\r\n" if os.name == "nt" + else "#!/bin/sh\necho '0.0.0 (stand-in)'\n") os.chmod(claude, 0o755) saved = {key: os.environ.get(key) for key in ("PATH", "HOME", "USERPROFILE")} os.environ["PATH"] = stand_in + os.pathsep + saved["PATH"] @@ -2421,6 +2461,11 @@ def dry_run_checks(): outcomes.append((task, code == 0 and os.path.isdir(os.path.join(dry, prepared)), listing(root) == before)) + recorded = [] + for run in glob.glob(os.path.join(dry, "run-*.json")): + with io.open(run, encoding="utf-8") as handle: + recorded.extend(trial.get("cli_version") + for trial in json.load(handle)["trials"]) finally: for key, value in saved.items(): if value is None: @@ -2446,9 +2491,30 @@ def dry_run_checks(): thin = handle.read() with io.open(SPEC, "rb") as handle: normal = handle.read() + + # A pinned CLI is the one file every trial runs, and a missing one stops + # the run before a trial rather than falling back to PATH's. + try: + PINNED_CLI["path"] = claude + pinned = agent_executable() == claude + PINNED_CLI["path"] = os.path.join(scratch, "missing", "claude.exe") + try: + agent_executable() + missing_refused = False + except TrialError: + missing_refused = True + finally: + PINNED_CLI["path"] = None remove_tree(scratch) checks = [("the root holds a frozen build and its run record", - "none-1.tar" in before and "run-planted.json" in before)] + "none-1.tar" in before and "run-planted.json" in before), + ("every dry-run trial records the CLI's version", + bool(recorded) and set(recorded) == {"0.0.0 (stand-in)"}), + ("a pinned CLI is the file a trial runs", pinned), + ("a pinned CLI that is not there refuses the run", + missing_refused), + ("a trial's environment turns the CLI's updater off", + agent_environment(scratch).get("DISABLE_AUTOUPDATER") == "1")] for task, prepared, untouched in outcomes: checks.append(("a %s dry run prepares beside the root" % task, prepared)) @@ -3426,6 +3492,8 @@ def spec_checks(): spec_problem(round5, "thin", spec_digest(SPECS["thin"])) is not None), ("a run without a round-5 arm is not checked", spec_problem(["none", "hybrid"], "thin", "0" * 64) is None), + ("a round-5d run on other content is refused", + spec_problem(["hand", "short"], name, "0" * 64) is not None), ] # The spec edited after the run started: the next trial is refused before @@ -3530,6 +3598,10 @@ def parse_args(argv): "escalation's ceiling, or %d for a run holding " "a round-5 arm)" % (K_PRIMARY, K_CEILING, ROUND5_K)) + parser.add_argument("--cli", + help="the Claude CLI file every trial runs, in place " + "of `claude` on PATH; its version is recorded " + "on every trial") parser.add_argument("--model", default="claude-sonnet-5", help="exact generator model id, recorded in the report") parser.add_argument("--effort", default="high") @@ -3575,10 +3647,14 @@ def main(argv): try: templates_root() assert_outside_repository(options.root) - except TrialError as error: + PINNED_CLI["path"] = (os.path.abspath(options.cli) if options.cli + else None) + options.cli_version = cli_version(agent_executable()) + except (TrialError, OSError, subprocess.TimeoutExpired) as error: print("refused: %s" % error) lib.print_verdict(False, "0 trial(s), 0 done, 1 refused") return 1 + print("CLI: %s, %s" % (agent_executable(), options.cli_version)) # A dry run prepares its workspaces, home and record beside the root # rather than in it. A workspace is never reused, so one a dry run left From cbdc07834c679d81d6d839ba62240a6681eff6cd Mon Sep 17 00:00:00 2001 From: Branimir Georgiev <66906831+braboj@users.noreply.github.com> Date: Sat, 31 Oct 2026 21:58:34 +0200 Subject: [PATCH 2/2] fix(efficacy): read the CLI's version as each trial starts A version read once per run would hide a CLI another process updated between two trials. The stand-in CLI in the self-test now answers each call with a new version, so a version read once per run fails it. Refs #89 Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01DpT5xPB8YTAMW2Msp4aPTX --- docs/architecture/06-runtime-view.md | 2 +- tests/efficacy/harness.py | 22 +++++++++++++++++----- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/docs/architecture/06-runtime-view.md b/docs/architecture/06-runtime-view.md index da95296..2966f04 100644 --- a/docs/architecture/06-runtime-view.md +++ b/docs/architecture/06-runtime-view.md @@ -67,7 +67,7 @@ built. | Your global `CLAUDE.md`, hooks, memory, MCP | A scratch home and a minimal settings file | | The launching session's environment | Its variables, editor, active interpreter and credentials are removed; the names removed are recorded | | The model | Pinned by exact id; effort fixed | -| The CLI | Its updater off in every trial; its version recorded on every trial. `--cli` pins one file, so an update the launcher takes mid-round reaches no trial | +| The CLI | Its updater off in every trial; its version read as each trial starts and recorded. `--cli` pins one file, so an update the launcher takes mid-round reaches no trial | | The builder's vendor | Never the judge's: each round names its builder models in its registration, none from the vendor of the rounds' judge | | The web | Web tools disallowed. The shell keeps its network, because every trial installs packages | | The templates repository | Not mounted | diff --git a/tests/efficacy/harness.py b/tests/efficacy/harness.py index ca8131e..bddd21a 100644 --- a/tests/efficacy/harness.py +++ b/tests/efficacy/harness.py @@ -1783,7 +1783,7 @@ def run_agent(workspace, name, prompt, record, root, home, options): "command": argv, "model": options.model, "effort": options.effort, - "cli_version": getattr(options, "cli_version", None), + "cli_version": cli_version(argv[0]), "budget_usd": options.budget, "timeout_s": options.timeout, "environment_removed": {"names": inherited_names(os.environ), @@ -2442,9 +2442,17 @@ def dry_run_checks(): os.makedirs(stand_in) claude = os.path.join(stand_in, "claude.cmd" if os.name == "nt" else "claude") + # The stand-in answers each call with a new version, as a CLI updated + # between two trials would, so a version read once per run shows. with io.open(claude, "w", encoding="utf-8") as handle: - handle.write("@echo off\r\necho 0.0.0 (stand-in)\r\n" if os.name == "nt" - else "#!/bin/sh\necho '0.0.0 (stand-in)'\n") + handle.write( + '@echo off\r\nset n=0\r\n' + 'if exist "%~dp0calls" set /p n=<"%~dp0calls"\r\n' + 'set /a n=n+1\r\n>"%~dp0calls" echo %n%\r\n' + 'echo 0.0.%n% (stand-in)\r\n' if os.name == "nt" else + '#!/bin/sh\ncalls="$(dirname "$0")/calls"\n' + 'n=$(($(cat "$calls" 2>/dev/null || echo 0) + 1))\n' + 'echo $n > "$calls"\necho "0.0.$n (stand-in)"\n') os.chmod(claude, 0o755) saved = {key: os.environ.get(key) for key in ("PATH", "HOME", "USERPROFILE")} os.environ["PATH"] = stand_in + os.pathsep + saved["PATH"] @@ -2461,6 +2469,8 @@ def dry_run_checks(): outcomes.append((task, code == 0 and os.path.isdir(os.path.join(dry, prepared)), listing(root) == before)) + with contextlib.redirect_stdout(io.StringIO()): + main(["--root", root, "--arms", "none", "--k", "2", "--dry-run"]) recorded = [] for run in glob.glob(os.path.join(dry, "run-*.json")): with io.open(run, encoding="utf-8") as handle: @@ -2508,8 +2518,10 @@ def dry_run_checks(): remove_tree(scratch) checks = [("the root holds a frozen build and its run record", "none-1.tar" in before and "run-planted.json" in before), - ("every dry-run trial records the CLI's version", - bool(recorded) and set(recorded) == {"0.0.0 (stand-in)"}), + ("every trial records the CLI's version, read as it starts", + len(recorded) == 2 and len(set(recorded)) == 2 + and all(str(version).endswith("(stand-in)") + for version in recorded)), ("a pinned CLI is the file a trial runs", pinned), ("a pinned CLI that is not there refuses the run", missing_refused),