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
+5 -4
View File
@@ -22,7 +22,7 @@ CONSEQUENCE = "the judge cannot read the records"
def read_records(root: str | None, home: pathlib.Path, claude_dir: pathlib.Path, first: tuple[tuple[str, str], ...] = ()) -> str | Failure:
"""The project's `AGENTS.md` and decision log, then the human's rules, CLAUDE.md first, each headed by its name; one that does not exist, or is empty, is left out.
"""The project's `AGENTS.md` and decision log, then the human's rules, CLAUDE.md first, each headed by its name; one that does not exist, or is empty, is left out, and one whose text an earlier one holds is read once, under both names.
`AGENTS.md` is read where the config under home of root's project puts it, and the decision log from the store that config names. Each is headed by its name in RECORD_FILES wherever it is kept.
@@ -37,13 +37,14 @@ def read_records(root: str | None, home: pathlib.Path, claude_dir: pathlib.Path,
decisions = store(config, DECISIONS[1]).read()
texts += [(WORKING_RULES[0], file_text(config.paths[WORKING_RULES[1]])), (DECISIONS[0], Failure(f"{decisions.reason} - {CONSEQUENCE}.") if isinstance(decisions, Failure) else decisions)]
texts += [(named(rule, home, claude_dir), file_text(rule)) for rule in rules]
records = []
# Each text, with the headings it is read under: a config may put the working rules in the decision log.
records: dict[str, list[str]] = {}
for heading, text in texts:
if isinstance(text, Failure):
return text
if text.strip():
records.append(f"From {heading}:\n{text.strip()}")
return "\n\n".join(records)
records.setdefault(text.strip(), []).append(heading)
return "\n\n".join(f"From {' and '.join(headings)}:\n{text}" for text, headings in records.items())
def file_text(path: pathlib.Path) -> str | Failure: