From 1be6ae818775efb0f14a7b939feeefd89e958654 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Mon, 28 Sep 2026 16:49:17 +0200 Subject: [PATCH] Name why a verdict is incomplete, say how to proceed off a terminal, and which claude could not start --- CHANGELOG.md | 2 +- bin/loop_claude/human.py | 2 +- bin/loop_claude/interrupt.py | 2 +- bin/loop_claude/judge.py | 19 ++++++++++++------- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c2b87599..66b2b001 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,6 @@ - `loop-claude`'s no-premises exit names what is wrong: `README.md` unopenable or not UTF-8, a `## Goals` or `## Audience` heading missing or repeated, or nothing under one. - `loop-claude` says why when it cannot read or write `~/.claude.json` before an interrupt, naming a `projects` entry that is not an object, and the interrupt then lands in Claude Code's trust dialog. - `loop-claude` skips a transcript line it cannot parse, exits 1 naming a transcript it cannot read, and counts a `claude` it cannot start as a failed worker run. -- `loop-claude`'s judge quotes the transcript for every verdict, and a verdict quoting nothing, or a `claude` the judge cannot start, is a failed judge run; a `claude` that cannot start for an interrupt exits 1. +- `loop-claude`'s judge quotes the transcript for every verdict, and a verdict quoting nothing or interrupting without a question, or a `claude` the judge cannot start, is a failed judge run; a `claude` that cannot start for an interrupt exits 1. - `loop-claude`'s exit-2 message says what the human is needed for. - `loop-claude` keeps the mode of `~/.claude.json` and of its models file when it rewrites them, and creates the models file 0600. diff --git a/bin/loop_claude/human.py b/bin/loop_claude/human.py index 0850fc90..2d87aa2f 100644 --- a/bin/loop_claude/human.py +++ b/bin/loop_claude/human.py @@ -10,4 +10,4 @@ def needed(to, but): def off_terminal(to): if sys.stdin.isatty() and sys.stdout.isatty(): return None - return needed(to, "stdin or stdout is not a terminal") + return needed(to, "stdin or stdout is not a terminal; rerun loop-claude on a terminal") diff --git a/bin/loop_claude/interrupt.py b/bin/loop_claude/interrupt.py index 31145aad..5a965f7d 100644 --- a/bin/loop_claude/interrupt.py +++ b/bin/loop_claude/interrupt.py @@ -22,7 +22,7 @@ def interrupt(root, session_id, model, path, question, paths): try: subprocess.run(["claude", "--model", model, "--permission-mode", "bypassPermissions", "--resume", str(session_id)], cwd=root) except OSError as failure: - return Stop(1, f"could not start claude: {failure.strerror}") + return Stop(1, f"could not start claude for the interrupt: {failure.strerror}") entries = read(path) if isinstance(entries, Failure): return Stop(1, f"could not tell whether you typed anything: {entries.reason}") diff --git a/bin/loop_claude/judge.py b/bin/loop_claude/judge.py index 39617957..28a9cbda 100644 --- a/bin/loop_claude/judge.py +++ b/bin/loop_claude/judge.py @@ -54,8 +54,8 @@ def judge(root, task, premises, transcript, model): verdict = run_judge(root, args, prompt) if isinstance(verdict, Failure): failure = verdict.reason - elif not complete(verdict): - failure = "the judge returned no verdict" + elif reason := incomplete(verdict): + failure = reason elif not grounded(verdict, transcript): failure = f"the judge quoted {verdict['evidence']!r}, nothing in the transcript" + (f", for the question: {verdict['question']}" if verdict["interrupt"] else "") else: @@ -84,11 +84,16 @@ def judge_prompt(task, premises, transcript): ) -def complete(verdict): - typed = isinstance(verdict, dict) and all( - isinstance(verdict.get(name), bool if JUDGE_SCHEMA["properties"][name]["type"] == "boolean" else str) for name in JUDGE_SCHEMA["required"] - ) - return typed and not (verdict["interrupt"] and not verdict["question"].strip()) +def incomplete(verdict): + if not isinstance(verdict, dict): + return "the judge returned no verdict" + for name in JUDGE_SCHEMA["required"]: + kind = JUDGE_SCHEMA["properties"][name]["type"] + if not isinstance(verdict.get(name), bool if kind == "boolean" else str): + return f"the judge's verdict has no {name} of type {kind}" + if verdict["interrupt"] and not verdict["question"].strip(): + return "the judge interrupted without a question" + return None def grounded(verdict, transcript):