mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-11-25 06:36:49 +09:00
On Windows, renameSync over .claude-flow/policy/state.json fails with EPERM/EBUSY/EACCES while another process briefly holds the destination open. writeJsonAtomic made a single attempt with no cleanup, so the whole MCP call failed and state.json.<pid>.<uuid>.tmp was left behind. - Retry transient rename errors with a bounded async backoff (~1.3s total, inside the 5s state.lock wait; async so the MCP event loop is not blocked). - try/finally removes the temp file on any final failure. - A final failure still fails the call: the state carries the hash-chained receipt ledger and consumed approval uses; dropping the write would return a phantom receipt and let a one-shot approval be reused. Fixes #3398