Accept an escalation quote only from transcript entries after the worker's last step-up

This commit is contained in:
2026-10-18 13:24:05 +02:00
parent 07369f1164
commit 3a8e4e6f75
12 changed files with 160 additions and 125 deletions
+8 -6
View File
@@ -89,12 +89,13 @@ scale counts as none. Every second unfinished verdict on a chunk steps it up one
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). An interrupt or a quoted answer
with such a quote steps the rung as it comes in, before the human is asked or the worker resumes
(routing.stepped_by_ruling), and no later ruling of that cycle carries a second escalation. Each step
(routing.stepped_by_ruling). Each escalation's step marks how many transcript entries the session held,
and the judge's quote of a later trigger counts only from the entries after that mark. Each step
on an escalation 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, interrupt,
quoted answer, 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 higher review rung, which is archived as
a step-up too. A rerun resumes an open chunk on the latest
that routed the chunk, any taken-in E + I that picks a higher review rung, which is archived as
a step-up too, and the escalation's mark. A rerun resumes an open chunk on the latest
route named there, and counts its unfinished verdicts afresh. A rung no longer on the ladder, or
below the one its item's L picks, is dropped, and the chunk is routed afresh from todo.md. So is a
chunk whose archived line names an R + C, as loop-claude wrote before it routed on L. A todo.md or
@@ -236,7 +237,7 @@ def run_loop(argv: list[str], env: typing.Mapping[str, str], paths: Paths, launc
return concluded
# The route the cycle ended on, which a step-up at an interrupt or a quoted answer may have raised and archived, is the one the verdict steps from.
ended = dataclasses.replace(loop_run, route=concluded.route if anchor else None)
before, loop_run = ended.route, after_verdict(ended, anchor, concluded.verdict)
before, loop_run = ended.route, after_verdict(ended, anchor, concluded.verdict, concluded.judged)
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):
@@ -252,10 +253,11 @@ def routed(loop_run: LoopRun, anchor: Rung | None, archived: typing.Callable[[],
return dataclasses.replace(loop_run, route=route if route and kept(route, anchor) else first_route(anchor, item()))
def after_verdict(loop_run: LoopRun, anchor: Rung | None, verdict: Finished | Unfinished) -> LoopRun:
def after_verdict(loop_run: LoopRun, anchor: Rung | None, verdict: Finished | Unfinished, judged: int) -> LoopRun:
"""The loop run after the cycle's verdict; judged is how many transcript entries its judge read."""
if isinstance(verdict, Finished):
return dataclasses.replace(loop_run, route=None, unfinished_evidence="")
route = stepped(anchor, loop_run.route, verdict.bundled, bool(verdict.escalation)).taking_in(verdict.bundled_escape_and_impact) if anchor and loop_run.route else loop_run.route
route = stepped(anchor, loop_run.route, verdict.bundled, judged if verdict.escalation else None).taking_in(verdict.bundled_escape_and_impact) if anchor and loop_run.route else loop_run.route
return dataclasses.replace(loop_run, route=route, unfinished_evidence=verdict.evidence)