From 14123912d976ff371b23bc69e73e3818d411dc57 Mon Sep 17 00:00:00 2001 From: Lilleman Date: Thu, 19 Nov 2026 21:21:54 +0100 Subject: [PATCH 1/2] Let the judge quote the worker's task as evidence --- bin/agent_cycle/judge.py | 7 +++++-- bin/agent_cycle/test_judge.py | 8 ++++++++ bin/judge_replay/archived_prompt.py | 4 ++-- bin/judge_replay/test_judge_replay.py | 4 ++++ 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/bin/agent_cycle/judge.py b/bin/agent_cycle/judge.py index 3591a649..c1edb597 100644 --- a/bin/agent_cycle/judge.py +++ b/bin/agent_cycle/judge.py @@ -134,6 +134,8 @@ class Grounds(typing.NamedTuple): quotable: str # Each answer the human typed, whole, latest last (transcript.human_answers). typed: tuple[str, ...] = () + # The worker's task, which the judge reads above shown and may quote as the evidence: the worker's first prompt holds it, but the tail in shown cuts that off once the session grows. + task: str = "" class Brief(typing.NamedTuple): @@ -237,7 +239,7 @@ def quotes_checked(verdict: Verdict, grounds: Grounds) -> Verdict | Failure: | Quote | Must be in | Where it isn't | Checked by | |---|---|---|---| - | the evidence | grounds.shown, the evidence's fragments in order | a Failure: run_judge rejects the reply, and judge retries it | grounded | + | the evidence | grounds.task then grounds.shown, the evidence's fragments in order | a Failure: run_judge rejects the reply, and judge retries it | grounded | | an interrupt's answered_before | grounds.shown | the interrupt stands, as if no earlier answer was found | re_ask_checked | | its left_open | answered_before and the question | the interrupt becomes an Unfinished that quotes answered_before back to the worker | re_ask_checked | | a quoted answer | grounds.quotable | the question goes to the human as an interrupt, which keeps the escalation the answer carried | answer_checked | @@ -246,7 +248,7 @@ def quotes_checked(verdict: Verdict, grounds: Grounds) -> Verdict | Failure: Only a misquoted evidence fails. A Failure for any other would exit an unattended loop, so each changes the verdict instead. """ - if not grounded(verdict.evidence, grounds.shown): + if not grounded(verdict.evidence, f"{grounds.task}\n\n{grounds.shown}"): return misquoted_evidence(verdict) verdict = re_ask_checked(verdict, grounds.shown) verdict = answer_checked(verdict, grounds.quotable) @@ -306,5 +308,6 @@ def judge_prompt(brief: Brief) -> tuple[str, Grounds]: after_mark=escalation_mark.after_mark(brief.entries, brief.escalated_at), quotable=f"{brief.premises}\n\n{brief.records}", typed=tuple(human_answers(brief.entries, typed_answer)), + task=brief.task, ) return f"{head}{shown}\n\n{rules}", grounds \ No newline at end of file diff --git a/bin/agent_cycle/test_judge.py b/bin/agent_cycle/test_judge.py index c4b5ed67..780feece 100644 --- a/bin/agent_cycle/test_judge.py +++ b/bin/agent_cycle/test_judge.py @@ -124,6 +124,14 @@ class Verdict(unittest.TestCase): verdict = judge.judge_once("/r", judge.Brief("Do it.", "## Goals", "", "the project's decisions", "the plan or a comment", kinds(*entries), 1, "loop-claude"), Rung("judge-model"), FakeEffects(claude=[judged("unfinished", evidence="round 2: 🔴")]).effects()) self.assertEqual(verdict, Unfinished("round 2: 🔴", entries_read=2)) + def test_takes_the_task_as_evidence_where_the_tail_it_shows_cuts_off_the_workers_first_prompt(self): + entries = [human("Do the next chunk. " + "x" * judge.JUDGE_PROMPT_CHARS), assistant({"type": "text", "text": "Merged."})] + def judged_on(evidence): + return judge.judge_once("/r", judge.Brief("Do the next chunk.", "## Goals", "", "the project's decisions", "the plan or a comment", kinds(*entries), 0, "loop-claude"), Rung("judge-model"), FakeEffects(claude=[judged("unfinished", evidence=evidence)] * 3).effects()) + self.assertEqual(judged_on("Do the next chunk."), Unfinished("Do the next chunk.", entries_read=2)) + self.assertEqual(judged_on("Do the next chunk. ... Merged."), Unfinished("Do the next chunk. ... Merged.", entries_read=2)) + self.assertIsInstance(judged_on("Do the next release."), Failure) + class JudgePrompt(unittest.TestCase): def brief(self, entries, escalated_at, answer_destinations="the plan or a comment"): diff --git a/bin/judge_replay/archived_prompt.py b/bin/judge_replay/archived_prompt.py index 6468f8dc..b6d40a3b 100644 --- a/bin/judge_replay/archived_prompt.py +++ b/bin/judge_replay/archived_prompt.py @@ -12,7 +12,7 @@ def grounds_of(prompt: str, entries: list[Entry]) -> Grounds | Failure: """What the quotes of a judge run on prompt are checked against, as judge_prompt would have made it for the transcript's entries: the premises and the records before the task are quotable, the transcript the judge was shown comes before the rules. The prompt is split on the headings judge_prompt writes, at the first of each; a Failure where it lacks one. Rules of an earlier wording stay part of the transcript, a slack that lets an evidence quote them pass.""" before_task, task_heading, after_task = prompt.partition(f"\n\n{TASK_HEADING}") heading = transcript_heading(LOOP_CLAUDE) - _, found_heading, shown = after_task.partition(heading) + task, found_heading, shown = after_task.partition(heading) if not (task_heading and found_heading): return Failure(f"the archived prompt lacks the heading {TASK_HEADING.strip()!r} or {heading.strip()!r}, which judge_prompt writes") - return Grounds(shown.removesuffix(f"\n\n{judge_rules(ANSWER_DESTINATIONS, LOOP_CLAUDE)}"), escalation_mark.after_mark(entries, 0), before_task, tuple(human_answers(entries, typed_answer))) + return Grounds(shown.removesuffix(f"\n\n{judge_rules(ANSWER_DESTINATIONS, LOOP_CLAUDE)}"), escalation_mark.after_mark(entries, 0), before_task, tuple(human_answers(entries, typed_answer)), task.removesuffix("\n\n")) diff --git a/bin/judge_replay/test_judge_replay.py b/bin/judge_replay/test_judge_replay.py index 9142d6a4..90a26fc4 100644 --- a/bin/judge_replay/test_judge_replay.py +++ b/bin/judge_replay/test_judge_replay.py @@ -399,6 +399,10 @@ class JudgeArchivedRuns(unittest.TestCase): self.assertIsInstance(self.judged(evidence="Ship fast.")[0], Rejected) self.assertIsInstance(self.judged(evidence="Worker chose option B.")[0], Unfinished) + def test_takes_the_task_as_evidence(self): + self.assertIsInstance(self.judged(evidence="Do it.")[0], Unfinished) + self.assertIsInstance(self.judged(evidence="Do it. ... Use Postgres.")[0], Unfinished) + def test_keeps_the_cost_and_the_run_of_a_rejected_reply(self): rejected, _ = self.judged(evidence="Never said.") self.assertEqual((rejected.cost, rejected.run.prompt), (0.25, self.PROMPT)) -- 2.52.0 From 65491d1b55b8761fe9750b4eb3ad5098ac467cde Mon Sep 17 00:00:00 2001 From: Lilleman Date: Thu, 19 Nov 2026 21:23:12 +0100 Subject: [PATCH 2/2] File item 460: review the judge's fix for quoting the task --- todo.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/todo.md b/todo.md index a6409859..78ec9646 100644 --- a/todo.md +++ b/todo.md @@ -6,12 +6,13 @@ `Bar = 0.1` -`Next ID = 460` +`Next ID = 461` ## Items | ID | Release | Blocked by | Exempt | Item | L | E | I | R | S | Moves | Score | |---|---|---|---|---|---|---|---|---|---|---|---| +| 460 | 0.13.0 | | | **Review the judge's fix for quoting the worker's task as evidence with every larv-review pass it fires, and adjust it to their findings.** | 2 | 2 | 3 | 5 | 2 | code health by 3, 1.1 by 5 | 7.2 | | 452 | 0.13.0 | | | **Make do-epic's view of the Jira workflow settings: the statuses at which an issue unblocks the issues it blocks, and the moves the team's own automation makes, so do-epic makes none of those.** | 3 | 2 | 2 | 5 | 5 | 1.6 by 7, 1.5 by 3 | 2.1 | | 449 | 0.13.0 | | | **Record do-epic's repo picks and sub-task summaries in the team's own spelling, such as `core-4` and `core-4: Bygg …`, as its config sets them.** | 2 | 2 | 2 | 4 | 3 | 1.6 by 6 | 2.0 | | 458 | 0.13.0 | | | **Resume a chunk whose pull request awaits a person's merge once it no longer merges cleanly into the default branch, so the worker brings it level again.** | 3 | 2 | 2 | 5 | 4 | 1.6 by 4, 1.5 by 3 | 1.9 | @@ -78,6 +79,18 @@ ## Details +### 460. Review the judge's fix for quoting the worker's task as evidence with every larv-review pass it fires, and adjust it to their findings. + +The fix shipped without any larv-review pass, reviewer or comprehension check, at lilleman's request on 2026-11-19, so loop-claude could run unattended again: PR #641, commit "Let the judge quote the worker's task as evidence". Before it, the judge read the task above the transcript's tail but `quotes_checked` checked the evidence only against that tail. Once a session outgrew the tail, a verdict quoting the task, such as `Do the next chunk in 0.13.0`, was rejected three times running, and the loop exited after each merged chunk (items 448, 455 and 451). `Grounds` now carries the task, and the evidence must appear in the task, then the tail. + +Run the passes the change fires: security, stability (with `~/.claude/rules/this-machine/cross-repo-review.md` where it applies), prose for the comments and docstrings it changed, and overrides if `rule-hook overrides` prints a line. Run the comprehension check where `larv-review` says one is due. Also weigh whether the evidence schema's description ("a verbatim quote of the one transcript passage") should name the task too, and whether `misquoted_evidence`'s message should say "the task or the transcript". + +Touches: +- `bin/agent_cycle/judge.py`: `Grounds` (small), `quotes_checked` (small), `judge_prompt` (small) +- `bin/judge_replay/archived_prompt.py`: `grounds_of` (small) +- `bin/agent_cycle/test_judge.py` +- `bin/judge_replay/test_judge_replay.py` + ### 452. Make do-epic's view of the Jira workflow settings: the statuses at which an issue unblocks the issues it blocks, and the moves the team's own automation makes, so do-epic makes none of those. do-epic counts an issue as done only where Jira's status category is done, and moves a finished chunk's issue to done itself, by `jira-finish-transition`. On a team whose CI moves issues through the workflow, both are wrong. On TW, CI moves an issue to Code Review when its pull request opens, to Release Ready when it merges, and to Done when it is deployed. So do-epic would move an issue to Done before it is deployed, and would hold every blocked issue until the blocker is deployed, though the team wants blocked work to start once the blocker's pull request merges. -- 2.52.0