|
|
|
@@ -16,7 +16,7 @@ JUDGE_PROMPT_CHARS = 400000
|
|
|
|
|
JUDGE_RULES = (
|
|
|
|
|
"Decide whether the human must now be interrupted. interrupt=true when any of these appear:\n"
|
|
|
|
|
"- the agent asks the human anything, seeks approval, or says a decision is the human's, and neither "
|
|
|
|
|
"README.md nor the project's records answer it\n"
|
|
|
|
|
"README.md nor the project's records settle the matter\n"
|
|
|
|
|
"- it carried on under an assumption that decides the deliverable, that the human could "
|
|
|
|
|
"reasonably reject and that neither README.md nor the project's records settle; a caveat about "
|
|
|
|
|
"transient state it then handled is not one\n"
|
|
|
|
@@ -29,11 +29,11 @@ JUDGE_RULES = (
|
|
|
|
|
"where a note goes - is not on its own a reason to interrupt. The human may have replied inside the transcript, on a [human] line: judge only what "
|
|
|
|
|
"is still open, never a question they already answered there. A [loop] line is what loop-claude told "
|
|
|
|
|
"the agent, such as an answer quoted from README.md or the project's records. A question a [loop] "
|
|
|
|
|
"line answered is no longer open. If the agent asks it again, interrupt with that question.\n"
|
|
|
|
|
"line answered is settled. If the agent asks it again, interrupt with that question.\n"
|
|
|
|
|
"Where the agent asked or flagged something itself, the question is that one, in the agent's own "
|
|
|
|
|
"wording; never construct another from facts it stated.\n"
|
|
|
|
|
"Where README.md or the project's records answer the agent's own question, set interrupt=false, put "
|
|
|
|
|
"that question in question and quote the passage that answers it in answer, verbatim; the agent is "
|
|
|
|
|
"Where README.md or the project's records answer the agent's own question and no [loop] line has "
|
|
|
|
|
"quoted that answer yet, set interrupt=false, put that question in question and quote the passage that answers it in answer, verbatim; the agent is "
|
|
|
|
|
"then given that passage in place of the human's reply.\n"
|
|
|
|
|
"finished=true when the chunk is complete: merged, or nothing remains that the agent could do on "
|
|
|
|
|
"its own. finished=false when work remains that a further run can continue: an open PR, a review "
|
|
|
|
@@ -46,7 +46,7 @@ class Reply:
|
|
|
|
|
evidence: str = dataclasses.field(metadata={"description": "A verbatim quote of the transcript line the verdict rests on: what triggers the interrupt, else what shows the chunk finished or the work remaining."})
|
|
|
|
|
finished: bool
|
|
|
|
|
interrupt: bool
|
|
|
|
|
question: str = dataclasses.field(metadata={"description": "The single question to put to the human, or the agent's question that answer answers. Empty otherwise."})
|
|
|
|
|
question: str = dataclasses.field(metadata={"description": "With interrupt true, the single question to put to the human. With a quoted answer, the agent's question that the answer field answers. Empty otherwise."})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
REPLY_TYPES = typing.get_type_hints(Reply)
|
|
|
|
@@ -73,7 +73,7 @@ def judge(root: str, task: str, premises: str, records: str, rendered_transcript
|
|
|
|
|
return retried("judge", lambda: run_judge(root, args, prompt, rendered_transcript, f"{premises}\n\n{records}", effects), effects)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def run_judge(root: str, args: list[str], prompt: str, rendered_transcript: str, recorded: str, effects: Effects) -> Verdict | Failure | Limited:
|
|
|
|
|
def run_judge(root: str, args: list[str], prompt: str, rendered_transcript: str, quotable: str, effects: Effects) -> Verdict | Failure | Limited:
|
|
|
|
|
try:
|
|
|
|
|
proc = effects.claude(args, root, prompt)
|
|
|
|
|
except OSError as failure:
|
|
|
|
@@ -90,7 +90,7 @@ def run_judge(root: str, args: list[str], prompt: str, rendered_transcript: str,
|
|
|
|
|
if not grounded(verdict.evidence, rendered_transcript):
|
|
|
|
|
return Failure(f"the judge quoted {verdict.evidence!r}, which is not in the transcript" + (f", for the question: {verdict.question}" if isinstance(verdict, Interrupt | QuotedAnswer) else ""))
|
|
|
|
|
# Not a Failure: a misquote would otherwise exit an unattended loop.
|
|
|
|
|
if isinstance(verdict, QuotedAnswer) and not grounded(verdict.answer, recorded):
|
|
|
|
|
if isinstance(verdict, QuotedAnswer) and not grounded(verdict.answer, quotable):
|
|
|
|
|
return Interrupt(verdict.evidence, verdict.question)
|
|
|
|
|
return verdict
|
|
|
|
|
|
|
|
|
|