Pin a reason per incomplete verdict, the rerun hint off a terminal, and which claude could not start

This commit is contained in:
2026-09-28 16:48:46 +02:00
parent cd9c0fe4a6
commit 7b1ee20c7c
2 changed files with 13 additions and 13 deletions
+7 -8
View File
@@ -271,7 +271,7 @@ class Interrupt(unittest.TestCase):
transcript = os.path.join(root, "session.jsonl")
pathlib.Path(transcript).write_text("{}\n")
with unittest.mock.patch("sys.stdin.isatty", return_value=False):
self.assertEqual(interrupt.interrupt(root, SESSION_ID, "m", transcript, "q?", paths_from(pathlib.Path(root), {})), Stop(2, "the human is needed to answer the question above, but stdin or stdout is not a terminal"))
self.assertEqual(interrupt.interrupt(root, SESSION_ID, "m", transcript, "q?", paths_from(pathlib.Path(root), {})), Stop(2, "the human is needed to answer the question above, but stdin or stdout is not a terminal; rerun loop-claude on a terminal"))
with (
unittest.mock.patch("sys.stdin.isatty", return_value=True),
unittest.mock.patch("sys.stdout.isatty", return_value=True),
@@ -348,12 +348,11 @@ class Grounded(unittest.TestCase):
class Verdict(unittest.TestCase):
def test_needs_every_field_the_schema_requires(self):
self.assertTrue(judge.complete({"interrupt": False, "evidence": "", "finished": True, "question": ""}))
self.assertFalse(judge.complete({"interrupt": "no", "evidence": "", "finished": True, "question": ""}))
self.assertFalse(judge.complete({"interrupt": False, "evidence": None, "finished": True, "question": ""}))
self.assertFalse(judge.complete({"interrupt": False}))
self.assertFalse(judge.complete({"interrupt": True, "evidence": "x", "finished": False, "question": " "}))
self.assertFalse(judge.complete(None))
self.assertIsNone(judge.incomplete({"interrupt": False, "evidence": "", "finished": True, "question": ""}))
self.assertEqual(judge.incomplete({"interrupt": "no", "evidence": "", "finished": True, "question": ""}), "the judge's verdict has no interrupt of type boolean")
self.assertEqual(judge.incomplete({"interrupt": False, "evidence": None, "finished": True, "question": ""}), "the judge's verdict has no evidence of type string")
self.assertEqual(judge.incomplete({"interrupt": True, "evidence": "x", "finished": False, "question": " "}), "the judge interrupted without a question")
self.assertEqual(judge.incomplete(None), "the judge returned no verdict")
STUB_CLAUDE = """#!/usr/bin/env python3
@@ -411,7 +410,7 @@ class RunCycle(unittest.TestCase):
self.assertEqual(cycle.run_cycle(home, "task", "premises", OPUS, paths), Continue())
pathlib.Path(verdicts).write_text("interrupt")
with unittest.mock.patch("sys.stderr") as stderr:
self.assertEqual(cycle.run_cycle(home, "task", "premises", OPUS, paths), Stop(2, "the human is needed to answer the question above, but stdin or stdout is not a terminal"))
self.assertEqual(cycle.run_cycle(home, "task", "premises", OPUS, paths), Stop(2, "the human is needed to answer the question above, but stdin or stdout is not a terminal; rerun loop-claude on a terminal"))
self.assertIn(f"transcript: {paths.archive}", "".join(str(call.args[0]) for call in stderr.write.call_args_list))
pathlib.Path(verdicts).write_text("interrupt fail fail fail")
with unittest.mock.patch("sys.stderr"), unittest.mock.patch.object(cycle, "interrupt", return_value=None):