Files
ruflo/v3/@claude-flow
Dragan SpiridonovandRuflo & AQE 42011db977 fix(policy): remove orphaned atomic-write temp files under the policy lock (#3164)
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
2026-10-18 09:48:36 +02:00
..
2026-10-10 20:30:01 -04:00
…