Answer stability round 2: 0 🔴, 1 🟡; test a failed step-up archive, rename NAMES_A_WORKER, and take the product-owner's wording for help and the worker prompt
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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("<UTC> 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<UTC> Stepped up\n\nWorker: claude-fable-5-1 at max effort, routed by item 4's R + C of 11\n", outcomes)
|
||||
self.assertIn("<UTC> 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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user