Answer prose round 1: 0 🔴, 4 🟡 (0 misread); reword the exit-2 heading and bullet, drop the false claim of six runs, say the stop needs the human, and record at LoopRun why its fields stay apart

This commit is contained in:
2026-10-28 02:45:15 +01:00
parent 8caf92dfbe
commit 7a7528fba8
2 changed files with 8 additions and 9 deletions
+7 -8
View File
@@ -106,13 +106,12 @@ Exit 1, saying why, when:
more than 2 minutes past. The judge's reply gives its reset time only as text, so the judge is
always retried every 10 minutes. stderr says when the next try is due.
Exit 2, when the human is needed to go on and cannot be asked, or the chunk has gone on too long:
Exit 2, when the human is needed to go on:
- stdin or stdout is not a terminal, when a model must be picked or an interrupt answered
- the input ends while a model is picked
- an interrupt's answer is empty, or the input ends before one is typed
- the claude opened for /talk, or for a release ready to cut, ends with nothing typed
- the judge rules a chunk unfinished 6 cycles running; finish the chunk yourself, or rerun to give it
6 more. A finished chunk restarts the run.
- the judge rules a chunk unfinished 6 cycles running; rerun to give it 6 more
Rerunning resumes any open session.
"""
@@ -149,7 +148,7 @@ from claude_code.session import Session, session_named, session_open, transcript
# Seconds routing waits for origin to name its default branch, asked only where the checkout records none; past them, the chunk runs on the project's rung.
ORIGIN_TIMEOUT = 60
# How many unfinished verdicts running end the loop, so a worker and a judge that disagree about a chunk cannot cycle unattended without end. A policy number, not derived from the routing steps: well above the two unfinished verdicts running that archived chunks have reached at most, and low enough that a stuck pair spends six worker and judge runs, not more. It counts every unfinished verdict, including those of cycles where the human answered an interrupt: a rerun is cheap, and a chunk that needs six answers is worth a look. "loop-claude --help" states it.
# How many unfinished verdicts running end the loop, so a worker and a judge that disagree about a chunk cannot cycle unattended without end. A policy number, not derived from the routing steps: well above the two unfinished verdicts running that archived chunks have reached at most, and low enough that a stuck pair is stopped after six cycles. It counts every unfinished verdict, including those of cycles where the human answered an interrupt: a rerun is cheap, and a chunk that needs that many answers is worth a look.
UNFINISHED_LIMIT = 6
@@ -213,21 +212,21 @@ def routed(route: Route | None, project: Rung | None, model: str, archived: typi
def closed_cycle(loop_run: LoopRun, project: Rung | None, concluded: Concluded, archive_folder: pathlib.Path, session: Session, effects: Effects) -> LoopRun | Stop:
"""The loop run after a cycle concluded, with the step-up archived; the stop that asks the human, archived, once the chunk has had UNFINISHED_LIMIT unfinished verdicts running."""
"""The loop run after a cycle concluded, with the step-up archived; the stop that needs the human, archived, once the chunk has had UNFINISHED_LIMIT unfinished verdicts running."""
after = after_verdict(loop_run, project, concluded)
if stop := archive_step(archive_folder, session, after.task, concluded.route, after.route, effects):
return stop
if limit := reached_limit(after):
# An unfinished verdict always leaves a route. It is archived as the next cycle would run on it, so a rerun resumes there.
# An unfinished verdict always leaves a route. The stop is archived with that route, the one the next cycle would run on, so a rerun resumes there.
return archived_stop(archive_folder, session, after.task, after.route or concluded.route, limit, limit.reason, effects)
return after
def reached_limit(loop_run: LoopRun) -> Stop | None:
"""The stop that asks the human once the loop run holds UNFINISHED_LIMIT unfinished verdicts running."""
"""The stop that needs the human once the loop run holds UNFINISHED_LIMIT unfinished verdicts running."""
if loop_run.unfinished_run < UNFINISHED_LIMIT:
return None
return needs_human("decide whether the chunk is finished", f"the judge ruled it unfinished {loop_run.unfinished_run} cycles running and loop-claude does not go on unasked; finish the chunk yourself, or rerun loop-claude to give it {UNFINISHED_LIMIT} more cycles")
return needs_human("go on with the chunk", f"the judge ruled it unfinished {loop_run.unfinished_run} cycles running; finish the chunk yourself, or rerun loop-claude to give it {UNFINISHED_LIMIT} more cycles")
def after_verdict(loop_run: LoopRun, project: Rung | None, concluded: Concluded) -> LoopRun:
+1 -1
View File
@@ -24,7 +24,7 @@ class LoopRun:
unfinished_evidence: str
# Set by each unfinished verdict; None before the chunk's first one, and once it finishes.
route: Route | None = None
# How many unfinished verdicts the chunk has had running; a finished chunk restarts it, and a rerun starts it at 0.
# How many unfinished verdicts the chunk has had running; a finished chunk and a rerun each set it to 0. It stays apart from route and unfinished_evidence, though all three change together at each verdict: merging or renaming a field stops a running loop at its next reload.
unfinished_run: int = 0