Step the worker up as the judge interrupts when the run also cites an escalation trigger

This commit is contained in:
2026-10-17 21:57:11 +02:00
parent 4474182174
commit 1c503e8818
14 changed files with 142 additions and 57 deletions
+9 -5
View File
@@ -81,7 +81,9 @@ E + I, or the routed item's (Route.reviewed_on in bin/model_routing/route.py). A
scale counts as none. Every second unfinished verdict on a chunk steps it up one rung
(routing.stepped). So does an unfinished verdict on a worker that ended its run asking for a
higher rung, once the judge quotes the transcript showing that the escalation trigger it named
fired (~/.claude/CLAUDE.md → "Working with the codebase" lists them). That step stops two rungs
fired (~/.claude/CLAUDE.md → "Working with the codebase" lists them); an interrupt with such a quote
steps the rung as it comes in, before the human is asked, and the verdict after it steps nothing on
the same quote (routing.stepped_by_interrupt). That step stops two rungs
above the rung the chunk's item picks, and the worker's prompts offer it only while the worker is
below that limit. Each finished or unfinished verdict, stop and step-up in the archive names the
worker's rung, with the item, L and E + I that routed the chunk, and any taken-in E + I that picks a
@@ -221,10 +223,12 @@ def run_loop(argv: list[str], env: typing.Mapping[str, str], paths: Paths, launc
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))
if isinstance(verdict, Stop):
return verdict
before, loop_run = loop_run.route, after_verdict(loop_run, anchor, verdict)
concluded = 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))
if isinstance(concluded, Stop):
return concluded
# A route the cycle stepped up as the judge interrupted counts as the one the verdict steps from.
ended = dataclasses.replace(loop_run, route=concluded.route) if loop_run.route else loop_run
before, loop_run = loop_run.route, after_verdict(ended, anchor, concluded.verdict)
if stop := archive_step(archive_folder, session, loop_run, before, effects):
return stop
if stop := check_routing(archive_root(paths.home, env), anchor or Rung(models.worker), paths, effects):