Answer architecture round 1: 3 🔴, 7 🟡; read the items table by column name, let an item wait while its blocker is held in any order, fill this plan's blockers, file the judge's bundled rung as item 153

This commit is contained in:
2026-10-15 23:08:41 +02:00
parent 5b7da27a5a
commit 157ca50733
12 changed files with 173 additions and 113 deletions
+9 -16
View File
@@ -1,9 +1,9 @@
"""Which ladder rung a chunk's worker and judge run on: docs/decisions.md → `routing:`."""
import dataclasses
from model_routing.ladder import climbed, floored, highest, LADDER, picked, position, project_rung, Rung, stepped_up
from model_routing.ladder import climbed, highest, LADDER, picked, position, project_rung, Rung, stepped_up
from failure import Failure
from todo_table import Item, items
from todo_table import Item, items, waiting
from model_routing.route import Route
UNFINISHED_PER_STEP = 2
@@ -14,21 +14,14 @@ JUDGE_REPLAYED = ("claude-opus-5-5",)
def routed_item(todo: str) -> Item | Failure | None:
"""The next release's first row that waits on nothing, in the table's order, which rank_todo.py keeps with each blocker above the items it blocks; None when there is none, or it has no C.
An item waits on a question it is marked with, or on a blocker that waits.
"""
"""The next release's first row that waits on nothing, as todo_table.waiting says, in the table's order; None when there is none, or it has no C."""
found = items(todo)
if isinstance(found, Failure) or not found:
return found if isinstance(found, Failure) else None
next_release = min(item.release for item in found)
waiting: set[int] = set()
for item in found:
if item.exempt == "question" or waiting.intersection(item.blocked_by):
waiting.add(item.id)
elif item.release == next_release:
return item if item.risk_and_complexity else None
return None
waits = waiting(found)
takes = next((item for item in found if item.release == next_release and item.id not in waits), None)
return takes if takes and takes.risk_and_complexity else None
def first_route(anchor: Rung, item: Item | None) -> Route:
@@ -89,13 +82,13 @@ def taken_in(anchor: Rung, route: Route, bundled: int) -> Rung:
def judge_rung(judge_model: str, route: Route) -> Rung:
"""The rung the route's item picks from the judge model's cheapest rung, never below that rung, whatever rung the worker stepped to.
"""item_rung counted from the judge model's cheapest rung, never below that rung, whatever rung the worker stepped to.
An item the worker takes in besides moves the worker's rung but not the judge's.
An item the judge reports bundled lifts the worker, through taken_in, but not the judge, until todo.md item 153 has the judge follow it.
A model off the ladder, or not in JUDGE_REPLAYED, gets no effort flag, so claude runs it at the effort its settings give.
"""
anchor = project_rung(judge_model)
if anchor is None or judge_model not in JUDGE_REPLAYED:
return Rung(judge_model)
return floored(anchor, route.risk_and_complexity) if route.item else anchor
return highest(anchor, item_rung(anchor, route))