Answer the prose review's first round
This commit is contained in:
@@ -41,10 +41,10 @@ def delete_session(session: Session) -> Failure | None:
|
|||||||
return None
|
return None
|
||||||
stem = path.removesuffix(".jsonl")
|
stem = path.removesuffix(".jsonl")
|
||||||
# <session id>.jsonl, <session id>/subagents/, and from older versions <session id>.superseded-1789290815002/ and <session id>.orphaned-*.jsonl
|
# <session id>.jsonl, <session id>/subagents/, and from older versions <session id>.superseded-1789290815002/ and <session id>.orphaned-*.jsonl
|
||||||
# The transcript goes last, so a failed delete leaves a session that session_open still sees.
|
# The transcript goes last: a failed delete then leaves the session whole, never a new session with this id beside the old one's files.
|
||||||
for sibling in sorted(glob.glob(glob.escape(stem) + "*"), key=lambda sibling: sibling == path):
|
for sibling in sorted(glob.glob(glob.escape(stem) + "*"), key=lambda sibling: sibling == path):
|
||||||
try:
|
try:
|
||||||
shutil.rmtree(sibling) if os.path.isdir(sibling) else os.remove(sibling)
|
shutil.rmtree(sibling) if os.path.isdir(sibling) else os.remove(sibling)
|
||||||
except OSError as failure:
|
except OSError as failure:
|
||||||
return Failure(f"could not delete {sibling}: {failure.strerror or failure}; delete every file and folder matching {stem}* and rerun loop-claude, or the next chunk resumes the finished chunk's session")
|
return Failure(f"could not delete {sibling}: {failure.strerror or failure}; delete every file and folder matching {stem}*, then rerun loop-claude; until then the next chunk would resume the finished chunk's session")
|
||||||
return None
|
return None
|
||||||
|
|||||||
@@ -186,7 +186,7 @@ class Cycles(unittest.TestCase):
|
|||||||
self.addCleanup(folder.chmod, 0o700)
|
self.addCleanup(folder.chmod, 0o700)
|
||||||
fake = FakeEffects(streams=[Worker(self.paths.claude_code_transcripts.parent)], claude=[judged("finished")])
|
fake = FakeEffects(streams=[Worker(self.paths.claude_code_transcripts.parent)], claude=[judged("finished")])
|
||||||
stop = steps.run_cycle(self.cycle(fake))
|
stop = steps.run_cycle(self.cycle(fake))
|
||||||
self.assertEqual(stop, Stop(1, f"could not delete {folder}: Permission denied; delete every file and folder matching {folder}* and rerun loop-claude, or the next chunk resumes the finished chunk's session"))
|
self.assertEqual(stop, Stop(1, f"could not delete {folder}: Permission denied; delete every file and folder matching {folder}*, then rerun loop-claude; until then the next chunk would resume the finished chunk's session"))
|
||||||
self.assertTrue(session.session_open(self.session))
|
self.assertTrue(session.session_open(self.session))
|
||||||
self.assertEqual(self.archived_verdicts(), ["Task: Do it.\n\nVerdict: finished\n"])
|
self.assertEqual(self.archived_verdicts(), ["Task: Do it.\n\nVerdict: finished\n"])
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user