Stop the loop when a finished chunk's session cannot be deleted, and give the session one owner #184

Merged
lilleman merged 6 commits from session-owner into main 2026-10-02 07:47:49 +02:00
Showing only changes of commit ce9eaf6114 - Show all commits
+1 -1
View File
@@ -41,7 +41,7 @@ def delete_session(session: Session) -> Failure | None:
return None
stem = path.removesuffix(".jsonl")
# <session id>.jsonl, <session id>/subagents/, and from older versions <session id>.superseded-1789290815002/ and <session id>.orphaned-*.jsonl
# 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.
# The transcript goes last: a failed delete leaves a session session_open still sees, 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):
try:
shutil.rmtree(sibling) if os.path.isdir(sibling) else os.remove(sibling)