From 4bd1261896f7e76cb961adc1a9a6d9fb205291f6 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Thu, 24 Sep 2026 23:16:35 +0200 Subject: [PATCH 1/2] Pin the reload handoff under RELOAD_ names --- bin/test_loop_claude.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/test_loop_claude.py b/bin/test_loop_claude.py index 80d5be85..ae63af3e 100644 --- a/bin/test_loop_claude.py +++ b/bin/test_loop_claude.py @@ -209,15 +209,15 @@ class Reload(unittest.TestCase): def test_runs_the_edited_file_before_trusting_it(self): with tempfile.TemporaryDirectory() as root: script = os.path.join(root, "loop-claude") - open(script, "w").write(loop.SOURCE.replace("import glob\n", "import glob\nimport no_such_module\n")) + open(script, "w").write(loop.RELOAD_BASELINE.replace("import glob\n", "import glob\nimport no_such_module\n")) with unittest.mock.patch.object(loop, "__file__", script), unittest.mock.patch("os.execv") as execv: loop.reload_if_edited(cycle_number=1, failures=0) execv.assert_not_called() - open(script, "w").write(loop.SOURCE.replace("CYCLE = ", "CYCLE = \"x\" or ")) + open(script, "w").write(loop.RELOAD_BASELINE.replace("RELOAD_CYCLE = ", "RELOAD_CYCLE = \"x\" or ")) with unittest.mock.patch.object(loop, "__file__", script), unittest.mock.patch("os.execv") as execv: loop.reload_if_edited(cycle_number=1, failures=2) execv.assert_called_once() - self.assertEqual((os.environ.pop(loop.CYCLE), os.environ.pop(loop.FAILURES)), ("1", "2")) + self.assertEqual((os.environ.pop(loop.RELOAD_CYCLE), os.environ.pop(loop.RELOAD_FAILURES)), ("1", "2")) if __name__ == "__main__": -- 2.52.0 From dbb228ad3b12cc693e53874d012830643d9ccc19 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Thu, 24 Sep 2026 23:16:35 +0200 Subject: [PATCH 2/2] Name the counters main reads back from a reload, and the baseline it compares against --- bin/loop-claude | 16 ++++++++-------- todo.md | 1 - 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/bin/loop-claude b/bin/loop-claude index 1a3770a4..a414d5d2 100755 --- a/bin/loop-claude +++ b/bin/loop-claude @@ -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 diff --git a/todo.md b/todo.md index 23c87e10..2479bc2b 100644 --- a/todo.md +++ b/todo.md @@ -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. -- 2.52.0