Name the minute's sleep and the exec at their call sites
This commit is contained in:
@@ -4,7 +4,7 @@ import subprocess
|
|||||||
|
|
||||||
from loop_claude.claude_code import structured_output
|
from loop_claude.claude_code import structured_output
|
||||||
from loop_claude.outcome import Failure
|
from loop_claude.outcome import Failure
|
||||||
from loop_claude.strike import strike
|
from loop_claude.strike import stop_or_sleep_a_minute
|
||||||
|
|
||||||
JUDGE_RULES = (
|
JUDGE_RULES = (
|
||||||
"Decide whether the human must now be interrupted. interrupt=true when any of these appear:\n"
|
"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 "")
|
failure = f"the judge quoted {verdict['evidence']!r}, nothing in the transcript" + (f", for the question: {verdict['question']}" if verdict["interrupt"] else "")
|
||||||
else:
|
else:
|
||||||
return verdict
|
return verdict
|
||||||
if stop := strike("judge", failures, failure):
|
if stop := stop_or_sleep_a_minute("judge", failures, failure):
|
||||||
return stop
|
return stop
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -41,8 +41,8 @@ from loop_claude.cycle import run_cycle
|
|||||||
from loop_claude.models import project_models
|
from loop_claude.models import project_models
|
||||||
from loop_claude.outcome import Continue, Retry, Stop
|
from loop_claude.outcome import Continue, Retry, Stop
|
||||||
from loop_claude.premises import read_premises
|
from loop_claude.premises import read_premises
|
||||||
from loop_claude.reload import RELOAD_FLAG, decode_state, fingerprint, reload_if_edited
|
from loop_claude.reload import RELOAD_FLAG, decode_state, exec_if_edited, fingerprint
|
||||||
from loop_claude.strike import strike
|
from loop_claude.strike import stop_or_sleep_a_minute
|
||||||
|
|
||||||
|
|
||||||
@dataclasses.dataclass(frozen=True)
|
@dataclasses.dataclass(frozen=True)
|
||||||
@@ -69,7 +69,7 @@ def run_loop(argv, env, paths, launcher, cwd):
|
|||||||
return state
|
return state
|
||||||
baseline = fingerprint(launcher)
|
baseline = fingerprint(launcher)
|
||||||
while True:
|
while True:
|
||||||
reload_if_edited(launcher, baseline, state)
|
exec_if_edited(launcher, baseline, state)
|
||||||
state = dataclasses.replace(state, cycle_number=state.cycle_number + 1)
|
state = dataclasses.replace(state, cycle_number=state.cycle_number + 1)
|
||||||
premises = read_premises(state.root)
|
premises = read_premises(state.root)
|
||||||
if isinstance(premises, Stop):
|
if isinstance(premises, Stop):
|
||||||
@@ -83,7 +83,7 @@ def run_loop(argv, env, paths, launcher, cwd):
|
|||||||
return stop
|
return stop
|
||||||
case Retry(failure):
|
case Retry(failure):
|
||||||
state = dataclasses.replace(state, failures=state.failures + 1)
|
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
|
return stop
|
||||||
case Continue():
|
case Continue():
|
||||||
state = dataclasses.replace(state, failures=0)
|
state = dataclasses.replace(state, failures=0)
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ def fingerprint(launcher):
|
|||||||
return digest.hexdigest()
|
return digest.hexdigest()
|
||||||
|
|
||||||
|
|
||||||
def reload_if_edited(launcher, baseline, state):
|
def exec_if_edited(launcher, baseline, state):
|
||||||
if fingerprint(launcher) == baseline:
|
if fingerprint(launcher) == baseline:
|
||||||
return
|
return
|
||||||
trial = subprocess.run([sys.executable, launcher, "--help"], capture_output=True, text=True)
|
trial = subprocess.run([sys.executable, launcher, "--help"], capture_output=True, text=True)
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import time
|
|||||||
from loop_claude.outcome import Stop
|
from loop_claude.outcome import Stop
|
||||||
|
|
||||||
|
|
||||||
def strike(who, failures, failure):
|
def stop_or_sleep_a_minute(who, failures, failure):
|
||||||
if failures == 3:
|
if failures == 3:
|
||||||
return Stop(1, f"the {who} failed three times running: {failure}")
|
return Stop(1, f"the {who} failed three times running: {failure}")
|
||||||
print(f"retrying the {who} in a minute: {failure}", file=sys.stderr)
|
print(f"retrying the {who} in a minute: {failure}", file=sys.stderr)
|
||||||
|
|||||||
@@ -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:
|
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.
|
- **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`).
|
- **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.
|
- **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.
|
||||||
|
|||||||
Reference in New Issue
Block a user