Route the judge and the reviewers on the highest E + I in their chunk, an item the worker takes in included

This commit is contained in:
2026-10-16 23:36:39 +02:00
parent 0022ced569
commit 8ffb1979ea
14 changed files with 168 additions and 72 deletions
+6 -7
View File
@@ -61,16 +61,17 @@ def escalation_cap(anchor: Rung, route: Route) -> Rung:
return climbed(item_rung(anchor, route), ESCALATION_CAP)
def stepped(anchor: Rung, route: Route, bundled: int, escalated: bool) -> Route:
"""The route after one more unfinished verdict. Its rules, in order: the rung never falls below kept_rung; a bundled item lifts it to the rung that item's L picks; every second unfinished verdict steps it up one rung; so does an escalation the judge found, up to escalation_cap, two rungs above item_rung; and both steps on one verdict make one step.
def stepped(anchor: Rung, route: Route, bundled: int, escalated: bool, bundled_escape_and_impact: int = 0) -> Route:
"""The route after one more unfinished verdict. Its rules, in order: the rung never falls below kept_rung; a bundled item lifts it to the rung that item's L picks; every second unfinished verdict steps it up one rung; so does an escalation the judge found, up to escalation_cap, two rungs above item_rung; and both steps on one verdict make one step. The route keeps the highest E + I bundled so far, never a lower one.
bundled and escalated are the verdict's fields, not the verdict, since loop_claude.cycle.judge imports this module through prompts.
bundled, escalated and bundled_escape_and_impact are the verdict's fields, not the verdict, since loop_claude.cycle.judge imports this module through prompts.
"""
rung = taken_in(anchor, route, bundled)
unfinished = route.unfinished + 1
counted_out = unfinished >= UNFINISHED_PER_STEP
# The judge found the escalation trigger the worker cited in asking for a higher rung.
escalates = escalated and position(rung) < position(escalation_cap(anchor, route))
route = dataclasses.replace(route, escape_and_impact_taken_in=max(route.escape_and_impact_taken_in, bundled_escape_and_impact))
if counted_out or escalates:
return dataclasses.replace(route, rung=stepped_up(rung), unfinished=0)
return dataclasses.replace(route, rung=rung, unfinished=unfinished)
@@ -82,13 +83,11 @@ 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's E + I picks for a review, counted from the judge model's cheapest rung and never below it, whatever rung the worker stepped to.
An item the worker takes in beyond the routed one lifts the worker's rung, through taken_in, but not the judge's, until todo.md item 153 lifts the judge too.
"""The rung the route's reviewed_on E + I picks for a review, counted from the judge model's cheapest rung and never below it, whatever rung the worker stepped to.
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 review_floor(anchor, route.escape_and_impact)
return review_floor(anchor, route.reviewed_on())