fix(config): use r+ mode for fsync on Windows to prevent migration retry loop

openSync with read-only mode fails fsync on Windows because FlushFileBuffers requires write-permission FD. This caused atomic writes to fail silently, leaving migrated config unwritten and triggering repeated migration + .bak.<timestamp> generation on every startup.

Same root cause as PR #3644 (#3643). Hyperplan disappear is a secondary symptom of plugin load instability.

Fixes #3877
This commit is contained in:
YeonGyu-Kim
2026-05-10 14:53:28 +09:00
parent 50699e3af1
commit f45452ae6c
+1 -1
View File
@@ -16,7 +16,7 @@ export function writeFileAtomically(
): void {
const tempPath = `${filePath}.tmp`
writeFileSync(tempPath, content, "utf-8")
const tempFileDescriptor = openSync(tempPath, "r")
const tempFileDescriptor = openSync(tempPath, "r+")
try {
tolerantFsyncSync(tempFileDescriptor, `writeFileAtomically:${filePath}`, deps.fsyncSync)
} finally {