Stop the judge rather than show it under 50,000 characters of the transcript, read a twice-named record once, test the forge timeout and decide the merge stop from the pull requests found

This commit is contained in:
Lilleman
2026-11-20 00:45:49 +01:00
parent 5ed3a55e3a
commit f3af5e23fd
8 changed files with 56 additions and 19 deletions
+15 -2
View File
@@ -135,9 +135,9 @@ class Verdict(unittest.TestCase):
class JudgePrompt(unittest.TestCase):
def brief(self, entries, escalated_at, answer_destinations="the plan or a comment"):
def brief(self, entries, escalated_at, answer_destinations="the plan or a comment", records=""):
"""What the judge of a-driver reads of a transcript holding entries."""
return judge.Brief("Do it.", "## Goals", "", "the project's decisions", answer_destinations, kinds(*entries), escalated_at, "a-driver")
return judge.Brief("Do it.", "## Goals", records, "the project's decisions", answer_destinations, kinds(*entries), escalated_at, "a-driver")
def test_shows_the_transcripts_tail_and_returns_what_it_showed(self):
entries = [assistant({"type": "text", "text": "old " + "x" * judge.JUDGE_PROMPT_CHARS}), assistant({"type": "text", "text": "new"})]
@@ -149,6 +149,19 @@ class JudgePrompt(unittest.TestCase):
self.assertEqual(grounds.after_mark, "old " + "x" * judge.JUDGE_PROMPT_CHARS + "\n\nnew")
self.assertEqual(grounds.quotable, "## Goals\n\n")
def test_stops_rather_than_show_less_of_the_transcripts_tail_than_its_floor_whatever_the_size_of_the_records(self):
entries = [assistant({"type": "text", "text": "old " + "x" * judge.TRANSCRIPT_FLOOR}), assistant({"type": "text", "text": "Merged."})]
too_long = self.brief(entries, 0, records="r" * judge.JUDGE_PROMPT_CHARS)
self.assertEqual(judge.judge_prompt(too_long), Failure(f"the premises, the records and the task leave the transcript 0 characters of the judge's 400,000, under the {judge.TRANSCRIPT_FLOOR:,} of its tail it must read; the records take 400,000. Shorten them."))
self.assertEqual(judge.judge_once("/r", too_long, Rung("judge-model"), FakeEffects(claude=[]).effects()), judge.judge_prompt(too_long))
prompt, grounds = judge.judge_prompt(self.brief(entries, 0, records="r" * (judge.JUDGE_PROMPT_CHARS - judge.TRANSCRIPT_FLOOR - 10000)))
self.assertTrue(grounds.shown.endswith("\n\nMerged."))
self.assertGreaterEqual(len(grounds.shown), judge.TRANSCRIPT_FLOOR)
self.assertLessEqual(len(prompt), judge.JUDGE_PROMPT_CHARS)
short = [assistant({"type": "text", "text": "Merged."})]
_, grounds = judge.judge_prompt(self.brief(short, 0, records="r" * (judge.JUDGE_PROMPT_CHARS - 10000)))
self.assertEqual(grounds.shown, "Merged.", "a transcript shorter than the floor needs only its own length")
def test_the_judge_prompt_and_schema_call_the_worker_the_worker(self):
prompt, _ = judge.judge_prompt(self.brief([assistant({"type": "text", "text": "done"})], 1))
self.assertNotRegex(prompt + json.dumps(judge.judge_schema("a-driver")), r"\b[Aa]gent")