Name why a verdict is incomplete, say how to proceed off a terminal, and which claude could not start
This commit was merged in pull request #99.
This commit is contained in:
+1
-1
@@ -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`'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` 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` 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`'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.
|
- `loop-claude` keeps the mode of `~/.claude.json` and of its models file when it rewrites them, and creates the models file 0600.
|
||||||
|
|||||||
@@ -10,4 +10,4 @@ def needed(to, but):
|
|||||||
def off_terminal(to):
|
def off_terminal(to):
|
||||||
if sys.stdin.isatty() and sys.stdout.isatty():
|
if sys.stdin.isatty() and sys.stdout.isatty():
|
||||||
return None
|
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")
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ def interrupt(root, session_id, model, path, question, paths):
|
|||||||
try:
|
try:
|
||||||
subprocess.run(["claude", "--model", model, "--permission-mode", "bypassPermissions", "--resume", str(session_id)], cwd=root)
|
subprocess.run(["claude", "--model", model, "--permission-mode", "bypassPermissions", "--resume", str(session_id)], cwd=root)
|
||||||
except OSError as failure:
|
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)
|
entries = read(path)
|
||||||
if isinstance(entries, Failure):
|
if isinstance(entries, Failure):
|
||||||
return Stop(1, f"could not tell whether you typed anything: {entries.reason}")
|
return Stop(1, f"could not tell whether you typed anything: {entries.reason}")
|
||||||
|
|||||||
@@ -54,8 +54,8 @@ def judge(root, task, premises, transcript, model):
|
|||||||
verdict = run_judge(root, args, prompt)
|
verdict = run_judge(root, args, prompt)
|
||||||
if isinstance(verdict, Failure):
|
if isinstance(verdict, Failure):
|
||||||
failure = verdict.reason
|
failure = verdict.reason
|
||||||
elif not complete(verdict):
|
elif reason := incomplete(verdict):
|
||||||
failure = "the judge returned no verdict"
|
failure = reason
|
||||||
elif not grounded(verdict, transcript):
|
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 "")
|
failure = f"the judge quoted {verdict['evidence']!r}, nothing in the transcript" + (f", for the question: {verdict['question']}" if verdict["interrupt"] else "")
|
||||||
else:
|
else:
|
||||||
@@ -84,11 +84,16 @@ def judge_prompt(task, premises, transcript):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def complete(verdict):
|
def incomplete(verdict):
|
||||||
typed = isinstance(verdict, dict) and all(
|
if not isinstance(verdict, dict):
|
||||||
isinstance(verdict.get(name), bool if JUDGE_SCHEMA["properties"][name]["type"] == "boolean" else str) for name in JUDGE_SCHEMA["required"]
|
return "the judge returned no verdict"
|
||||||
)
|
for name in JUDGE_SCHEMA["required"]:
|
||||||
return typed and not (verdict["interrupt"] and not verdict["question"].strip())
|
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):
|
def grounded(verdict, transcript):
|
||||||
|
|||||||
Reference in New Issue
Block a user