Name the path an archive failed on

This commit is contained in:
2026-09-28 17:00:41 +02:00
parent 6e31e0a833
commit a4b63e436e
3 changed files with 5 additions and 5 deletions
+2 -2
View File
@@ -47,12 +47,12 @@ def archive(root, path, note, paths):
raw = handle.read() raw = handle.read()
make_private(folder) make_private(folder)
except OSError as failure: except OSError as failure:
return Failure(f"could not archive the transcript {path}: {failure.strerror}") return Failure(f"could not archive the transcript: {failure.filename}: {failure.strerror}")
copy = folder / f"{hashlib.sha256(raw).hexdigest()}.jsonl" copy = folder / f"{hashlib.sha256(raw).hexdigest()}.jsonl"
# The copy lands last, so a copy on disk always has its verdict beside it. # The copy lands last, so a copy on disk always has its verdict beside it.
if not copy.exists(): if not copy.exists():
for dest, data in ((copy.with_suffix(".verdict.md"), f"{note}\n".encode()), (copy, raw)): for dest, data in ((copy.with_suffix(".verdict.md"), f"{note}\n".encode()), (copy, raw)):
if failure := replace_file(dest, data): if failure := replace_file(dest, data):
return Failure(f"could not archive the transcript {path}: {failure.strerror}") return Failure(f"could not archive the transcript: {failure.filename}: {failure.strerror}")
print(f"transcript: {copy}", file=sys.stderr) print(f"transcript: {copy}", file=sys.stderr)
return None return None
+2 -2
View File
@@ -14,8 +14,8 @@ Exit 1: no task, not inside a checkout, no premises, a models file it cannot rea
leaves no transcript or one it cannot read or archive, claude cannot start for an interrupt, a leaves no transcript or one it cannot read or archive, claude cannot start for an interrupt, a
reload with unreadable state, or the worker or the judge fails three times running. A worker fails reload with unreadable state, or the worker or the judge fails three times running. A worker fails
when claude cannot start, exits non-zero, is killed, or ends without a result event; a judge when when claude cannot start, exits non-zero, is killed, or ends without a result event; a judge when
claude cannot start or exits non-zero, or its verdict misses or mistypes a field, interrupts without a question, claude cannot start or exits non-zero, or its verdict misses or mistypes a field, interrupts without a
or quotes nothing in the transcript. question, or quotes nothing in the transcript.
Exit 2: the human is needed, to pick the model or answer an interrupt, and stdin or stdout is not a Exit 2: the human is needed, to pick the model or answer an interrupt, and stdin or stdout is not a
terminal, the input ends, or the interrupt ended with nothing typed. Rerunning resumes any terminal, the input ends, or the interrupt ended with nothing typed. Rerunning resumes any
open session. open session.
+1 -1
View File
@@ -314,7 +314,7 @@ class Cycles(unittest.TestCase):
checkout.archive().write_text("in the way") checkout.archive().write_text("in the way")
run = checkout.run([worker(say="landed-it"), judge(finished=True, evidence="landed-it")]) run = checkout.run([worker(say="landed-it"), judge(finished=True, evidence="landed-it")])
self.assertEqual((run.code, run.roles()), (1, ["worker", "judge"])) self.assertEqual((run.code, run.roles()), (1, ["worker", "judge"]))
self.assertRegex(run.stderr.strip().splitlines()[-1], r"^could not archive the transcript .*\.jsonl: ") self.assertRegex(run.stderr.strip().splitlines()[-1], r"^could not archive the transcript: .*/loop-claude-transcripts/proj: Not a directory$")
session = argument(run.calls[0], "--session-id") session = argument(run.calls[0], "--session-id")
checkout.archive().unlink() checkout.archive().unlink()
run = checkout.run([worker(), judge(finished=True)]) run = checkout.run([worker(), judge(finished=True)])