mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-12-05 06:56:22 +09:00
A writer killed between creating <file>.<pid>.<uuid>.tmp and renaming it (SIGKILL from a caller's timeout, OOM) never reaches writeJsonAtomic's cleanup, so a full-size copy of state.json or ledger-anchors.json stays in the policy directory forever. On a mature ledger each copy is ~250 MB; one host had 13 of them (1.9 GB). Every writer of state.json, ledger-anchors.json, state.anchor.json and ledger-anchor-head.json holds the project's state.lock, so a transaction or verify that holds the lock removes temp files of exactly those names. Only regular files that match <name>.<pid>.<uuid>.tmp and are at least 60 s old are removed; symlinks, directories, fresh temps and other files' temps are left alone, and a failure never fails the caller. Co-Authored-By: Ruflo & AQE Claude-Session: https://claude.ai/code/session_011Qe66m38aobVEJGHAbFVzv