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` 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.
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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}")
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user