Skip to content

Preserve complete session saves on write failure - #85

Merged
he-yufeng merged 1 commit into
mainfrom
fix/atomic-session-save-20261126
Nov 25, 2026
Merged

he-yufeng merged 1 commit into
mainfrom
fix/atomic-session-save-20261126

Conversation

@he-yufeng

@he-yufeng he-yufeng commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

A failed save no longer truncates the last complete session. The new JSON goes to a temporary file in the same directory, is flushed and closed, and only then replaces the archive. The JSON format and session ids are unchanged.

The regression applies a process-local file size limit during a second save. On v0.18.0 the save returned EFBIG and the archive was unreadable. With this change the old bytes and messages are intact and the temporary file is removed. The installed wheel check also runs this regression and a successful replacement case.

Local verification: 42 targeted tests passed, with three unrelated path-normalization cases excluded. Ruff and git diff --check passed.

Closes #86

@he-yufeng
he-yufeng merged commit 0b353f2 into main Nov 25, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Keep the last complete session if a save fails

1 participant