From f45452ae6ca966869e95c6f259bb317ee147a50b Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Sun, 10 May 2026 14:53:28 +0900 Subject: [PATCH] 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. generation on every startup. Same root cause as PR #3644 (#3643). Hyperplan disappear is a secondary symptom of plugin load instability. Fixes #3877 --- src/shared/write-file-atomically.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/write-file-atomically.ts b/src/shared/write-file-atomically.ts index 09ce5b7d5..7f6544761 100644 --- a/src/shared/write-file-atomically.ts +++ b/src/shared/write-file-atomically.ts @@ -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 {