Answer stability round 1: 0 🔴, 6 🟡 (0 misread); pin the answer destinations in the prompts, name Brief's fields, drop the duplicate import test

This commit is contained in:
2026-11-18 17:07:03 +01:00
parent c799081360
commit 885bf37891
8 changed files with 28 additions and 30 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
"""One cycle of a headless claude worker and the judge of its transcript, for every entry point that drives such cycles: loop-claude today, do-epic next (docs/decisions.md → `do-epic: drives one Jira epic …`).
run.py runs a cycle through the states in states.py: worker.py runs the worker, judge.py rules on its transcript, interrupt.py puts a question to the human in the tmux window tmux.py names, and routing.py picks the rung the worker runs on next. An entry point hands the cycle what is its own: its prompts and file names (worker_prompts.py) and how it reads the plan items a worker took in (run.py's Cycle.taken_in). No module here imports an entry point's package, which test_agent_cycle.py checks. A reader finds a module by its name, so the modules stay at one level. docs/decisions.md → `principles: about seven things per level, …` allows that.
run.py runs a cycle through the states in states.py: worker.py runs the worker, judge.py rules on its transcript, interrupt.py puts a question to the human in the tmux window tmux.py names, and routing.py picks the rung the worker runs on next. An entry point hands the cycle what is its own: its prompts and file names (worker_prompts.py) and how it reads the plan items a worker took in (run.py's Cycle.taken_in). No module here imports an entry point's package: loop_claude imports this one, so bin/repo_checks/test_package_cycles.py fails on such an import. A reader finds a module by its name, so the modules stay at one level. docs/decisions.md → `principles: about seven things per level, …` allows that.
"""
+9 -1
View File
@@ -152,7 +152,15 @@ def rule(cycle: Cycle, transcript_path: str, quoted_answers: int) -> Ruled | Sto
entries = read_transcript(transcript_path)
if isinstance(entries, Failure):
return Stop(1, entries.reason)
verdict = judge(cycle.root, Brief(cycle.task, cycle.premises, cycle.records, cycle.prompts.answer_destinations, entries, cycle.route.escalated_at), cycle.judge, cycle.effects, lambda rejected: keep_rejection(cycle, transcript_path, rejected))
brief = Brief(
task=cycle.task,
premises=cycle.premises,
records=cycle.records,
answer_destinations=cycle.prompts.answer_destinations,
entries=entries,
escalated_at=cycle.route.escalated_at,
)
verdict = judge(cycle.root, brief, cycle.judge, cycle.effects, lambda rejected: keep_rejection(cycle, transcript_path, rejected))
if isinstance(verdict, Stop):
return verdict
if not isinstance(verdict, Finished):
-21
View File
@@ -1,21 +0,0 @@
import ast
import pathlib
import unittest
PACKAGE = pathlib.Path(__file__).resolve().parent
# The packages of the entry points that drive a cycle.
ENTRY_POINTS = ("loop_claude", "do_epic")
class Imports(unittest.TestCase):
def test_no_module_imports_an_entry_points_package_so_a_second_entry_point_drives_the_cycle_alone(self):
imported = []
for path in sorted(PACKAGE.glob("*.py")):
for node in ast.walk(ast.parse(path.read_text())):
names = [node.module or ""] if isinstance(node, ast.ImportFrom) else [alias.name for alias in node.names] if isinstance(node, ast.Import) else []
imported += [(path.name, name) for name in names if name.split(".")[0] in ENTRY_POINTS]
self.assertEqual(imported, [])
if __name__ == "__main__":
unittest.main()