Answer stability round 1: 0 🔴, 5 🟡; tell the resumed worker its stepped rung, rename the step for rulings, build NAMES_A_WORKER from the verdict constants, and test the capped answer and a failed interrupt archive

This commit is contained in:
2026-10-17 22:37:11 +02:00
parent fc24e9bae2
commit 5b536afdf9
8 changed files with 73 additions and 28 deletions
+4 -4
View File
@@ -9,7 +9,7 @@ from loop_claude.effects import Effects
from failure import Failure
from loop_claude.cycle.judge import Finished, Interrupt, judge, QuotedAnswer, Rejected, Unfinished, Verdict
from loop_claude.cycle.interrupt import interrupt
from loop_claude.routing import judge_rung, stepped_by_interrupt
from loop_claude.routing import judge_rung, stepped_by_ruling
from transcript_archive import outcomes
from loop_claude.paths import Paths
from loop_claude.cycle import prompts
@@ -49,7 +49,7 @@ class Cycle:
@dataclasses.dataclass(frozen=True)
class Concluded:
"""How a cycle ended: its verdict, and the route it ended on, which an interrupt's escalation may have stepped up from the route it began on."""
"""How a cycle ended: its verdict, and the route it ended on, which an interrupt's or a quoted answer's escalation may have stepped up from the route it began on."""
verdict: Finished | Unfinished
route: Route
@@ -73,7 +73,7 @@ def escalated(cycle: Cycle, event: Event) -> Cycle:
cycle = dataclasses.replace(cycle, stepped_from=None)
if not (isinstance(event, Ruled) and isinstance(event.verdict, Interrupt | QuotedAnswer) and event.verdict.escalation):
return cycle
route = stepped_by_interrupt(cycle.anchor, cycle.route, event.verdict.bundled) if cycle.anchor else cycle.route
route = stepped_by_ruling(cycle.anchor, cycle.route, event.verdict.bundled) if cycle.anchor else cycle.route
return dataclasses.replace(cycle, route=route, stepped_from=cycle.route if route != cycle.route else None, escalation_spent=True)
@@ -122,7 +122,7 @@ def worker_environment(cycle: Cycle) -> dict[str, str]:
def worker_start(cycle: Cycle, answered: QuotedAnswer | None) -> list[str]:
if answered is not None:
return worker_args(cycle.session, cycle.route.rung, prompts.answered(answered.question, answered.answer), resume=True)
return worker_args(cycle.session, cycle.route.rung, prompts.answered(answered.question, answered.answer, cycle.route, cycle.anchor, cycle.stepped_from is not None), resume=True)
if session_open(cycle.session):
return worker_args(cycle.session, cycle.route.rung, prompts.resumed(cycle.unfinished_evidence, cycle.route, cycle.anchor), resume=True)
return worker_args(cycle.session, cycle.route.rung, prompts.fresh(cycle.task, cycle.premises, cycle.route, cycle.anchor, cycle.facts), resume=False)