Answer product-owner round 1: 0 🔴, 3 🟡 (0 misread); hold a seat launched as another agent to its rung
This commit is contained in:
@@ -7,8 +7,9 @@ sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
|
||||
|
||||
from review_rules.review_passes import PASS_AGENTS, PASSES
|
||||
from repo_checks import ROOT
|
||||
from rule_hook.reviewer_rung import SEAT_AGENT, SECURITY_OPENER
|
||||
from rule_hook.reviewer_rung import SEAT, SEAT_AGENT, SECURITY_OPENER
|
||||
|
||||
OPENING = re.compile(r"^## Opening\n+```\n([^\n]+?\.)(?: |\n)", re.MULTILINE)
|
||||
# An agent's name, as opposed to the skill or plugin that reviews a pass.
|
||||
AGENT_NAME = re.compile(r"[a-z]+(?:-[a-z]+)*")
|
||||
# A row of the pass table: its pass and its reviewer cell.
|
||||
@@ -24,6 +25,11 @@ class ReviewerLaunches(unittest.TestCase):
|
||||
rows = [(name.lower(), reviewer if AGENT_NAME.fullmatch(reviewer) else None) for name, reviewer in PASS_ROW.findall(PASS_TABLE)]
|
||||
self.assertEqual(rows, list(PASS_AGENTS.items()))
|
||||
|
||||
def test_the_seat_opening_is_the_sentence_that_opens_every_seat_prompt(self):
|
||||
opening = OPENING.search((ROOT / "skills" / "comprehension-panel" / "seat-prompts.md").read_text(encoding="utf-8"))
|
||||
self.assertIsNotNone(opening, "seat-prompts.md has a `## Opening` section whose code block opens with a sentence")
|
||||
self.assertEqual(SEAT, opening.group(1) if opening else "")
|
||||
|
||||
def test_the_seat_agent_is_the_agent_under_agents_that_larv_review_has_every_seat_run_as(self):
|
||||
self.assertTrue((ROOT / "agents" / f"{SEAT_AGENT}.md").is_file())
|
||||
self.assertIn(f"`{SEAT_AGENT}`", LARV_REVIEW.split("### Comprehension check", 1)[1].split("### Security", 1)[0])
|
||||
|
||||
@@ -16,8 +16,9 @@ from claude_code.entries import UserText
|
||||
|
||||
# The pass each agent under agents/ reviews.
|
||||
PASS_OF = {agent: kind for kind, agent in REVIEWERS.items()}
|
||||
# The agent under agents/ that every comprehension seat runs as: skills/comprehension-panel/SKILL.md → "The scoring run".
|
||||
# The agent under agents/ that every comprehension seat runs as, and the opening of every seat's prompt, which also marks a seat launched as another agent: skills/larv-review/SKILL.md → "Comprehension check", skills/comprehension-panel/seat-prompts.md → "Opening".
|
||||
SEAT_AGENT = "comprehension-seat"
|
||||
SEAT = "You are one seat of a comprehension panel."
|
||||
# The opening of the security pass's prompt: skills/larv-review/SKILL.md → "Security".
|
||||
SECURITY_OPENER = "You are the security pass for this chunk."
|
||||
SUBJECTS: dict[ReviewKind, str] = {"seat": "a comprehension seat", "security": "the security pass's subagent"}
|
||||
@@ -79,9 +80,10 @@ def review_kind(given: dict[str, typing.Any]) -> ReviewKind | None:
|
||||
"""What a launch reviews, a reviewer's pass, a comprehension seat or the security pass; None for any other subagent."""
|
||||
if pass_reviewed := PASS_OF.get(text(given, "subagent_type")):
|
||||
return pass_reviewed
|
||||
if text(given, "subagent_type") == SEAT_AGENT:
|
||||
opening = text(given, "prompt").lstrip()
|
||||
if text(given, "subagent_type") == SEAT_AGENT or opening.startswith(SEAT):
|
||||
return "seat"
|
||||
if text(given, "prompt").lstrip().startswith(SECURITY_OPENER):
|
||||
if opening.startswith(SECURITY_OPENER):
|
||||
return "security"
|
||||
return None
|
||||
|
||||
|
||||
@@ -324,12 +324,15 @@ class ReviewerRung(unittest.TestCase):
|
||||
self.assertEqual(self.refused({"prompt": "You are the security pass for this chunk. Invoke /security-review over the branch diff.", "model": "sonnet", "effort": "high"}), ["reviewer-rung"])
|
||||
self.assertEqual(self.refused({"prompt": "You are the security pass for this chunk. Run /claude-security scan this branch's changes at high.", "model": "opus", "effort": "medium"}), [])
|
||||
|
||||
def test_a_seat_launched_as_another_agent_is_held_to_the_project_rung_by_its_opening_sentence(self):
|
||||
self.assertEqual(self.refused({"prompt": "You are one seat of a comprehension panel.", "model": "sonnet", "effort": "high"}), ["reviewer-rung"])
|
||||
|
||||
def test_a_seat_named_below_the_project_rung_is_refused(self):
|
||||
self.assertEqual(self.refused({"subagent_type": "comprehension-seat", "prompt": "Score the project.", "model": "sonnet", "effort": "high"}), ["reviewer-rung"])
|
||||
|
||||
def test_any_other_subagent_keeps_its_own_routing(self):
|
||||
self.assertEqual(self.refused({"subagent_type": "Explore", "model": "haiku", "effort": "low", "prompt": "Find the callers of run_worker."}), [])
|
||||
self.assertEqual(self.refused({"prompt": "You are one seat of a comprehension panel.", "model": "haiku", "effort": "low"}), [], "the seat's opening sentence without its agent is no launch")
|
||||
self.assertEqual(self.refused({"subagent_type": "Explore", "model": "haiku", "effort": "low", "prompt": "Quote: 'You are one seat of a comprehension panel.' Then stop."}), [], "a quote midway is no launch")
|
||||
self.assertEqual(self.refused({"prompt": "Note that security-review runs in CI.", "model": "haiku", "effort": "low"}), [])
|
||||
self.assertEqual(self.refused({"prompt": "Find where /security-review is named.", "model": "haiku", "effort": "low"}), [], "a mention without the opening sentence is no launch")
|
||||
self.assertEqual(self.refused({"prompt": "Quote the rule: 'You are the security pass for this chunk.' Then stop.", "model": "haiku", "effort": "low"}), [], "a quote midway is no launch")
|
||||
|
||||
Reference in New Issue
Block a user