Commit 94e4b01
committed
🤖 fix: use atomic writes for partial.json to prevent corruption
Non-atomic fs.writeFile can leave truncated/malformed JSON if the app
crashes mid-write. This causes 'Unexpected end of JSON input' errors
when reading partial.json on the next stream start, leading to amnesia
(messages being lost).
Use write-file-atomic which writes to a temp file then renames,
ensuring readers always see either the old complete file or the new
complete file, never a partial write.
Fixes #8031 parent 284dbc7 commit 94e4b01
1 file changed
+4
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
80 | 81 | | |
81 | 82 | | |
82 | 83 | | |
83 | | - | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
84 | 87 | | |
85 | 88 | | |
86 | 89 | | |
| |||
0 commit comments