From bdfe20a65c749fb38453835b7142ae3431ee9f8f Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 14 Oct 2026 23:28:09 +0200 Subject: [PATCH] =?UTF-8?q?Answer=20stability=20round=202:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=201=20=F0=9F=9F=A1;=20test=20a=20failed=20step-up?= =?UTF-8?q?=20archive,=20rename=20NAMES=5FA=5FWORKER,=20and=20take=20the?= =?UTF-8?q?=20product-owner's=20wording=20for=20help=20and=20the=20worker?= =?UTF-8?q?=20prompt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/loop_claude/cycle/prompts.py | 2 +- bin/loop_claude/loop/main.py | 14 +++++++------- bin/loop_claude/test_black_box.py | 2 +- bin/loop_claude/test_loop_claude.py | 6 +++++- bin/transcript_archive/outcomes.py | 8 ++++---- 5 files changed, 18 insertions(+), 14 deletions(-) diff --git a/bin/loop_claude/cycle/prompts.py b/bin/loop_claude/cycle/prompts.py index 103f03ed..d8e0c0d7 100644 --- a/bin/loop_claude/cycle/prompts.py +++ b/bin/loop_claude/cycle/prompts.py @@ -20,7 +20,7 @@ def fresh(task: str, premises: str, route: Route) -> str: def routed_by(route: Route) -> str: - return f"loop-claude runs you on {route.rung}, the rung item {route.item}'s R + C of {route.risk_and_complexity} picks. When the chunk takes in another todo.md item, say so, naming that item and its R + C." + return f"loop-claude runs you on {route.rung}, the rung item {route.item}'s R + C of {route.risk_and_complexity} picks. Name each todo.md item this chunk takes, with its R + C, whether or not it is item {route.item}." def resumed(unfinished_evidence: str) -> str: diff --git a/bin/loop_claude/loop/main.py b/bin/loop_claude/loop/main.py index 507ad473..eeebf30b 100644 --- a/bin/loop_claude/loop/main.py +++ b/bin/loop_claude/loop/main.py @@ -45,13 +45,13 @@ interrupt run on a rung of it instead: a model at an effort. As a chunk starts, todo.md's top item in the next release, skipping a question, picks the rung from the model's cheapest one, and never below it; without such an item, or with a C missing, the chunk runs on the model's cheapest rung. The worker's first prompt names the rung and the item, and asks it to name -each other item the chunk takes in, with its R + C. The judge reports the highest R + C it sees the -worker state, and the next cycle steps up to the rung that picks, never down. Every second -unfinished verdict on a chunk steps it up one rung. A rung an edit took off the ladder counts as -the model's cheapest. Each verdict, stop and step up archived names the worker's rung, with the -item and R + C that routed the chunk; a rerun resumes an open chunk on the latest rung named there, -while that is at or above the model's cheapest, and counts its unfinished verdicts afresh. A todo.md that cannot be read or parsed is said on stderr, -and the chunk runs on the model's cheapest rung. +each item the chunk takes, with its R + C. The judge reports the highest R + C it sees the worker +state, and the next cycle steps up to the rung that picks, never down. Every second unfinished +verdict on a chunk steps it up one rung. Each verdict, stop and step up archived names the worker's +rung, with the item and R + C that routed the chunk; a rerun resumes an open chunk on the latest +rung named there, and counts its unfinished verdicts afresh. A rung no longer on the ladder, or +below the model's cheapest, is dropped, and the chunk is routed afresh from todo.md. A todo.md or +an archive that cannot be read or parsed is said on stderr, and the chunk is routed without it. A change to bin/loop-claude or any bin/**/*.py takes effect at the next cycle boundary, once loop-claude --help succeeds: the loop reloads into the edited script. diff --git a/bin/loop_claude/test_black_box.py b/bin/loop_claude/test_black_box.py index a6d487ff..11d9c2f2 100644 --- a/bin/loop_claude/test_black_box.py +++ b/bin/loop_claude/test_black_box.py @@ -390,7 +390,7 @@ class Cycles(unittest.TestCase): ("claude-opus-5-5", "high"), ]) self.assertEqual({(argument(call, "--model"), argument(call, "--effort")) for call in run.calls if call["role"] == "judge"}, {("judge-model", None)}) - self.assertIn("loop-claude runs you on claude-opus-5-5 at high effort, the rung item 4's R + C of 11 picks. When the chunk takes in another todo.md item, say so, naming that item and its R + C.", argument(workers[0], "-p")) + self.assertIn("loop-claude runs you on claude-opus-5-5 at high effort, the rung item 4's R + C of 11 picks. Name each todo.md item this chunk takes, with its R + C, whether or not it is item 4.", argument(workers[0], "-p")) outcomes = sorted(verdict.removeprefix(f"Task: {TASK}\n\n") for verdict in checkout.archived().values()) self.assertIn(" Verdict: unfinished\n\nEvidence:\n> three\n\nWorker: claude-opus-5-5 at xhigh effort, routed by item 4's R + C of 11\n\n Stepped up\n\nWorker: claude-fable-5-1 at max effort, routed by item 4's R + C of 11\n", outcomes) self.assertIn(" Verdict: finished\n\nEvidence:\n> four\n\nWorker: claude-fable-5-1 at max effort, routed by item 4's R + C of 11\n", outcomes) diff --git a/bin/loop_claude/test_loop_claude.py b/bin/loop_claude/test_loop_claude.py index c79f2e98..a7e47480 100644 --- a/bin/loop_claude/test_loop_claude.py +++ b/bin/loop_claude/test_loop_claude.py @@ -514,12 +514,16 @@ class Steps(unittest.TestCase): self.assertEqual(main.archived_route(archive, opened), routing.Route(Rung("claude-opus-5-5", "xhigh"), 3, 9)) self.assertIsNone(main.archive_step(archive, opened, after, after.route, FakeEffects().effects())) self.assertIsNone(main.archive_step(archive, opened, after, None, FakeEffects().effects())) + blocked = pathlib.Path(home, "blocked") + blocked.write_text("") + stop = main.archive_step(blocked, opened, after, before, FakeEffects().effects()) + self.assertEqual((stop.code, stop.reason.split(":")[0]), (1, "could not archive the transcript")) class WorkerArgs(unittest.TestCase): def test_names_the_route_in_a_fresh_prompt_only_where_an_item_routed_it(self): routed = prompts.fresh("Do it.", "## Goals", routing.Route(Rung("m", "high"), 3, 11)) - self.assertIn("Continue any open draft PR or worktree for the chunk before creating a new one.\n\nloop-claude runs you on m at high effort, the rung item 3's R + C of 11 picks. When the chunk takes in another todo.md item, say so, naming that item and its R + C.\n\nThe chunk's", routed) + self.assertIn("Continue any open draft PR or worktree for the chunk before creating a new one.\n\nloop-claude runs you on m at high effort, the rung item 3's R + C of 11 picks. Name each todo.md item this chunk takes, with its R + C, whether or not it is item 3.\n\nThe chunk's", routed) unrouted = prompts.fresh("Do it.", "## Goals", routing.Route(Rung("m"))) self.assertIn("before creating a new one.\n\nThe chunk's", unrouted) self.assertNotIn("loop-claude runs you on", unrouted) diff --git a/bin/transcript_archive/outcomes.py b/bin/transcript_archive/outcomes.py index 8e0bfe11..67df3265 100644 --- a/bin/transcript_archive/outcomes.py +++ b/bin/transcript_archive/outcomes.py @@ -5,9 +5,9 @@ from utc_stamp import STAMPED FINISHED = "Verdict: finished" FINISHED_AT = re.compile(rf"^({STAMPED}) {re.escape(FINISHED)}$", re.MULTILINE) -# An outcome opens with its UTC stamp; a verdict that closes a cycle, or a stop, ends with the worker line. +# An outcome opens with its UTC stamp; a verdict that closes a cycle, a stop, or a step up ends with the worker line. OUTCOME_AT = re.compile(rf"^({STAMPED}) ", re.MULTILINE) -CLOSES_A_CYCLE = ("Verdict: finished\n", "Verdict: unfinished\n", "Stopped: ", "Stepped up\n") +NAMES_A_WORKER = ("Verdict: finished\n", "Verdict: unfinished\n", "Stopped: ", "Stepped up\n") WORKER = "Worker: " @@ -37,12 +37,12 @@ def stopped(worker: str, why: str) -> str: def workers(outcomes: str) -> list[tuple[str, str]]: - """The UTC stamp and the worker of each outcome that closes a cycle, in the order they were written.""" + """The UTC stamp and the worker of each outcome that names one, in the order they were written.""" starts = list(OUTCOME_AT.finditer(outcomes)) found = [] for start, after in zip(starts, [*starts[1:], None]): outcome = outcomes[start.end():after.start() if after else len(outcomes)].rstrip("\n") last = outcome.rsplit("\n", 1)[-1] - if outcome.startswith(CLOSES_A_CYCLE) and last.startswith(WORKER): + if outcome.startswith(NAMES_A_WORKER) and last.startswith(WORKER): found.append((start[1], last.removeprefix(WORKER))) return found