diff --git a/bin/claude_code/reply.py b/bin/claude_code/reply.py index 878303a5..23305ee4 100644 --- a/bin/claude_code/reply.py +++ b/bin/claude_code/reply.py @@ -22,15 +22,17 @@ HEADLESS = ["--no-session-persistence", "--output-format", "json", "--permission def claude_reply(claude: Claude, args: list[str], cwd: str, prompt: str, who: str) -> dict | Failure | Limited: - """claude's json reply to `claude -p ` and HEADLESS, or why there is none; who names the run in the message for a non-zero exit, such as the judge.""" + """claude's json reply to `claude -p ` and HEADLESS, or why there is none; who names the run in the message for a non-zero exit or a reply that is no json, such as the judge.""" try: proc = claude(["-p", *args, *HEADLESS], cwd, prompt) except OSError as failure: return Failure(f"could not start claude: {failure.strerror}") - reply = parse_entry(proc.stdout) or {} + reply = parse_entry(proc.stdout) # The json output names the reset only in prose, such as "resets 7:40pm (Europe/Stockholm)", so its limit carries no reset time. - if hit_limit(reply): + if reply is not None and hit_limit(reply): return Limited(None, limit_said(reply)) if proc.returncode != 0: return Failure(proc.stderr.strip() or f"{who} exited {proc.returncode}") + if reply is None: + return Failure(f"{who} printed no json reply; it printed: {proc.stdout.strip() or 'nothing'}") return reply diff --git a/bin/claude_code/test_claude_code.py b/bin/claude_code/test_claude_code.py index b2bc4448..a07d331e 100644 --- a/bin/claude_code/test_claude_code.py +++ b/bin/claude_code/test_claude_code.py @@ -92,8 +92,20 @@ class ClaudeReply(unittest.TestCase): return subprocess.CompletedProcess(args, *outcome) return run + def test_runs_claude_headless_with_the_args_in_cwd_on_the_prompt(self): + asked = [] + + def run(args, cwd, prompt): + asked.append((args, cwd, prompt)) + return subprocess.CompletedProcess(args, 0, "{}", "") + + reply.claude_reply(run, ["--tools", ""], "/r", "p", "the judge") + self.assertEqual(asked, [(["-p", "--tools", "", "--no-session-persistence", "--output-format", "json", "--permission-mode", "bypassPermissions"], "/r", "p")]) + def test_returns_the_json_reply_a_usage_limit_whatever_the_exit_code_or_why_there_is_none(self): self.assertEqual(reply.claude_reply(self.claude((0, '{"result": "ok"}', "")), [], "/r", "p", "the judge"), {"result": "ok"}) + self.assertEqual(reply.claude_reply(self.claude((0, "Warning: hook said hi\n", "")), [], "/r", "p", "the judge"), Failure("the judge printed no json reply; it printed: Warning: hook said hi")) + self.assertEqual(reply.claude_reply(self.claude((0, "", "")), [], "/r", "p", "the judge"), Failure("the judge printed no json reply; it printed: nothing")) limit = json.dumps({"type": "result", "api_error_status": 429, "result": "You've hit your limit"}) self.assertEqual(reply.claude_reply(self.claude((1, limit, "")), [], "/r", "p", "the judge"), reply.Limited(None, "You've hit your limit")) self.assertEqual(reply.claude_reply(self.claude((2, "", " ")), [], "/r", "p", "the judge"), Failure("the judge exited 2")) diff --git a/bin/loop_claude/cycle/judge.py b/bin/loop_claude/cycle/judge.py index f715ac9b..aa0bc317 100644 --- a/bin/loop_claude/cycle/judge.py +++ b/bin/loop_claude/cycle/judge.py @@ -147,7 +147,7 @@ def run_judge(root: str, args: list[str], prompt: str, shown: str, quotable: str return reply verdict = verdict_from(structured_output(reply)) if isinstance(verdict, Failure): - return Failure(f"{verdict.reason}; it replied: {json.dumps(reply, ensure_ascii=False) if reply else 'nothing'}") + return Failure(f"{verdict.reason}; it replied: {json.dumps(reply, ensure_ascii=False)}") if not grounded(verdict.evidence, shown): return Failure(f"the judge quoted {verdict.evidence!r}, which is not in the transcript" + (f", for the question: {verdict.question}" if isinstance(verdict, Interrupt | QuotedAnswer) else "")) # Not a Failure: a misquote would otherwise exit an unattended loop. Never elided: stitched fragments can say what the records do not. diff --git a/bin/loop_claude/loop/main.py b/bin/loop_claude/loop/main.py index 3fb92058..307d1ab2 100644 --- a/bin/loop_claude/loop/main.py +++ b/bin/loop_claude/loop/main.py @@ -102,10 +102,10 @@ Exit 1, saying why, when: handover - the worker or the judge fails three times running, retried a minute apart within the cycle. A worker fails when claude cannot start, exits non-zero, is killed, or ends without a result event; - a judge when claude cannot start or exits non-zero, or its reply misses or mistypes a field, - interrupts or quotes an answer without a question, gives an unfinished verdict an R + C outside - 0 to 20, or quotes a passage the transcript does not hold; it holds an elided passage when each - fragment appears in order. + a judge when claude cannot start, exits non-zero or prints no json reply, or its reply misses or + mistypes a field, interrupts or quotes an answer without a question, gives an unfinished verdict + an R + C outside 0 to 20, or quotes a passage the transcript does not hold; it holds an elided + passage when each fragment appears in order. A usage limit is not a failure, and restarts the count of three: the worker or the judge is retried 2 minutes after the limit resets, or every 10 minutes when the reset time is unknown or more than 2 minutes past. The judge's reply gives its reset time only as text, so the judge is diff --git a/bin/loop_claude/test_black_box.py b/bin/loop_claude/test_black_box.py index 365afad9..4769821b 100644 --- a/bin/loop_claude/test_black_box.py +++ b/bin/loop_claude/test_black_box.py @@ -455,7 +455,7 @@ class Cycles(unittest.TestCase): self.assertEqual(run.roles(), ["worker", "judge", "judge", "judge"]) self.assertEqual(run.sleeps, [60, 60]) self.assertIn("retrying the judge in a minute: judge down", run.stderr) - self.assertIn("retrying the judge in a minute: the judge returned no reply; it replied: nothing\n", run.stderr) + self.assertIn("retrying the judge in a minute: the judge printed no json reply; it printed: nothing\n", run.stderr) self.assertEqual(run.stderr.strip().splitlines()[-1], 'the judge failed three times running: the judge\'s reply has no answer of type string; it replied: {"structured_output": {"interrupt": false}}') def test_waits_out_a_usage_limit_which_ends_a_run_of_failures(self): diff --git a/bin/loop_claude/test_loop_claude.py b/bin/loop_claude/test_loop_claude.py index 01f63713..f7f1b708 100644 --- a/bin/loop_claude/test_loop_claude.py +++ b/bin/loop_claude/test_loop_claude.py @@ -885,7 +885,8 @@ class ExitContract(unittest.TestCase): class JudgeFailures(unittest.TestCase): def test_every_failed_judge_run_has_its_clause_in_help(self): - started, field, unasked = "claude cannot start or exits non-zero", "its reply misses or mistypes a field", "interrupts or quotes an answer without a question" + started, exited, unparsed = "claude cannot start", "exits non-zero", "prints no json reply" + field, unasked = "its reply misses or mistypes a field", "interrupts or quotes an answer without a question" # Every Failure the judge's run returns, in source order of judge.py, then of the claude run it calls: function, start of reason, its --help clause. clauses = [ ("verdict_from", "'the judge returned no reply'", field), @@ -893,10 +894,11 @@ class JudgeFailures(unittest.TestCase): ("verdict_from", "'the judge interrupted without a question'", unasked), ("verdict_from", "'the judge quoted an answer without a question'", unasked), ("verdict_from", 'f"the judge\'s bundled R + C', "gives an unfinished verdict an R + C outside 0 to 20"), - ("run_judge", 'f"{verdict.reason}; it replied:', field), + ("run_judge", "f'{verdict.reason}; it replied:", field), ("run_judge", "f'the judge quoted {verdict.evidence!r}, which is not in the transcript", "quotes a passage the transcript does not hold"), ("claude_reply", "f'could not start claude:", started), - ("claude_reply", "proc.stderr.strip() or f'{who} exited", started), + ("claude_reply", "proc.stderr.strip() or f'{who} exited", exited), + ("claude_reply", 'f"{who} printed no json reply', unparsed), ] found = [] for module in (judge, reply): diff --git a/bin/rung_replay/test_rung_replay.py b/bin/rung_replay/test_rung_replay.py index c2d0681c..fe450d39 100644 --- a/bin/rung_replay/test_rung_replay.py +++ b/bin/rung_replay/test_rung_replay.py @@ -42,6 +42,10 @@ class Replayed(unittest.TestCase): self.assertEqual(search(["a"], [MIDDLE, CHEAP], {REFERENCE: {"a": {0}}, MIDDLE: {"a": set()}})[0], Replay([{0}], [Tried(MIDDLE, [Miss("a", 0, set())])], None)) self.assertEqual(search(["a"], [MIDDLE], {REFERENCE: {"a": set()}}), (Replay([set()], [], None), [("a", REFERENCE)])) + def test_counts_a_miss_in_any_case_not_only_the_last(self): + replies = {REFERENCE: {"a": {0}, "b": {0}}, MIDDLE: {"a": set(), "b": {0}}} + self.assertEqual(search(["a", "b"], [MIDDLE], replies)[0], Replay([{0}, {0}], [Tried(MIDDLE, [Miss("a", 0, set())])], None)) + def test_stops_at_a_usage_limit(self): limit = Limited(None, "limit") self.assertEqual(search(["a"], [MIDDLE], {REFERENCE: limit})[0], limit) diff --git a/bin/stability_replay/main.py b/bin/stability_replay/main.py index f2671a0c..35273405 100644 --- a/bin/stability_replay/main.py +++ b/bin/stability_replay/main.py @@ -9,7 +9,8 @@ reviewed: in a throwaway clone of the project's checkout, at the newest commit o authored by the time the round began, on the branch the reviewer started on. The clone's default branch stands at the newest commit authored before the round's chunk began, so a diff against it shows the chunk's change. The prompt names the clone in place of the worktree it named, which the -chunk has since removed. A round whose code it cannot find in this way is not replayed. +chunk has since removed. A round whose code it cannot find in this way is not replayed; stderr +names it and why. It first replays every round on the reference reviewer, the project's rung, which the reviewer runs on while the worker runs below it. Findings it does not find may rest on code or rules that @@ -67,9 +68,12 @@ def main(argv: list[str], env: typing.Mapping[str, str], home: pathlib.Path, eff rounds = archived_rounds(anchor.model, archive_root(home, env), home) if isinstance(rounds, Failure): return failed(TOOL, rounds.reason) - codes = {found: code for found in rounds if not isinstance(code := code_of(found, effects), Failure)} - if len(codes) < len(rounds): - print(f"{len(rounds) - len(codes)} of {len(rounds)} rounds holding a šŸ”“ or 🟔 are left out: their code cannot be found", file=sys.stderr, flush=True) + codes = {} + for found in rounds: + if isinstance(code := code_of(found, effects), Failure): + print(f"{found.root} {found.at} is left out: {code.reason}", file=sys.stderr, flush=True) + else: + codes[found] = code if not codes: return failed(TOOL, f"no archived stability round of projects on {anchor.model} in {archive_root(home, env)} holds a šŸ”“ or 🟔 on code it can find") chosen = sample(list(codes), LATEST) @@ -116,6 +120,8 @@ def code_of(found: Round, effects: Effects) -> Code | Failure: Recording the reviewed commit at review time would need no such reading, but then no round archived before that change could be replayed. A wrong guess costs no rung: the reference reviewer, replayed on that code, finds fewer findings on record, and no rung is held to those. """ + if not os.path.isdir(found.root): + return Failure("the project has no checkout") path = reviewed_path(found.prompt, found.root, os.path.exists) if path is None: return Failure("the prompt names no one worktree") diff --git a/bin/stability_replay/test_stability_replay.py b/bin/stability_replay/test_stability_replay.py index d6936e8c..91320d42 100644 --- a/bin/stability_replay/test_stability_replay.py +++ b/bin/stability_replay/test_stability_replay.py @@ -2,6 +2,7 @@ import contextlib import dataclasses import io import json +import os import pathlib import re import shutil @@ -52,6 +53,10 @@ class RoundFrom(unittest.TestCase): self.assertEqual(round_from("/code/p", 5.0, entries), Round("/code/p", "x", "2026-10-14T10:00:00.500Z", 5.0, "Review branch x in /code/p-x.", ("šŸ”“ a.py:1 breaks",))) self.assertEqual(round_from("/code/p", 5.0, entries).seconds, 1791972000.5) + def test_reads_a_prompt_given_as_a_string(self): + start = {"type": "user", "message": {"content": "Review branch x in /code/p-x."}, "timestamp": "2026-10-14T10:00:00Z", "gitBranch": "x"} + self.assertEqual(round_from("/code/p", 5.0, [start, entry("assistant", "šŸ”“ a")]).prompt, "Review branch x in /code/p-x.") + def test_skips_a_round_with_no_red_or_yellow_finding_or_no_report(self): start = entry("user", "Review.", timestamp="2026-10-14T10:00:00Z", cwd="/code/p", gitBranch="x") self.assertIsNone(round_from("/code/p", 5.0, [start, entry("assistant", "APPROVE\n\n🟢 nit")])) @@ -105,8 +110,22 @@ class Report(unittest.TestCase): class Match(unittest.TestCase): def run_match(self, stdout): - effects = dataclasses.replace(system_effects(), claude=lambda args, cwd, prompt: subprocess.CompletedProcess(args, 0, stdout, "")) - return main.match(("šŸ”“ a", "🟔 b"), "the other report", "/code/p", REFERENCE, effects) + self.asked = [] + + def claude(args, cwd, prompt): + self.asked.append((args, cwd, prompt)) + return subprocess.CompletedProcess(args, 0, stdout, "") + + return main.match(("šŸ”“ a", "🟔 b"), "the other report", "/code/p", REFERENCE, dataclasses.replace(system_effects(), claude=claude)) + + def test_asks_for_the_numbered_findings_the_other_report_raises_as_json_with_no_tools(self): + self.run_match("{}") + [(args, cwd, prompt)] = self.asked + self.assertEqual(cwd, "/code/p") + self.assertIn("1. šŸ”“ a\n\n2. 🟔 b\n\nThe other report:\nthe other report", prompt) + self.assertEqual(json.loads(args[args.index("--json-schema") + 1]), main.MATCH_SCHEMA) + self.assertEqual(args[args.index("--tools") + 1], "") + self.assertEqual(args[args.index("--model"):args.index("--model") + 4], REFERENCE.flags()) def test_takes_the_numbers_in_range_and_fails_on_a_reply_of_another_shape(self): self.assertEqual(self.run_match(json.dumps({"type": "result", "structured_output": {"found": [2, 0, 3, 1]}})), {0, 1}) @@ -128,15 +147,18 @@ def unused(*_): raise AssertionError("not called") -def run_git(cwd, *args): - subprocess.run(["git", "-c", "user.name=t", "-c", "user.email=t@t", *args], cwd=cwd, check=True, capture_output=True) +def run_git(cwd, *args, at=None): + """at, when given, is the commit's author and committer time, so git log lists the commits in a fixed order.""" + env = {**os.environ, "GIT_AUTHOR_DATE": at, "GIT_COMMITTER_DATE": at} if at else None + subprocess.run(["git", "-c", "user.name=t", "-c", "user.email=t@t", *args], cwd=cwd, check=True, capture_output=True, env=env) class Main(unittest.TestCase): - """The tool on a temporary home: a chunk that began after the checkout's first commit, and whose stability reviewer reviewed branch x at its second, from a worktree since removed.""" + """The tool on a temporary home: a chunk that began after the checkout's first commit, and whose stability reviewer reviewed branch x at its second, from a worktree since removed; a prose reviewer's files sort before the stability reviewer's.""" def setUp(self): self.home = pathlib.Path(self.enterContext(tempfile.TemporaryDirectory())) + self.archive = self.home / ".claude" / "loop-claude-transcripts" (self.home / ".claude").mkdir() (self.home / ".claude" / "loop-claude-models.json").write_text(json.dumps({"proj": "claude-opus-5-5", "other": "claude-sonnet-5-5"})) origin, self.checkout = self.home / "origin.git", self.home / "code" / "proj" @@ -145,23 +167,27 @@ class Main(unittest.TestCase): for n, stamp in enumerate(("2026-10-14T09:00:00Z", "2026-10-14T09:30:00Z", "2026-10-14T11:00:00Z")): (self.checkout / "a.txt").write_text(f"{n}\n") run_git(self.checkout, "add", "a.txt") - run_git(self.checkout, "commit", "-qm", f"c{n}", f"--date={stamp}") + run_git(self.checkout, "commit", "-qm", f"c{n}", at=stamp) run_git(self.checkout, "push", "-q", "origin", "main") run_git(self.checkout, "remote", "set-head", "origin", "main") - gone = self.home / "code" / "proj-x" - for key, cwd in (("proj", gone), ("other", self.home / "code" / "other")): - subagents = self.home / ".claude" / "loop-claude-transcripts" / key / "c1" / "session" / "s" / "subagents" - subagents.mkdir(parents=True) - (subagents.parents[2] / "t0.jsonl").write_text(json.dumps({"type": "summary"}) + "\n" + json.dumps(entry("user", "Do the next chunk.", timestamp="2026-10-14T09:15:00Z")) + "\n") - (subagents / "agent-a.meta.json").write_text(json.dumps({"agentType": "stability-reviewer"})) - (subagents / "agent-b.meta.json").write_text(json.dumps({"agentType": "prose-reviewer"})) - lines = [entry("user", f"Review branch x in {gone}.", timestamp="2026-10-14T10:00:00Z", cwd=str(cwd), gitBranch="x"), entry("assistant", "BLOCK\n\nšŸ”“ a.txt:1 wrong\n\n🟔 slow")] - for name in ("agent-a.jsonl", "agent-b.jsonl"): - (subagents / name).write_text("".join(json.dumps(line) + "\n" for line in lines)) + for key in ("proj", "other"): + self.write_chunk(key, "c1", "2026-10-14T10:00:00Z") self.reviews = [] + def write_chunk(self, key, chunk, at, began="2026-10-14T09:15:00Z"): + """A chunk that began at began, whose stability round began at at.""" + subagents = self.archive / key / chunk / "session" / "s" / "subagents" + subagents.mkdir(parents=True, exist_ok=True) + (subagents.parents[2] / "t0.jsonl").write_text(json.dumps({"type": "summary"}) + "\n" + json.dumps(entry("user", "Do the next chunk.", timestamp=began)) + "\n") + (subagents / "agent-a.meta.json").write_text(json.dumps({"agentType": "prose-reviewer"})) + (subagents / "agent-b.meta.json").write_text(json.dumps({"agentType": "stability-reviewer"})) + gone = self.home / "code" / "proj-x" + lines = [entry("user", f"Review branch x in {gone}.", timestamp=at, cwd=str(gone), gitBranch="x"), entry("assistant", "BLOCK\n\nšŸ”“ a.txt:1 wrong\n\n🟔 slow")] + for name in ("agent-a.jsonl", "agent-b.jsonl"): + (subagents / name).write_text("".join(json.dumps(line) + "\n" for line in lines)) + def rewrite_round(self, change): - path = self.home / ".claude" / "loop-claude-transcripts" / "proj" / "c1" / "session" / "s" / "subagents" / "agent-a.jsonl" + path = self.archive / "proj" / "c1" / "session" / "s" / "subagents" / "agent-b.jsonl" lines = [json.loads(line) for line in path.read_text().splitlines()] change(lines[0]) path.write_text("".join(json.dumps(line) + "\n" for line in lines)) @@ -172,15 +198,15 @@ class Main(unittest.TestCase): def set_prompt(self, prompt): self.rewrite_round(lambda first: first["message"]["content"][0].update(text=prompt)) - def run_main(self, argv, found): - """found(rung) is the indexes of the recorded findings the reviewer on rung finds.""" + def run_main(self, argv, found, review=lambda rung: {"type": "result", "result": f"review on {rung.model} {rung.effort}"}): + """found(rung) is the indexes of the recorded findings the reviewer on rung finds; review(rung), that reviewer's reply.""" def claude(args, cwd, prompt): rung = Rung(args[args.index("--model") + 1], args[args.index("--effort") + 1]) if "--agent" in args: shown = [subprocess.run(["git", *command], cwd=cwd, capture_output=True, text=True).stdout for command in (["show", "HEAD:a.txt"], ["branch", "--show-current"], ["show", "origin/main:a.txt"])] self.reviews.append((rung, *shown, prompt, cwd)) - result = {"type": "result", "result": f"review on {rung.model} {rung.effort}"} + result = review(rung) else: reviewed = Rung(*re.search(r"review on (\S+) (\S+)", prompt).groups()) result = found(reviewed) @@ -206,27 +232,70 @@ class Main(unittest.TestCase): self.assertIn(f" {self.checkout} 2026-10-14T10:00:00Z: 🟔 slow", out) self.assertTrue(out.endswith("finds: claude-sonnet-5-5 at high effort\n")) + def test_replays_the_rounds_of_every_chunk(self): + self.write_chunk("proj", "c2", "2026-10-14T10:30:00Z") + code, out, err = self.run_main(["claude-opus-5-5"], lambda rung: {"found": [0, 1]}) + self.assertEqual(code, 0, err) + self.assertTrue(out.startswith("Replayed 2 stability rounds"), out) + def test_checks_out_the_commit_detached_when_the_reviewer_started_on_the_default_branch(self): self.set_branch("main") self.assertEqual(self.run_main(["claude-opus-5-5"], lambda rung: {"found": [0]})[0], 0) self.assertEqual(self.reviews[0][1:3], ("1\n", "")) - def assert_left_out(self): + def test_sets_the_default_branch_to_its_own_line_and_not_to_a_branch_merged_after_the_chunk_began(self): + # Branch side's commit was authored before the chunk began, but the default branch held it only once merged, after. + run_git(self.checkout, "reset", "-q", "--hard", "HEAD~2") + run_git(self.checkout, "checkout", "-qb", "side") + (self.checkout / "a.txt").write_text("s\n") + run_git(self.checkout, "commit", "-qam", "s", at="2026-10-14T09:10:00Z") + run_git(self.checkout, "checkout", "-q", "main") + run_git(self.checkout, "merge", "-q", "--no-ff", "-m", "m", "side", at="2026-10-14T09:40:00Z") + run_git(self.checkout, "push", "-qf", "origin", "main") + self.assertEqual(self.run_main(["claude-opus-5-5"], lambda rung: {"found": [0]})[0], 0) + self.assertEqual(self.reviews[0][1:4], ("s\n", "x\n", "0\n")) + + def test_finds_nothing_in_a_round_whose_review_has_no_report(self): + code, out, err = self.run_main(["claude-opus-5-5"], unused, review=lambda rung: {"type": "result"}) + self.assertEqual(code, 0, err) + self.assertEqual([rung for rung, *_ in self.reviews], [REFERENCE] * 3) + self.assertIn(f" {self.checkout} 2026-10-14T10:00:00Z on {REFERENCE} found nothing: the reviewer replied with no report", err) + self.assertTrue(out.endswith("No rung tried: the reference reviewer found no finding to hold one to.\n")) + + def assert_no_round(self): code, _, err = self.run_main(["claude-opus-5-5"], unused) self.assertEqual(code, 1) - self.assertIn("1 of 1 rounds holding a šŸ”“ or 🟔 are left out", err) + self.assertEqual(err.splitlines(), [f"stability-replay: no archived stability round of projects on claude-opus-5-5 in {self.archive} holds a šŸ”“ or 🟔 on code it can find"]) + + def test_skips_a_chunk_with_no_transcript_copy(self): + (self.archive / "proj" / "c1" / "t0.jsonl").unlink() + self.assert_no_round() + + def test_skips_a_chunk_whose_transcript_copy_has_no_timestamp(self): + (self.archive / "proj" / "c1" / "t0.jsonl").write_text(json.dumps({"type": "summary"}) + "\n") + self.assert_no_round() + + def assert_left_out(self, reason, root=None): + code, _, err = self.run_main(["claude-opus-5-5"], unused) + self.assertEqual(code, 1) + self.assertIn(f"{root or self.checkout} 2026-10-14T10:00:00Z is left out: {reason}", err) def test_leaves_out_a_round_whose_prompt_names_no_worktree(self): self.set_prompt("Review the branch.") - self.assert_left_out() + self.assert_left_out("the prompt names no one worktree") def test_leaves_out_a_round_whose_checkout_names_no_default_branch(self): run_git(self.checkout, "remote", "set-head", "origin", "-d") - self.assert_left_out() + self.assert_left_out("git symbolic-ref --short refs/remotes/origin/HEAD: ") def test_leaves_out_a_round_whose_checkout_is_gone(self): shutil.rmtree(self.checkout) - self.assert_left_out() + # With no folder under ~/code, the key names /proj. + self.assert_left_out("the project has no checkout", "/proj") + + def test_leaves_out_a_round_whose_chunk_began_before_the_checkouts_first_commit(self): + self.write_chunk("proj", "c1", "2026-10-14T10:00:00Z", began="2026-10-14T08:00:00Z") + self.assert_left_out("no commit was authored by then") def test_exits_1_on_a_usage_limit_bad_arguments_or_no_round_to_replay(self): code, _, err = self.run_main(["claude-opus-5-5"], lambda rung: {"type": "result", "api_error_status": 429, "result": "You've hit your limit"})