From 5751dc655e0a20e6c2c0a5e87eefdb92cfc76a9d Mon Sep 17 00:00:00 2001 From: Jerins71 Date: Mon, 19 Oct 2026 17:08:27 -0500 Subject: [PATCH] fix: use writable handles for controlled message fsync on Windows --- apps/backend/src/swarm/session/conversation-projector.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/backend/src/swarm/session/conversation-projector.ts b/apps/backend/src/swarm/session/conversation-projector.ts index 819538806..6af7a8fe1 100644 --- a/apps/backend/src/swarm/session/conversation-projector.ts +++ b/apps/backend/src/swarm/session/conversation-projector.ts @@ -360,7 +360,7 @@ export class ConversationProjector { if (existing.controlCommandId !== control.commandId || existing.controlInputHash !== control.contentHash) { throw Object.assign(new Error("Canonical input ID has conflicting content."), { code: "CONFLICT", retryable: false }); } - const fd = openSync(descriptor.sessionFile, "r"); + const fd = openSync(descriptor.sessionFile, "r+"); try { fsyncSync(fd); } finally { closeSync(fd); } return existing; } @@ -380,7 +380,7 @@ export class ConversationProjector { if (!persisted || persisted.controlInputHash !== control.contentHash) { throw new Error("Canonical writer did not persist the controlled input."); } - const fd = openSync(descriptor.sessionFile, "r"); + const fd = openSync(descriptor.sessionFile, "r+"); try { fsyncSync(fd); } finally { closeSync(fd); } const source = statSync(descriptor.sessionFile); control.onLocator?.({ fileGeneration: `${source.dev}:${source.ino}`, byteOffset: offset, entryId: persisted.timelineEntryId ?? persisted.id! });