Return the verdict from run_cycle's judge–interrupt loop #113

Merged
lilleman merged 1 commits from run-cycle-verdict into rebuild 2026-09-28 21:10:02 +02:00
2 changed files with 12 additions and 9 deletions
+12 -8
View File
@@ -19,25 +19,29 @@ def run_cycle(root, task, premises, models, paths):
path = transcript_file(session)
if not path:
return Stop(1, f"claude left no transcript for session {session.id}")
verdict = judge_through_interrupts(root, task, premises, models, session, path, paths)
if isinstance(verdict, Stop):
return verdict
if verdict["finished"]:
if failure := archive(root, path, f"Task: {task}\n\nVerdict: finished", paths):
return Stop(1, failure.reason)
delete_session(session)
return Continue()
def judge_through_interrupts(root, task, premises, models, session, path, paths):
# The interrupt appends to this transcript, so each pass judges and archives it anew.
while True:
entries = read(path)
if isinstance(entries, Failure):
return Stop(1, entries.reason)
verdict = judge(root, task, premises, render(entries), models.judge)
if isinstance(verdict, Stop):
if isinstance(verdict, Stop) or not verdict["interrupt"]:
return verdict
if not verdict["interrupt"]:
break
if failure := archive(root, path, f"Task: {task}\n\nVerdict: interrupt\n\n{verdict['question']}", paths):
return Stop(1, failure.reason)
if stop := interrupt(root, session.id, models.worker, path, verdict["question"], paths):
return stop
if verdict["finished"]:
if failure := archive(root, path, f"Task: {task}\n\nVerdict: finished", paths):
return Stop(1, failure.reason)
delete_session(session)
return Continue()
def archive(root, path, note, paths):
-1
View File
@@ -8,7 +8,6 @@ The rebuild lifts every dimension: each item below is one chunk on a worktree ba
The places the panel on `rebuild` at 37edc9a named (`docs/decisions.md`), capping dimension first:
- **Return the verdict from `run_cycle`'s judge–interrupt loop, so nothing reads `verdict` after it.** Three seats; `archive`'s skip on an existing copy holds only because each interrupt appends a turn.
- **Name the minute `strike` sleeps, and the exec `reload_if_edited` may not return from, where each is called.** Four seats and three.
- **Let `render` join a human entry's text without relying on `user_entry_kind` having checked every part.** Three seats.
- **Give failure one spelling: `Failure.reason` and `Retry.failure`, `replace_file`'s raw `OSError`, and `typed`/`said` named for what they test.** Keep `LoopState`'s fields: they are main's `--reloaded` state (`docs/decisions.md`).