From 97d987b6c567fbda98c702b1501df713c539c27d Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Thu, 24 Sep 2026 22:18:39 +0200 Subject: [PATCH] Keep the archive path, exit on the judge's third failure, make archive folders under one umask --- bin/loop-claude | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/bin/loop-claude b/bin/loop-claude index 0c0a2830..23346a99 100755 --- a/bin/loop-claude +++ b/bin/loop-claude @@ -110,7 +110,7 @@ def project(): def project_path(): - return project().removeprefix("~").lstrip("/") + return project().removeprefix("~/code").lstrip("/") or "code" def session_name(): @@ -173,9 +173,11 @@ def human_turns(entries): def make_private(folder): - if folder and not os.path.isdir(folder): - make_private(os.path.dirname(folder)) - os.mkdir(folder, 0o700) + mask = os.umask(0o077) + try: + os.makedirs(folder, exist_ok=True) + finally: + os.umask(mask) def archive(path, note): @@ -298,9 +300,10 @@ def verdict_on(task, premises, path): for attempt in range(3): if verdict := judge(task, premises, render(entries(path))): return verdict + if attempt == 2: + sys.exit("the judge failed three times running") print("the judge failed - retrying in a minute", file=sys.stderr) time.sleep(60) - sys.exit("the judge failed three times running") def handoff(session_id, path, question): @@ -342,7 +345,7 @@ def reload_if_edited(round_number, failures): 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()}", file=sys.stderr) + 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[ROUND] = str(round_number)