Spell out the judge's prompt in judge.py and call the worker the worker in it

This commit is contained in:
2026-10-22 01:18:08 +02:00
parent c0b31427c0
commit eb17a4080d
5 changed files with 38 additions and 35 deletions
+11 -2
View File
@@ -339,7 +339,7 @@ class Cycles(unittest.TestCase):
self.assertNotIn("the second", judge_prompts[0])
self.assertIn("[human] the second", judge_prompts[1])
self.assertIn("From README.md:\n## Goals", judge_prompts[0])
self.assertIn("The task an agent was given:\nDo it.", judge_prompts[0])
self.assertIn("The task the worker was given:\nDo it.", judge_prompts[0])
def test_a_question_the_records_answer_resumes_the_worker_with_the_answer_three_times_a_cycle(self):
answered = judged("quoted", answer="Use *A*.")
@@ -1242,13 +1242,22 @@ class JudgePrompt(unittest.TestCase):
self.assertEqual(grounds.since_step, "old " + "x" * judge.JUDGE_PROMPT_CHARS + "\n\nnew")
self.assertEqual(grounds.quotable, "## Goals\n\n")
def test_the_judge_prompt_calls_the_worker_the_worker_and_names_where_the_human_writes_rules(self):
entries = [assistant({"type": "text", "text": "done"})]
prompt, _ = judge.judge_prompt("Do it.", "## Goals", "", entries, 1)
schema = json.dumps(judge.JUDGE_SCHEMA)
self.assertNotRegex(prompt + schema, r"\b[Aa]gent")
self.assertIn("writing it into ~/.claude/CLAUDE.md, ~/.claude/rules/ or ~/.claude/skills/larv-review/standards/ does not count", prompt)
for name in records.HUMAN_RULE_NAMES:
self.assertIn(name, judge.JUDGE_RULES)
def test_shows_the_judge_where_the_worker_last_stepped_up_and_checks_an_escalation_only_after_it(self):
entries = [assistant({"type": "text", "text": "round 2: 🔴"}), assistant({"type": "text", "text": "round 3: 🔴"})]
prompt, grounds = judge.judge_prompt("Do it.", "## Goals", "", entries, 1)
self.assertRegex(prompt, "round 2: 🔴\n\n\\[step\\] [^\n]+\n\nround 3: 🔴\n\n")
self.assertEqual(grounds.since_step, "round 3: 🔴")
prompt, grounds = judge.judge_prompt("Do it.", "## Goals", "", entries, 0)
self.assertNotIn("stepped the agent up", prompt)
self.assertNotIn("stepped the worker up", prompt)
self.assertEqual(grounds.since_step, "round 2: 🔴\n\nround 3: 🔴")
def test_drops_an_escalation_quote_from_after_the_step_up_that_the_tail_it_shows_cuts_off(self):