Name the minute's sleep and the exec at their call sites #114

Merged
lilleman merged 2 commits from strike-reload-callsites into rebuild 2026-09-28 21:16:27 +02:00
5 changed files with 8 additions and 9 deletions
+2 -2
View File
@@ -4,7 +4,7 @@ import subprocess
from loop_claude.claude_code import structured_output
from loop_claude.outcome import Failure
from loop_claude.strike import strike
from loop_claude.retry import stop_or_sleep_a_minute
JUDGE_RULES = (
"Decide whether the human must now be interrupted. interrupt=true when any of these appear:\n"
@@ -60,7 +60,7 @@ def judge(root, task, premises, transcript, model):
failure = f"the judge quoted {verdict['evidence']!r}, nothing in the transcript" + (f", for the question: {verdict['question']}" if verdict["interrupt"] else "")
else:
return verdict
if stop := strike("judge", failures, failure):
if stop := stop_or_sleep_a_minute("judge", failures, failure):
return stop
+4 -4
View File
@@ -41,8 +41,8 @@ from loop_claude.cycle import run_cycle
from loop_claude.models import project_models
from loop_claude.outcome import Continue, Retry, Stop
from loop_claude.premises import read_premises
from loop_claude.reload import RELOAD_FLAG, decode_state, fingerprint, reload_if_edited
from loop_claude.strike import strike
from loop_claude.reload import RELOAD_FLAG, decode_state, exec_if_edited, fingerprint
from loop_claude.retry import stop_or_sleep_a_minute
@dataclasses.dataclass(frozen=True)
@@ -69,7 +69,7 @@ def run_loop(argv, env, paths, launcher, cwd):
return state
baseline = fingerprint(launcher)
while True:
reload_if_edited(launcher, baseline, state)
exec_if_edited(launcher, baseline, state)
state = dataclasses.replace(state, cycle_number=state.cycle_number + 1)
premises = read_premises(state.root)
if isinstance(premises, Stop):
@@ -83,7 +83,7 @@ def run_loop(argv, env, paths, launcher, cwd):
return stop
case Retry(failure):
state = dataclasses.replace(state, failures=state.failures + 1)
if stop := strike("worker", state.failures, failure):
if stop := stop_or_sleep_a_minute("worker", state.failures, failure):
return stop
case Continue():
state = dataclasses.replace(state, failures=0)
+1 -1
View File
@@ -32,7 +32,7 @@ def fingerprint(launcher):
return digest.hexdigest()
def reload_if_edited(launcher, baseline, state):
def exec_if_edited(launcher, baseline, state):
if fingerprint(launcher) == baseline:
return
trial = subprocess.run([sys.executable, launcher, "--help"], capture_output=True, text=True)
@@ -4,7 +4,7 @@ import time
from loop_claude.outcome import Stop
def strike(who, failures, failure):
def stop_or_sleep_a_minute(who, failures, failure):
if failures == 3:
return Stop(1, f"the {who} failed three times running: {failure}")
print(f"retrying the {who} in a minute: {failure}", file=sys.stderr)
-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:
- **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`).
- **Group `bin/loop_claude/`'s 18 flat modules, and move `principles/review-findings.md` beside larv-review.** Two seats; `claude_code.py` is the first group.