Distil each task-bench run into a digest and gather plan items from it #684

Merged
lilleman merged 9 commits from item-502 into main 2026-11-21 12:46:41 +01:00
2 changed files with 14 additions and 2 deletions
Showing only changes of commit 27e5014322 - Show all commits
+2 -2
View File
@@ -138,8 +138,8 @@ class DigestTest(unittest.TestCase):
self.assertIn("### bug-2-base-1, the passing run with the median tokens, 10", held.splitlines())
def test_the_median_is_by_tokens_whatever_the_order_the_runs_ran_in(self):
runs = [Run("bug-2-base-1", True, 30, b""), Run("bug-2-head-1", True, 10, b""), Run("bug-2-base-2", True, 20, b"")]
self.assertEqual(digest([], [Bug("2: a.go:1:1 X", "a.go", "boom", runs)], lambda path: True).splitlines()[-2:], ["### bug-2-base-2, the passing run with the median tokens, 20", ""])
runs = [Run("bug-2-base-1", True, 20, b""), Run("bug-2-head-1", True, 10, b""), Run("bug-2-base-2", True, 30, b"")]
self.assertEqual(digest([], [Bug("2: a.go:1:1 X", "a.go", "boom", runs)], lambda path: True).splitlines()[-2:], ["### bug-2-base-1, the passing run with the median tokens, 20", ""])
def test_a_bug_no_run_fixed_shows_the_failing_trace_alone_and_says_where_no_file_misled(self):
held = digest([], [Bug("3: a.go:1:1 X", "a.go", "boom\nat line 2", [Run("bug-3-base-1", False, 10, reading("a.go")), Run("bug-3-head-1", False, 10, reading("a.go"))])], lambda path: True)
+12
View File
@@ -98,6 +98,18 @@ class GatherTest(unittest.TestCase):
self.models.write_text("{")
self.assertIsInstance(gather(self.env, self.home, self.claude), Failure)
def test_a_claude_that_fails_without_a_word_is_named(self):
self.code = 1
found = gather(self.env, self.home, lambda args, cwd, prompt: subprocess.CompletedProcess(args, 1, "", ""))
self.assertEqual(found.reason.splitlines()[0] if isinstance(found, Failure) else found, "the gathering claude exited 1")
def test_git_runs_in_the_environment_given(self):
env = {**self.env, "GIT_DIR": str(self.home / "none")}
self.assertIsInstance(gather(env, self.home, self.claude), Failure)
with contextlib.redirect_stderr(io.StringIO()):
self.assertEqual(main.main(["gather"], env, claude=self.claude), 1)
self.assertEqual(self.calls, [])
def test_refuses_outside_a_checkout(self):
with contextlib.chdir(self.home):
self.assertIsInstance(gather(self.env, self.home, self.claude), Failure)