fix: recover chat state after idle reconnects

Resyncs active sessions after hidden upstream stream reconnects
Recovers orphaned streaming parts with active-session snapshots
Adds coverage for event-stream reconnect behavior
This commit is contained in:
Bohdan Triapitsyn
2026-07-01 17:21:19 +03:00
parent 73c9431883
commit b60a794e80
8 changed files with 86 additions and 41 deletions
@@ -120,6 +120,17 @@ export function createGlobalMessageStreamWsBridge({
for (const socket of Array.from(clients)) {
if (!readyClients.has(socket)) {
markReady(socket, clientLastEventIds.get(socket) ?? '');
continue;
}
if (status.wasReady) {
const sent = sendMessageStreamWsFrame(socket, {
type: 'ready',
scope: 'global',
});
if (!sent) {
removeClient(socket);
}
}
}
return;