Answer stability round 1: 0 🔴, 7 🟡; quote a judge's stdout that is no json, name each left-out round and why, test the string prompt, the miss sum, the args sent to claude and the skip paths, settle the judge's hard place in item 122

This commit is contained in:
2026-10-15 21:19:31 +02:00
parent 17f94b461a
commit 2752c2dae3
9 changed files with 136 additions and 41 deletions
+5 -3
View File
@@ -22,15 +22,17 @@ HEADLESS = ["--no-session-persistence", "--output-format", "json", "--permission
def claude_reply(claude: Claude, args: list[str], cwd: str, prompt: str, who: str) -> dict | Failure | Limited:
"""claude's json reply to `claude -p <args>` and HEADLESS, or why there is none; who names the run in the message for a non-zero exit, such as the judge."""
"""claude's json reply to `claude -p <args>` and HEADLESS, or why there is none; who names the run in the message for a non-zero exit or a reply that is no json, such as the judge."""
try:
proc = claude(["-p", *args, *HEADLESS], cwd, prompt)
except OSError as failure:
return Failure(f"could not start claude: {failure.strerror}")
reply = parse_entry(proc.stdout) or {}
reply = parse_entry(proc.stdout)
# The json output names the reset only in prose, such as "resets 7:40pm (Europe/Stockholm)", so its limit carries no reset time.
if hit_limit(reply):
if reply is not None and hit_limit(reply):
return Limited(None, limit_said(reply))
if proc.returncode != 0:
return Failure(proc.stderr.strip() or f"{who} exited {proc.returncode}")
if reply is None:
return Failure(f"{who} printed no json reply; it printed: {proc.stdout.strip() or 'nothing'}")
return reply