Name the counters main reads back from a reload, and the baseline it compares against

This commit was merged in pull request #20.
This commit is contained in:
2026-09-24 23:16:35 +02:00
parent 4bd1261896
commit dbb228ad3b
2 changed files with 8 additions and 9 deletions
+8 -8
View File
@@ -42,10 +42,10 @@ import time
import uuid
ARCHIVE = os.path.expanduser(os.environ.get("AUTO_MODE_TRANSCRIPTS", "~/.claude/auto-mode-transcripts"))
FAILURES = "LOOP_CLAUDE_FAILURES"
CYCLE = "LOOP_CLAUDE_CYCLE"
RELOAD_BASELINE = open(__file__, encoding="utf-8").read()
RELOAD_CYCLE = "LOOP_CLAUDE_CYCLE"
RELOAD_FAILURES = "LOOP_CLAUDE_FAILURES"
SESSION_NAMESPACE = uuid.UUID("64fb586b-d926-4bb3-a44c-c903e86d3eec")
SOURCE = open(__file__, encoding="utf-8").read()
JUDGE_RULES = (
"Decide whether the human must now be interrupted. ask=true when any of these appear:\n"
@@ -338,14 +338,14 @@ def reload_if_edited(cycle_number, failures):
except OSError as failure:
print(f"keeping the running script: {failure}", file=sys.stderr)
return
if source == SOURCE:
if source == RELOAD_BASELINE:
return
trial = subprocess.run([sys.executable, __file__, "--help"], capture_output=True, text=True)
if trial.returncode != 0:
print(f"keeping the running script: {trial.stderr.strip() or f'exit {trial.returncode}'}", file=sys.stderr)
return
os.environ[FAILURES] = str(failures)
os.environ[CYCLE] = str(cycle_number)
os.environ[RELOAD_CYCLE] = str(cycle_number)
os.environ[RELOAD_FAILURES] = str(failures)
os.execv(sys.executable, [sys.executable, __file__, *sys.argv[1:]])
@@ -354,8 +354,8 @@ def main():
if task in ("", "-h", "--help"):
print(__doc__.strip())
sys.exit(0 if task else 1)
failures = int(os.environ.pop(FAILURES, 0))
cycle_number = int(os.environ.pop(CYCLE, 0))
cycle_number = int(os.environ.pop(RELOAD_CYCLE, 0))
failures = int(os.environ.pop(RELOAD_FAILURES, 0))
while True:
reload_if_edited(cycle_number, failures)
cycle_number += 1
-1
View File
@@ -4,7 +4,6 @@
Ordered by how many seats of the 2026-09-24 scoring panel (`docs/decisions.md`) named the place; each is one chunk.
- Make the re-exec handoff visible in `main`: the counters `reload_if_edited` carries across `os.execv` are named where they are read, and `SOURCE` says it is the reload baseline.
- State `larv-review`'s re-entry rules once, including whether §6's closing stability round counts against the stability cap.
- Decide resume-or-fresh in `run_cycle` from state it owns, and give `interrupt`'s no-tty and nothing-typed outcomes two distinct results.
- Give the concept words one definition a reader lands on, cited from where they are used; today three seats found them only in `CHANGELOG.md`'s one-word-per-concept entry.