* fix(core): platformWriteSync must retry transient rename locks, not truncate readers (#1540) platformWriteSync fell back to a non-atomic fs.writeFileSync(filePath) on ANY error from the temp+rename path. On Windows, renameSync onto a target a reader holds open throws EPERM/EBUSY/EACCES (the common case for hot files like STATE.md), so the fallback fired and a concurrent reader saw the file mid-truncation. Mirror the capability-ledger rename-retry idiom: retry transient lock errnos (EPERM/EBUSY/EACCES) with a bounded Atomics.wait backoff; on a persistent lock, surface the error rather than do the truncating non-atomic write. Genuinely unrenameable cases (EXDEV cross-device) and tmp-write failures still fall back. Claude-Session: https://claude.ai/code/session_01R88n7Q54bAaVHFkDbbH1yz * chore(changeset): Fixed fragment for #1541 (platformWriteSync rename retry) Claude-Session: https://claude.ai/code/session_01R88n7Q54bAaVHFkDbbH1yz --------- Co-authored-by: Tom Boucher <trekkie@nomorestars.com>
This commit is contained in:
5
.changeset/wise-ibex-dart.md
Normal file
5
.changeset/wise-ibex-dart.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
type: Fixed
|
||||
pr: 1541
|
||||
---
|
||||
Atomic file writes now retry a transient rename lock on Windows (a reader holding the target open) instead of falling back to a non-atomic write that could let a concurrent reader observe a truncated STATE.md/ROADMAP.md.
|
||||
Reference in New Issue
Block a user