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
+12 -7
View File
@@ -84,8 +84,8 @@ def planned(read: Plan | Failure, cut: LastCut, default: str, branch: str, outsi
return NoItem(f"{where} holds no item for {upcoming}, and no change is unreleased, so that release is to be planned first.")
first = pick.item
if first is None and pick.release is not None:
merges = awaited_merges(weighed.carried, pick.release)
return NoItem(f"every item of release {version(pick.release)} in {where} waits.{merges}", awaits_merge=bool(merges))
pulls = awaited_merges(weighed.carried, pick.release)
return NoItem(f"every item of release {version(pick.release)} in {where} waits.{merge_stop(pulls)}", awaits_merge=bool(pulls))
if first is None:
return NoItem(f"{where}'s items table holds no item.")
held = weighed.carried
@@ -100,13 +100,18 @@ def planned(read: Plan | Failure, cut: LastCut, default: str, branch: str, outsi
return NextChunk(held, first, f"{first.tagline}\n\n{first.detail}".strip(), branch, over, item_id is not None)
def awaited_merges(found: list[Item], release: Release) -> str:
"""The sentences that stop the working loop where items of release await a person's merge, naming each pull request with the items it finishes; empty where none does."""
pulls: dict[str, list[str]] = {}
def awaited_merges(found: list[Item], release: Release) -> dict[str, list[int]]:
"""Each pull request, as `#<number> <URL>`, that finishes items of release and awaits a person's merge, with those items' IDs."""
pulls: dict[str, list[int]] = {}
for item in found:
if item.release == release and item.awaits_merge:
pulls.setdefault(item.awaits_merge, []).append(str(item.id))
pulls.setdefault(item.awaits_merge, []).append(item.id)
return pulls
def merge_stop(pulls: dict[str, list[int]]) -> str:
"""The sentences that stop the working loop where pulls await a person's merge, naming each with the items it finishes; empty where none does."""
if not pulls:
return ""
named = "; ".join(f"{pull}, which finishes item{'s' if len(ids) > 1 else ''} {listed(ids, 'and')}" for pull, ids in pulls.items())
named = "; ".join(f"{pull}, which finishes item{'s' if len(ids) > 1 else ''} {listed([str(item_id) for item_id in ids], 'and')}" for pull, ids in pulls.items())
return f" Under `merge = \"human\"`, these pull requests await a person's merge: {named}. The working loop stops here. Once a person has merged one, or turned one back into a draft, run loop-claude again."