Give the judge what the project records and ten times more of the chunk's transcript
This commit is contained in:
+22
-2
@@ -24,7 +24,7 @@ from loop_claude.effects import Effects
|
||||
from loop_claude.failure import Failure
|
||||
from loop_claude.limited import Limited
|
||||
from loop_claude.loop import main, reload
|
||||
from loop_claude.project import checkout, model_choice, premises
|
||||
from loop_claude.project import checkout, model_choice, premises, records
|
||||
from loop_claude.stop import Stop
|
||||
|
||||
CWD = pathlib.Path("/c")
|
||||
@@ -156,7 +156,7 @@ class Cycles(unittest.TestCase):
|
||||
self.session = session.session_for("proj", self.paths)
|
||||
|
||||
def cycle(self, fake):
|
||||
return run.Cycle(effects=fake.effects(), models=model_choice.Models("judge-model", "worker-model"), paths=self.paths, premises="## Goals", project_key="proj", root=str(self.home), session=self.session, task="Do it.")
|
||||
return run.Cycle(effects=fake.effects(), models=model_choice.Models("judge-model", "worker-model"), paths=self.paths, premises="## Goals", project_key="proj", records="", root=str(self.home), session=self.session, task="Do it.")
|
||||
|
||||
def archived_verdicts(self):
|
||||
return sorted(path.read_text() for path in (self.paths.transcript_archive / "proj").glob("*/*.verdict.md"))
|
||||
@@ -348,6 +348,24 @@ class WorkerArgs(unittest.TestCase):
|
||||
self.assertNotIn("Do it.", " ".join(resumed))
|
||||
|
||||
|
||||
class Records(unittest.TestCase):
|
||||
def test_heads_each_record_the_project_has_by_its_path(self):
|
||||
with tempfile.TemporaryDirectory() as root:
|
||||
self.assertEqual(records.read_records(root), "")
|
||||
pathlib.Path(root, "docs", "decisions").mkdir(parents=True)
|
||||
pathlib.Path(root, "docs", "decisions", "b.md").write_text("# B\n")
|
||||
pathlib.Path(root, "docs", "decisions", "a.md").write_text("# A\n")
|
||||
pathlib.Path(root, "AGENTS.md").write_text("\n# Rules\n")
|
||||
self.assertEqual(records.read_records(root), "From AGENTS.md:\n# Rules\n\nFrom docs/decisions/a.md:\n# A\n\nFrom docs/decisions/b.md:\n# B")
|
||||
|
||||
def test_stops_on_a_record_it_cannot_read(self):
|
||||
with tempfile.TemporaryDirectory() as root:
|
||||
pathlib.Path(root, "docs", "decisions.md").mkdir(parents=True)
|
||||
self.assertEqual(records.read_records(root), Stop(1, f"docs/decisions.md in {root}: Is a directory - the judge cannot read the project's records."))
|
||||
pathlib.Path(root, "AGENTS.md").write_bytes(b"# Rules\n\xff\n")
|
||||
self.assertEqual(records.read_records(root), Stop(1, "AGENTS.md is not UTF-8 on line 2 - the judge cannot read the project's records."))
|
||||
|
||||
|
||||
class Sections(unittest.TestCase):
|
||||
def test_keeps_every_headed_section_with_its_bodies(self):
|
||||
text = "# Title\n\nintro\n\n## Goals\n\n1. one\n```sh\n# not a heading\n```\n### Later\n2. two\n#1 priority\n\n## Empty\n\n## Audience\nme\n## Audience\nagain\n# Appendix\nnot audience\n"
|
||||
@@ -513,6 +531,8 @@ class ExitContract(unittest.TestCase):
|
||||
("project/premises.py", "read_premises", "1", "f'README.md has no ##", premises_),
|
||||
("project/premises.py", "read_premises", "1", "f'README.md has ## {name} more than once", premises_),
|
||||
("project/premises.py", "read_premises", "1", "f'README.md has nothing under", premises_),
|
||||
("project/records.py", "read_records", "1", 'f"{name} in {root}:', "AGENTS.md or a decision file cannot be read, or is not UTF-8"),
|
||||
("project/records.py", "read_records", "1", 'f"{name} is not UTF-8', "AGENTS.md or a decision file cannot be read, or is not UTF-8"),
|
||||
]
|
||||
root = pathlib.Path(main.__file__).parents[1]
|
||||
found = []
|
||||
|
||||
Reference in New Issue
Block a user