Answer stability round 1: 0 🔴, 1 🟡 (0 misread); record a bench's figures inside the bench with --record-figures, so one that stopped or an older digest is never recorded

This commit is contained in:
2026-11-23 15:36:08 +01:00
parent 1f33e37fe5
commit 9d2e3f1823
4 changed files with 126 additions and 95 deletions
+20 -15
View File
@@ -1,8 +1,7 @@
r"""Measure how hard a project's code is to fix a bug in, at a base commit and at a head: plant bugs its tests catch, have Haiku fix
each several times at both, and print how often the fix passes and what it took.
usage: task-bench --image <image> --test <shell text> [--base <ref>] [--head <ref>] [--prefix <shell text>] [--seed <n>] [--bugs <n>] [--runs <n>]
task-bench record-figures
usage: task-bench --image <image> --test <shell text> [--base <ref>] [--head <ref>] [--prefix <shell text>] [--seed <n>] [--bugs <n>] [--runs <n>] [--record-figures]
task-bench gather
Run it in a checkout, under ~/.claude/bin/run-heavy, with a long-lived token in CLAUDE_CODE_OAUTH_TOKEN, which `claude setup-token`
@@ -53,10 +52,10 @@ in 19 cases of 20, an All change under 12% in output tokens, 16% in cache-read t
passed, so the pass rate's noise is unmeasured.
`docs/decisions.md` → `task-bench: a bench takes` has the figures.
`task-bench record-figures`, run in the same checkout, appends the bench's figures to the project's comprehension history: the
table's heading and its three All rows, under a heading of the current UTC time and `task-bench of <branch>: head <commit>
against base <commit>`. It is a report beside the panel's scores there, which no tool reads as one of them. It waits for a
bench that still runs, and leaves the bench's folder, so run it before gather.
With --record-figures, a bench that finishes appends its figures to the project's comprehension history: an entry with the
table's header and its three All rows. The entry's heading gives the current UTC time, then `task-bench of <branch>: head
<commit> against base <commit>`, where <branch> is the branch checked out, whatever --head names. No tool reads the entry as a
ruling or a scoring run. The bench's last line says where the entry went. A bench that fails or stops doesn't record anything.
`task-bench gather`, run in the same checkout, turns the digest into plan items. It starts a claude on the project's rung, the
cheapest rung of the model loop-claude runs the project on, with the digest and the prompt in gather-prompt.md beside this file.
@@ -70,8 +69,9 @@ Exit 1, saying why, on an unknown or repeated argument, a missing --image or --t
number from 1, or no token; and where git, docker or Gremlins fails, the seats' places don't name any Go file, the tests fail at a side
without a bug, or no mutant becomes a bug. Where the API refuses a run, the bench stops there and exits 1 too, after the table of
the runs that finished.
record-figures exits 1, saying why, outside a checkout, without a digest, on a digest without its commits or its three All
rows, where no config names the checkout, and where the history already holds that bench or cannot be written.
With --record-figures it also exits 1, saying why: before it plants a bug, where no config names the checkout or the history
cannot be read; and after the bench, where the history already holds that branch's bench of those two commits or cannot be
written. The folder then still holds the bench's results.
gather exits 1, saying why, outside a checkout, without a digest, where loop-claude has saved no model for the project or the
model is not on its routing ladder, and where its claude fails or hits a usage limit.
"""
@@ -103,12 +103,14 @@ from task_bench.figures import figures, Result, Side, SIDES, table
from git_cli import git_repo
from review_rules.review_folder import made_review_folder, REPORTS
from larv_review.history_commands import read_places
from task_bench.record_figures import record_figures
from task_bench.record_figures import recorded_bench
from run_heavy.capped_docker import SHARE_VARIABLE
USAGE = "usage: task-bench --image <image> --test <shell text> [--base <ref>] [--head <ref>] [--prefix <shell text>] [--seed <n>] [--bugs <n>] [--runs <n>], task-bench record-figures, or task-bench gather"
USAGE = "usage: task-bench --image <image> --test <shell text> [--base <ref>] [--head <ref>] [--prefix <shell text>] [--seed <n>] [--bugs <n>] [--runs <n>] [--record-figures], or task-bench gather"
# A panel of three readers, seated as the README's audience, picked these options on 2026-11-21, each 3 to 0.
OPTIONS = ("--base", "--bugs", "--head", "--image", "--prefix", "--runs", "--seed", "--test")
OPTIONS = ("--base", "--bugs", "--head", "--image", "--prefix", "--record-figures", "--runs", "--seed", "--test")
# The one option that takes no value.
RECORD = "--record-figures"
COUNTS = {"--bugs": "5", "--runs": "5", "--seed": "1"}
# Opens the report's last line, which names the bench's folder.
KEPT = "The digest, and each run's result and stream, until `task-bench gather` files plan items from them or the next bench starts: "
@@ -164,9 +166,6 @@ def main(argv: list[str], env: typing.Mapping[str, str], read: typing.Callable[[
home = pathlib.Path(env.get("HOME") or pathlib.Path.home())
if argv[:1] == ["gather"]:
report = gather(env, home, claude) if argv == ["gather"] else Failure(f"gather takes no arguments; {USAGE}")
elif argv[:1] == ["record-figures"]:
recorded = record_figures(env, home, time.time()) if argv == ["record-figures"] else Failure(f"record-figures takes no arguments; {USAGE}")
report = recorded if isinstance(recorded, Failure) else [recorded]
else:
given = options(argv, env)
if isinstance(given, Failure):
@@ -190,6 +189,11 @@ def options(argv: list[str], env: typing.Mapping[str, str]) -> dict[str, str] |
return Failure(f"unknown argument {name}")
if name in given:
return Failure(f"{name} is given twice")
if name == RECORD:
if equals:
return Failure(f"{name} takes no value")
given[name] = ""
continue
if not equals and not rest:
return Failure(f"{name} needs a value")
given[name] = value if equals else rest.pop(0)
@@ -235,7 +239,8 @@ def bench(given: dict[str, str], env: typing.Mapping[str, str], places: str, hom
if isinstance(folder, Failure):
return folder
clear_left(home / REPORTS)
return bench_in(folder, given, env, places, checkout, sides, git, say)
run = functools.partial(bench_in, folder, given, env, places, checkout, sides, git, say)
return recorded_bench(run, folder, git, home, time.time) if RECORD in given else run()
def bench_in(folder: pathlib.Path, given: dict[str, str], env: typing.Mapping[str, str], places: str, checkout: str, sides: dict[Side, str], git: Git, say: typing.Callable[[str], None]) -> list[str] | Failure: