fix: retry transient Windows atomic renames - #102
Merged
lidge-jun merged 7 commits intoJul 12, 2026
Conversation
Wibias
force-pushed
the
codex/retry-windows-atomic-rename
branch
2 times, most recently
from
July 12, 2026 01:04
6dbff4b to
00726bd
Compare
Wibias
force-pushed
the
codex/retry-windows-atomic-rename
branch
from
July 12, 2026 01:18
00726bd to
21e58b0
Compare
lidge-jun
marked this pull request as ready for review
July 12, 2026 06:53
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Makes atomic config/secret writes resilient to transient Windows file locks (antivirus/indexing) by retrying the rename briefly. Windows-only behavior change.
Background / motivation
The security slice (Part 1) writes secrets via atomic temp-file + rename. On Windows, AV or the search indexer can hold a short-lived lock on the target during the rename, surfacing as
EBUSY/EPERM/EACCESand crashing the write. A bounded retry absorbs that window.What changed
src/config.ts— newrenameAtomicFile(source, destination, io):EBUSY/EPERM/EACCES.25ms, then50ms; rethrows afterward.AtomicRenameIO { platform, rename, sleep }so tests simulate transient failures deterministically.tests/config.test.ts— covers first-attempt success, transient-then-success, exhausted-retries rethrow, and non-Windows single-attempt.Usage
Transparent. Non-Windows keeps a single rename with no retry.
Risk
Testing
config-> pass (including injected transient-failure cases). Full suite green.