Skip to content

graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs

Python

Show the transcript when a PTY test's child exits early

Rach Pradhan0ce8fc805461
diff --git a/scripts/pty_harness.py b/scripts/pty_harness.py
index 554796c2..8d87fc6f 100755
--- a/scripts/pty_harness.py
+++ b/scripts/pty_harness.py
@@ -275,8 +275,14 @@ class PtySession:
if match:
return len(self.raw)
if self.poll() is not None:
+ # Drain what the child wrote last (a panic message, say): it is
+ # the evidence for why it exited.
+ while self.pump(0.05):
+ pass
+ tail = self.text[-2000:]
raise PtyFailure(
f"child exited with {self.exit_code} before matching {pattern.pattern!r}"
+ f"\n--- transcript tail ---\n{tail}"
)
remaining = deadline - time.monotonic()
if remaining <= 0: