Name the path an archive failed on
This commit is contained in:
@@ -47,12 +47,12 @@ def archive(root, path, note, paths):
|
||||
raw = handle.read()
|
||||
make_private(folder)
|
||||
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"
|
||||
# The copy lands last, so a copy on disk always has its verdict beside it.
|
||||
if not copy.exists():
|
||||
for dest, data in ((copy.with_suffix(".verdict.md"), f"{note}\n".encode()), (copy, raw)):
|
||||
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)
|
||||
return None
|
||||
|
||||
@@ -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
|
||||
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
|
||||
claude cannot start or exits non-zero, or its verdict misses or mistypes a field, interrupts without a question,
|
||||
or quotes nothing in the transcript.
|
||||
claude cannot start or exits non-zero, or its verdict misses or mistypes a field, interrupts without a
|
||||
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
|
||||
terminal, the input ends, or the interrupt ended with nothing typed. Rerunning resumes any
|
||||
open session.
|
||||
|
||||
@@ -314,7 +314,7 @@ class Cycles(unittest.TestCase):
|
||||
checkout.archive().write_text("in the way")
|
||||
run = checkout.run([worker(say="landed-it"), judge(finished=True, evidence="landed-it")])
|
||||
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")
|
||||
checkout.archive().unlink()
|
||||
run = checkout.run([worker(), judge(finished=True)])
|
||||
|
||||
Reference in New Issue
Block a user