From f58fe5a9dbee2334e1abae0f9e38ab696d61c2a1 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Fri, 23 Oct 2026 03:53:14 +0200 Subject: [PATCH] =?UTF-8?q?Answer=20stability=20round=202:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=201=20=F0=9F=9F=A1;=20name=20when=20a=20replay=20?= =?UTF-8?q?applies=20in=20ladder.py=20and=20have=20chosen=20find=20the=20h?= =?UTF-8?q?igher=20E=20+=20I=20that=20end=20it,=20so=20a=20top-rung=20proj?= =?UTF-8?q?ect=20keeps=20them?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/model_routing/ladder.py | 7 ++++++- bin/model_routing/review_choice.py | 11 ++++++----- bin/model_routing/test_review_choice.py | 9 +++------ 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/bin/model_routing/ladder.py b/bin/model_routing/ladder.py index 6ca2333a..9e8e0f14 100644 --- a/bin/model_routing/ladder.py +++ b/bin/model_routing/ladder.py @@ -105,11 +105,16 @@ def review_rungs(project: Rung, worker: Rung, escape_and_impact: int) -> dict[Re A pass's reviewer runs on reviewers_rung. Where the E + I steps no review up and the worker runs no higher than the project's rung, a pass whose replay chose a rung for the project's model runs on that rung instead, even below the worker's: the replay compared reviews on the project's rung only, never on a rung an E + I stepped up, nor of a chunk whose worker climbed above the project's rung. A seat and the security pass run on the project's rung, so the seats score every chunk on one rung, and the security pass spends no more than the project chose. """ rungs: dict[ReviewKind, Rung] = {**dict.fromkeys(REVIEWERS, reviewers_rung(project, worker, escape_and_impact)), "seat": project, "security": project} - if escape_and_impact not in REVIEW_STEPS and position(worker) <= position(project): + if replay_applies(project, worker, escape_and_impact): rungs |= {kind: rung for (kind, model), rung in REPLAYED.items() if model == project.model} return rungs +def replay_applies(project: Rung, worker: Rung, escape_and_impact: int) -> bool: + """Whether a pass's replay chose its rung for a chunk like this: only where the E + I steps no review up and the worker runs no higher than the project's rung.""" + return escape_and_impact not in REVIEW_STEPS and position(worker) <= position(project) + + def reviewers_rung(project: Rung, worker: Rung, escape_and_impact: int) -> Rung: """The rung of each pass's reviewer that no replay lowered: the higher of the worker's rung and review_floor's.""" return highest(worker, review_floor(project, escape_and_impact)) diff --git a/bin/model_routing/review_choice.py b/bin/model_routing/review_choice.py index d1226387..b0b14c5a 100644 --- a/bin/model_routing/review_choice.py +++ b/bin/model_routing/review_choice.py @@ -2,7 +2,7 @@ import dataclasses from model_routing.route import HIGHEST_ESCAPE_AND_IMPACT, Route -from model_routing.ladder import review_rungs, reviewers_rung, Rung +from model_routing.ladder import replay_applies, review_rungs, reviewers_rung, Rung from review_passes import ReviewedPass, REVIEWERS @@ -14,7 +14,7 @@ class ReviewChoice: lowered: dict[ReviewedPass, Rung] seat: Rung security: Rung - # Each rung that a higher E + I than the route's picks for the reviewers, with the lowest E + I that picks it, lowest E + I first, so a worker that takes in such an item reviews it on that rung in the same run. + # Each rung a higher E + I than the route's picks for the reviewers, with the lowest E + I that picks it, in rising order. higher: dict[Rung, int] @@ -22,10 +22,11 @@ def chosen(project: Rung, route: Route) -> ReviewChoice: """The rung each kind of review runs on for a chunk whose route is route, on a project whose rung is project.""" rungs = review_rungs(project, route.rung, route.reviewed_on()) reviewers = reviewers_rung(project, route.rung, route.reviewed_on()) + lowered = {kind: rungs[kind] for kind in REVIEWERS if rungs[kind] != reviewers} higher: dict[Rung, int] = {} for escape_and_impact in range(route.reviewed_on() + 1, HIGHEST_ESCAPE_AND_IMPACT + 1): - # A higher E + I changes a review only by moving the reviewers' rung: a replay lowers a pass only where the worker runs no higher than the project and the E + I steps no review up, and the first E + I that steps one up moves the reviewers too. + # A higher E + I changes a review by moving the reviewers' rung, or by ending the replay that lowered a pass. rung = reviewers_rung(project, route.rung, escape_and_impact) - if rung != reviewers: + if rung != reviewers or (lowered and not replay_applies(project, route.rung, escape_and_impact)): higher.setdefault(rung, escape_and_impact) - return ReviewChoice(reviewers, {kind: rungs[kind] for kind in REVIEWERS if rungs[kind] != reviewers}, rungs["seat"], rungs["security"], higher) + return ReviewChoice(reviewers, lowered, rungs["seat"], rungs["security"], higher) diff --git a/bin/model_routing/test_review_choice.py b/bin/model_routing/test_review_choice.py index 43488556..6b276cf5 100644 --- a/bin/model_routing/test_review_choice.py +++ b/bin/model_routing/test_review_choice.py @@ -8,21 +8,18 @@ from model_routing.ladder import Rung HAIKU = Rung("claude-haiku-5-5", "low") OPUS = Rung("claude-opus-5-5", "medium") -OPUS_HIGH = Rung("claude-opus-5-5", "high") -OPUS_XHIGH = Rung("claude-opus-5-5", "xhigh") OPUS_MAX = Rung("claude-opus-5-5", "max") FABLE = Rung("claude-fable-5-1", "max") SONNET = Rung("claude-sonnet-5-5", "high") -HIGHER = {OPUS_HIGH: 5, OPUS_XHIGH: 6, OPUS_MAX: 7, FABLE: 8} class Chosen(unittest.TestCase): def test_names_no_higher_rung_on_the_top_one(self): self.assertEqual(chosen(OPUS, Route(FABLE, 3, 4, 5)).higher, {}) - def test_puts_a_pass_a_replay_lowered_on_the_rung_the_replay_chose_while_no_e_plus_i_steps_a_review_up(self): - with unittest.mock.patch.dict(ladder.REPLAYED, {("prose", "claude-opus-5-5"): HAIKU}): - self.assertEqual(chosen(OPUS, Route(SONNET, 3, 2, 4)), ReviewChoice(OPUS, {"prose": HAIKU}, OPUS, OPUS, HIGHER)) + def test_names_the_e_plus_i_that_ends_a_replay_even_where_the_reviewers_are_on_the_top_rung(self): + with unittest.mock.patch.dict(ladder.REPLAYED, {("prose", "claude-fable-5-1"): HAIKU}): + self.assertEqual(chosen(FABLE, Route(OPUS_MAX, 3, 4, 4)), ReviewChoice(FABLE, {"prose": HAIKU}, FABLE, FABLE, {FABLE: 5})) def test_puts_every_pass_on_the_reviewers_rung_once_an_e_plus_i_steps_a_review_up(self): with unittest.mock.patch.dict(ladder.REPLAYED, {("prose", "claude-opus-5-5"): HAIKU}):