diff --git a/bin/loop_claude/cycle/judge.py b/bin/loop_claude/cycle/judge.py index 4e50ccf9..ef339931 100644 --- a/bin/loop_claude/cycle/judge.py +++ b/bin/loop_claude/cycle/judge.py @@ -168,7 +168,7 @@ def run_judge(root: str, args: list[str], prompt: str, grounds: Grounds, effects def quotes_checked(verdict: Verdict, grounds: Grounds) -> Verdict: """The verdict with its quoted answer and its escalation checked, as Grounds says; a quoted answer put to the human keeps the escalation it carried.""" if isinstance(verdict, QuotedAnswer) and not verbatim(verdict.answer, grounds.quotable): - verdict = Interrupt(verdict.evidence, verdict.question, verdict.escalation, verdict.highest_likelihood_taken_in) + verdict = Interrupt(verdict.evidence, verdict.question, escalation=verdict.escalation, highest_likelihood_taken_in=verdict.highest_likelihood_taken_in) if isinstance(verdict, Interrupt | QuotedAnswer | Unfinished) and verdict.escalation and not (verbatim(verdict.escalation, grounds.since_step) and verbatim(verdict.escalation, grounds.shown)): return dataclasses.replace(verdict, escalation="") return verdict diff --git a/bin/loop_claude/test_loop_claude.py b/bin/loop_claude/test_loop_claude.py index ca79bb40..66c1b5e1 100644 --- a/bin/loop_claude/test_loop_claude.py +++ b/bin/loop_claude/test_loop_claude.py @@ -941,15 +941,18 @@ class RouteSources(unittest.TestCase): with tempfile.TemporaryDirectory() as home: opened = session.session_named("A proj loop-claude", pathlib.Path(home, "projects")) archive = pathlib.Path(home, "archive") - self.assertIsNone(main.archived_route(archive, opened)) transcript = pathlib.Path(home, "projects", "-fake", f"{opened.id}.jsonl") - transcript.parent.mkdir(parents=True) - transcript.write_text(json.dumps({"type": "queue-operation", "timestamp": "1"}) + "\n") - self.assertIsNone(main.archived_route(archive, opened)) route = Route(Rung("claude-opus-5-5", "high"), 3, 4, 5) + with contextlib.redirect_stderr(io.StringIO()) as stderr: + self.assertIsNone(main.archived_route(archive, opened)) + transcript.parent.mkdir(parents=True) + transcript.write_text(json.dumps({"type": "queue-operation", "timestamp": "1"}) + "\n") + self.assertIsNone(main.archived_route(archive, opened)) with contextlib.redirect_stderr(io.StringIO()): self.assertIsNone(write.archive(archive, str(transcript), "Do it.", outcomes.unfinished(route.record(), "working", "j", ""), NOW)) - self.assertEqual(main.archived_route(archive, opened), route) + with contextlib.redirect_stderr(stderr): + self.assertEqual(main.archived_route(archive, opened), route) + self.assertEqual(stderr.getvalue(), "") with contextlib.redirect_stderr(io.StringIO()): self.assertIsNone(write.archive(archive, str(transcript), "Do it.", outcomes.stepped_up(Record('{"model": "claude-opus-5-5", "rung": 3}')), NOW + 1)) with contextlib.redirect_stderr(io.StringIO()) as stderr: