Answer stability round 1: 0 🔴, 5 🟡 (1 misread); keep locks out of compress-archives, count only a search's hits, show an unfinished failing run, and test the walk and the home

This commit is contained in:
2026-11-21 12:18:32 +01:00
parent 27e5014322
commit 101c8a7c3d
12 changed files with 118 additions and 71 deletions
+10 -10
View File
@@ -41,15 +41,15 @@ chunk's review folder.
That folder holds each run's result and stream, and digest.md, which says why runs failed in a few kilobytes per bug:
- the table;
- per bug its decoys, the files more than half of its failing runs read that the fix doesn't change;
- per bug two traces, of the failing run that spent the most tokens and of the passing run with the median tokens. A trace has a
line per tool call, such as `Read pick.go:120-180` or `Grep "readName" → 4 hits`, and the first 3 lines of what Haiku wrote
- per bug its decoys, the files more than half of its failing runs read that the bug isn't in;
- per bug up to two traces: of a failing run, one that didn't finish or else the one that spent the most tokens, and of the
passing run with the median tokens. A trace has a line per tool call, such as `Read pick.go:120-180` or `Grep "readName" → 4 hits`, and the first 3 lines of what Haiku wrote
between calls.
`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.
That claude files an item with `todo-item add` for each place the runs show to be hard, and leaves the plan's file uncommitted.
gather prints what it answered and removes the bench's folder. Where claude fails, the folder stays, for another try.
gather prints that claude's answer and removes the bench's folder. Where claude fails, the folder stays, for another try.
Each bench empties its own folder first, and removes the folder every earlier bench left under any review folder, gathered or
not, unless a bench or a gather is using it. So gather a bench before the next one starts.
@@ -94,7 +94,7 @@ USAGE = "usage: task-bench --image <image> --test <shell text> [--base <ref>] [-
OPTIONS = ("--base", "--bugs", "--head", "--image", "--prefix", "--runs", "--seed", "--test")
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: "
KEPT = "The digest, and each run's result and stream, until `task-bench gather` files plan items from them or the next bench starts: "
# The planted commit doesn't name anyone, and neither a hook nor a signing key of the caller's reaches it.
COMMIT = ["-c", "user.name=task-bench", "-c", "user.email=task-bench@localhost", "-c", "commit.gpgsign=false", "-c", "core.hooksPath=/dev/null", "commit", "--quiet", "--message", "Import"]
@@ -118,8 +118,8 @@ def main(argv: list[str], env: typing.Mapping[str, str], read: typing.Callable[[
print(__doc__.strip())
return 0
home = pathlib.Path(env.get("HOME") or pathlib.Path.home())
if argv == ["gather"]:
report = gather(env, home, claude)
if argv[:1] == ["gather"]:
report = gather(env, home, claude) if argv == ["gather"] else Failure(f"gather takes no arguments; {USAGE}")
else:
given = options(argv, env)
if isinstance(given, Failure):
@@ -264,7 +264,7 @@ def benched(given: dict[str, str], checkout: str, sides: dict[str, str], trees:
names = {task.number: task.named() for task in tasks}
(folder / "results.json").write_text(json.dumps({"sides": sides, "seed": int(given["--seed"]), "bugs": names, "runs": [recorded(result) for result in results]}, indent="\t") + "\n", encoding="utf-8")
in_a_tree = lambda path: any(pathlib.Path(tree, path).is_file() for tree in trees.values())
(folder / DIGEST).write_text(digest(table(results, names), [digested(task, results, folder) for task in tasks], in_a_tree), encoding="utf-8")
(folder / DIGEST).write_text(digest(sides, table(results, names), [digested(task, results, folder) for task in tasks], in_a_tree), encoding="utf-8", errors="replace")
if stopped:
# The runs that finished took hours and tokens, so the bench shows them before it fails.
return Failure("\n".join([stopped.reason, f"task-bench stopped after {len(results)} of {total} runs, which results.json holds in {folder}:", "", *table(results, names)]))
@@ -354,8 +354,8 @@ def stream_of(result: Result, folder: pathlib.Path) -> pathlib.Path:
def digested(task: Task, results: list[Result], folder: pathlib.Path) -> Bug:
"""The bug as the digest tells it, with each of its runs in results. A run that didn't finish counts as spending no tokens."""
runs = [Run(stream_of(result, folder).stem, result.passed, found.tokens.context() + found.tokens.output if (found := result.figures) else 0, stream_of(result, folder).read_bytes()) for result in results if result.task == task.number]
"""The bug as the digest tells it, with each of its runs in results. A run that didn't finish has no tokens."""
runs = [Run(stream_of(result, folder).stem, result.passed, found.tokens.context() + found.tokens.output if (found := result.figures) else None, stream_of(result, folder).read_bytes()) for result in results if result.task == task.number]
return Bug(f"{task.number}: {task.named()}", task.mutant.path, task.messages["base"], runs)