Answer architecture round 3: 0 🔴, 1 🟡; pick the next chunk's item in one function, todo_table.chunk_item, which routing and the preflight both call, so routing names no item where the release after the last cut has none

This commit is contained in:
2026-10-17 02:19:11 +02:00
parent 45004e1b0b
commit 4cf3c2bd8c
9 changed files with 130 additions and 95 deletions
+14 -8
View File
@@ -50,9 +50,10 @@ for the worker and the interrupt; with both set, nothing is asked.
Where that model is on the routing ladder (bin/model_routing/ladder.py), the worker and the
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: its earliest release's top item
that does not wait, the item the preflight states where that release is the next. An item waits
while it is marked question, or while an item that blocks it is still in the table. The item's L
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
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
unscored, the chunk runs on the model's cheapest rung. The
@@ -154,7 +155,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_branch_todo
from git_repo import default_plan, DefaultPlan
from loop_claude.effects import Effects
from failure import Failure
from loop_claude.cycle.judge import Finished, Unfinished
@@ -213,7 +214,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_branch_todo(root, ORIGIN_TIMEOUT)))
loop_run = routed(loop_run, anchor, lambda: archived_route(archive_folder, session), lambda: plan_item(default_plan(root, ORIGIN_TIMEOUT)))
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))
@@ -269,9 +270,14 @@ def chunk_facts(preflight: pathlib.Path, root: str, effects: Effects) -> str:
return prompts.preflight_facts(done.stdout.strip())
def plan_item(todo: str | Failure) -> Item | None:
"""The item that routes a chunk, from todo.md as git_repo.default_branch_todo reads it, as chunk-preflight does, so both take todo_table.next_item's pick. None without one, so the chunk runs on the project's rung."""
item = todo if isinstance(todo, Failure) else routed_item(todo)
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):
item: Item | Failure | None = plan
elif isinstance(plan.todo, Failure):
item = plan.todo
else:
item = routed_item(plan.todo, plan.tag, plan.commits)
if isinstance(item, Failure):
print(f"routing on the project's rung: {item.reason}", file=sys.stderr)
return None