Answer principles round 1: 0 🔴, 1 🟡 (0 misread); bound and stream a patch cut's ci.sh, keep a trace of each deploy-release run, fail on file errors and a missing Unreleased heading, read the plan once per cut, one home for the review title, inject task-bench's container names, one spelling of its task kind
CI / tests (pull_request) Has been cancelled

This commit is contained in:
2026-11-27 11:57:54 +01:00
parent f8ad35c1f9
commit 4fc4763710
16 changed files with 627 additions and 157 deletions
+20 -4
View File
@@ -90,6 +90,8 @@ CLAUDE = textwrap.dedent("""\
usage = {"input_tokens": 40, "cache_creation_input_tokens": 9000, "cache_read_input_tokens": 52000, "output_tokens": 800}
print(json.dumps({"type": "result", "subtype": "success", "is_error": False, "num_turns": 3, "duration_ms": 61500, "usage": usage, "result": "Fixed."}))
""")
# The name of a bench's containers and the user they run as, where a test fixes them.
NAME, USER = "task-bench-0123456789ab", "1234:5678"
PLACES = "## 2026-10-08T12:00:00Z, PR #1 at aaaaaaa\n\nJunior A, hardest first:\n\n- `calc.go:3` `Add`: long\n- `gone.go:1` `Gone`: removed since\n- `README.md:1` `Calc`: thin\n"
@@ -131,7 +133,7 @@ class BenchTest(unittest.TestCase):
def bench(self, **given: str):
with contextlib.redirect_stderr(io.StringIO()) as self.progress:
return main.bench({**self.given, "--base": "main", **given}, self.env, lambda home: PLACES, self.home)
return main.bench({**self.given, "--base": "main", **given}, self.env, lambda home: PLACES, self.home, NAME, USER)
def calls(self) -> list[list[str]]:
return [json.loads(line) for line in self.log.read_text().splitlines()]
@@ -223,6 +225,20 @@ class BenchTest(unittest.TestCase):
self.assertTrue((reports / "crashed/task-bench.lock").exists())
self.assertTrue((reports / "running/task-bench/trees/task-bench").exists())
def test_the_command_line_names_its_containers_afresh_and_runs_them_as_the_hosts_user(self):
self.assertRegex(main.new_name(), r"^task-bench-[0-9a-f]{12}$")
self.assertNotEqual(main.new_name(), main.new_name())
self.assertEqual(main.host_user(), f"{os.getuid()}:{os.getgid()}")
argv = [part for name, value in {**self.given, "--runs": "1"}.items() for part in (name, value)]
with contextlib.redirect_stdout(io.StringIO()), contextlib.redirect_stderr(io.StringIO()):
self.assertEqual(main.main(argv, self.env, lambda home: PLACES, name=lambda: "task-bench-other", user=lambda: "7:8"), 0)
calls = self.calls()
self.assertEqual(calls[1], ["network", "create", "--internal", "task-bench-other"])
self.assertIn(["--user", "7:8"], [call[at:at + 2] for call in calls if "claude" in call for at in range(len(call))])
def test_each_kind_of_task_has_what_reads_its_tasks(self):
self.assertEqual(set(main.SOURCES), set(main.KINDS.values()))
def test_the_command_line_runs_the_bench_on_the_seats_places_and_prints_its_report(self):
argv = [part for name, value in self.given.items() for part in (name, value)]
homes = []
@@ -282,11 +298,11 @@ class BenchTest(unittest.TestCase):
fixes = [call for call in calls if "claude" in call]
self.assertEqual(len(fixes), 2)
name = fixes[0][fixes[0].index("--network") + 1]
self.assertRegex(name, r"^task-bench-[0-9a-f]{12}$")
self.assertEqual(name, NAME)
image = fixes[0].index(f"{name}:throwaway")
self.assertEqual(fixes[0][image + 1:], ["claude", "-p", "--strict-mcp-config", "--disable-slash-commands", "--no-session-persistence", "--model", "claude-haiku-5-5", "--effort", "low", "--output-format", "stream-json", "--verbose", "--permission-mode", "bypassPermissions", "A test of this project fails with the message below. Find the bug in the code and fix it. Change no test.\n\nAdd(1, 2) = -1, want 3"])
options = fixes[0][:image]
for expected in (["--memory", "2048m"], ["--memory-swap", "2048m"], ["--user", f"{os.getuid()}:{os.getgid()}"], ["--env", "HOME=/tmp"], ["--env", "CLAUDE_CODE_OAUTH_TOKEN"], ["--env", f"HTTPS_PROXY=http://{name}-proxy:8080"], ["--workdir", "/work"]):
for expected in (["--memory", "2048m"], ["--memory-swap", "2048m"], ["--user", USER], ["--env", "HOME=/tmp"], ["--env", "CLAUDE_CODE_OAUTH_TOKEN"], ["--env", f"HTTPS_PROXY=http://{name}-proxy:8080"], ["--workdir", "/work"]):
self.assertIn(expected, [options[at:at + 2] for at in range(len(options))])
self.assertNotIn("sk-secret-token", self.log.read_text())
self.assertEqual(calls[0][:1] + calls[0][-3:], ["build", "--tag", f"{name}:throwaway", "-"])
@@ -308,7 +324,7 @@ class BenchTest(unittest.TestCase):
def test_fails_where_the_places_name_no_file_of_the_base_in_a_language_the_bench_plants_in(self):
with contextlib.redirect_stderr(io.StringIO()):
found = main.bench({**self.given, "--base": "main"}, self.env, lambda home: "- `gone.go:1` `Gone`: removed\n- `README.md:1` `Calc`: thin\n", self.home)
found = main.bench({**self.given, "--base": "main"}, self.env, lambda home: "- `gone.go:1` `Gone`: removed\n- `README.md:1` `Calc`: thin\n", self.home, NAME, USER)
self.assertEqual(found, Failure("The places the seats found hard don't name any file at the base in a language the bench plants bugs in, so there is nowhere to plant a bug."))
self.assertFalse(self.log.exists())