Answer stability round 2: 0 🔴, 2 🟡; take the next release as the earliest todo.md has named since the last cut, so an emptied patch or a major jump stops the loop too, count work landed by the Unreleased entries before commits, read the default branch once, and test the emptied release and the stalled origin through real git

This commit is contained in:
2026-10-17 02:34:15 +02:00
parent 4cf3c2bd8c
commit 5ba8920dbf
13 changed files with 224 additions and 142 deletions
+11 -4
View File
@@ -52,7 +52,8 @@ Where that model is on the routing ladder (bin/model_routing/ladder.py), the wor
interrupt run on one of the ladder's rungs: a model at an effort. As a chunk starts, todo.md on the
default branch, as chunk-preflight has just fetched it, routes it on the item the preflight names
(todo_table.chunk_item): the earliest release's top item that does not wait, where that release is
the one after the newest v* tag, or there is no such tag. An item waits while it is marked
the next, the earliest after the newest v* tag that todo.md has named since that tag, or there is no
such tag; else no item routes it. An item waits while it is marked
question, or while an item that blocks it is still in the table. The item's L
picks the worker's rung, stepping from the model's cheapest rung by WORKER_STEPS in
bin/model_routing/ladder.py, below it for a low L; without such an item, or with its L, E or I
@@ -155,7 +156,7 @@ from loop_claude.loop.routing_check import check_routing
from loop_claude.project.checkout import checkout_root
from loop_claude.cycle.run import Cycle, run_cycle
from loop_claude.loop.reload import decode_handed, exec_if_edited, fingerprint, LoopRun, RELOAD_FLAG
from git_repo import default_plan, DefaultPlan
from git_repo import default_plan, default_ref, DefaultPlan
from loop_claude.effects import Effects
from failure import Failure
from loop_claude.cycle.judge import Finished, Unfinished
@@ -214,7 +215,7 @@ def run_loop(argv: list[str], env: typing.Mapping[str, str], paths: Paths, launc
facts = "" if session_open(session) else chunk_facts(launcher.with_name("chunk-preflight"), loop_run.root, effects)
anchor = project_rung(models.worker)
root = loop_run.root
loop_run = routed(loop_run, anchor, lambda: archived_route(archive_folder, session), lambda: plan_item(default_plan(root, ORIGIN_TIMEOUT)))
loop_run = routed(loop_run, anchor, lambda: archived_route(archive_folder, session), lambda: plan_item(fetched_plan(root)))
route = loop_run.route or Route(Rung(models.worker))
print(f"\n=== cycle {loop_run.cycle_number}, worker on {route.rung} ===", flush=True)
verdict = run_cycle(Cycle(anchor=anchor, effects=effects, facts=facts, judge_model=models.judge, paths=paths, premises=premises, project_archive=archive_folder, records=records, root=loop_run.root, route=route, session=session, task=loop_run.task, unfinished_evidence=loop_run.unfinished_evidence))
@@ -270,6 +271,12 @@ def chunk_facts(preflight: pathlib.Path, root: str, effects: Effects) -> str:
return prompts.preflight_facts(done.stdout.strip())
def fetched_plan(root: str) -> DefaultPlan | Failure:
"""What the default branch, as chunk-preflight's fetch left it, holds for routing."""
ref = default_ref(root, ORIGIN_TIMEOUT)
return ref if isinstance(ref, Failure) else default_plan(root, ref)
def plan_item(plan: DefaultPlan | Failure) -> Item | None:
"""The item that routes a chunk, from the default branch as git_repo.default_plan reads it, as chunk-preflight does, so both take todo_table.chunk_item's pick. None without one, so the chunk runs on the project's rung."""
if isinstance(plan, Failure):
@@ -277,7 +284,7 @@ def plan_item(plan: DefaultPlan | Failure) -> Item | None:
elif isinstance(plan.todo, Failure):
item = plan.todo
else:
item = routed_item(plan.todo, plan.tag, plan.commits)
item = routed_item(plan.todo, plan.cut)
if isinstance(item, Failure):
print(f"routing on the project's rung: {item.reason}", file=sys.stderr)
return None