fix: improve event stream reconnect reliability

Recover stalled event streams without dropping the session
Wait briefly for reconnection before showing connection lost errors
Persist Electron server logs for easier disconnect debugging
This commit is contained in:
Bohdan Triapitsyn
2026-04-22 21:03:02 +03:00
parent 17dd526731
commit f24e6de21b
10 changed files with 493 additions and 139 deletions
@@ -1519,11 +1519,7 @@ const ChatInputComponent: React.FC<ChatInputProps> = ({ onOpenSettings, scrollTo
}
else if (commandName === 'compact' && currentSessionId) {
try {
if (!useConfigStore.getState().isConnected) {
const reason = useConfigStore.getState().lastDisconnectReason;
const suffix = reason ? ` (${reason})` : " (never connected)";
throw new Error(`Connection lost${suffix}. Please wait for reconnection.`);
}
await sessionActions.waitForConnectionOrThrow();
const { opencodeClient } = await import('@/lib/opencode/client');
const sdk = opencodeClient.getSdkClient();
const configState = useConfigStore.getState();