mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-22 19:41:15 +00:00
* fix(memory-core): write MEMORY.md atomically during short-term promotion applyShortTermPromotions rewrote MEMORY.md with a single non-atomic fs.writeFile, which truncates the file before streaming the new content. An OS write failure part way through (for example EFBIG on a size-limited or full volume) left MEMORY.md truncated to the bytes written before the failure, permanently dropping user long-term memory. The dreaming cron path invokes this writer automatically, and the recall store is only updated after the write, so the promotion stays eligible and the next run reads the already-truncated file. Route the write through replaceFileAtomic (temp file, fsync, atomic rename), the same durable-write helper the sibling DREAMS.md writer in this extension already uses. On failure the temp file is discarded and the existing MEMORY.md is left untouched; on success the content and the existing file mode are preserved. * fix(memory-core): harden atomic promotion durability --------- Co-authored-by: Peter Steinberger <steipete@gmail.com>