Skip to content

The agent that grows with you

fix(desktop): don't let a closed secondary veto a runtime an open socket serves

teknium1defb7033ff4e
diff --git a/apps/desktop/src/store/gateway.ts b/apps/desktop/src/store/gateway.ts
index e7f7a10b238..37cad24405d 100644
--- a/apps/desktop/src/store/gateway.ts
+++ b/apps/desktop/src/store/gateway.ts
@@ -543,7 +543,15 @@ export function pendingSessionReplay(runtimeId: string): Promise<boolean> | unde
const reconnectable = [...g.secondaries.values()].filter(entry => entry.wantOpen && !entry.retiredByPool)
const clients = new Set([g.primaryGateway, ...reconnectable.map(entry => entry.gateway)])
+ // A closed socket's false means only that IT cannot replay yet. When another
+ // open socket already serves this runtime, that socket orders the read.
+ const servedOpen = [...clients].some(client => isOpen(client) && client?.getSeqWatermarks?.()[runtimeId] != null)
+
const pending = [...clients].flatMap(client => {
+ if (servedOpen && !isOpen(client)) {
+ return []
+ }
+
// A dev-HMR survivor can predate the barrier method.
const barrier = client?.sessionReplayBarrier?.(runtimeId)