Answer stability round 1: 0 🔴, 3 🟡 (0 misread); test the flush and a leading indent, and the stamped transcript line

This commit is contained in:
2026-10-28 18:47:39 +01:00
parent c583900199
commit 9fc1392bc8
2 changed files with 19 additions and 2 deletions
+2 -1
View File
@@ -157,7 +157,7 @@ class Run:
code: int
sleeps: list
starts: list
# Without the local time that opens each message loop-claude prints.
# stderr and stdout are without the local time that opens each message loop-claude prints; raw_stderr and raw_stdout keep it.
stderr: str
stdout: str
raw_stderr: str
@@ -704,6 +704,7 @@ class Interrupt(unittest.TestCase):
self.assertEqual(verdict, f"Task: {TASK}\n\n<UTC> Verdict: interrupt\n\nA or B?\n\nEvidence:\n> Shall I use A or B?\n\nJudge: judge-model\nWorker: {OFF_LADDER}\n\n<UTC> Stopped: the human is needed to answer the question above, but stdin or stdout is not a terminal; rerun loop-claude on a terminal\n\nWorker: {OFF_LADDER}\n")
self.assertEqual(stat.S_IMODE((checkout.temp / "deep").stat().st_mode), 0o700)
self.assertIn(f"transcript: {checkout.archive() / 'proj'}/", run.stderr)
self.assertRegex(run.raw_stderr, rf"(?m)^{STAMP} transcript: ")
session = argument(run.calls[0], "--session-id")
run = checkout.run(steps, terminal_input="", stdout_on_terminal=False)
self.assertEqual((run.code, run.roles()), (2, ["worker", "judge"]))
+17 -1
View File
@@ -576,6 +576,22 @@ class Said(unittest.TestCase):
say("\n=== cycle 2 ===", FakeEffects().effects(), stdout=True)
self.assertEqual((stderr.getvalue(), stdout.getvalue()), ("", f"\n{STAMP} === cycle 2 ===\n"))
def test_keeps_the_indent_of_the_first_line_after_the_time(self):
with contextlib.redirect_stderr(io.StringIO()) as stderr:
say("\n indented", FakeEffects().effects())
self.assertEqual(stderr.getvalue(), f"\n{STAMP} indented\n")
def test_flushes_so_piped_lines_arrive_when_said(self):
flushes = []
class Counting(io.StringIO):
def flush(self):
flushes.append(self.getvalue())
with contextlib.redirect_stderr(Counting()):
say("hello", FakeEffects().effects())
self.assertEqual(flushes, [f"{STAMP} hello\n"])
class Limits(unittest.TestCase):
def test_the_worker_reports_the_latest_reset_its_stream_names(self):
@@ -1111,7 +1127,7 @@ class ChunkFacts(unittest.TestCase):
class LocalTime(unittest.TestCase):
def test_renders_seconds_in_the_machines_zone(self):
# A POSIX zone two hours ahead of UTC, so a time in UTC would read 14:13:20. Cleanups run last in, first out: the zone is restored before the clock rereads it.
# A POSIX zone two hours ahead of UTC, so a time in UTC would read 14:13:20. Cleanups run last in, first out: the zone is restored before time.tzset makes the clock read it again.
self.addCleanup(time.tzset)
zone = unittest.mock.patch.dict(os.environ, {"TZ": "XXX-2"})
zone.start()