You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: detect silent SSE connection drops during long tool executions
When Claude runs a long script, the SSE connection can be silently
dropped by transport layers (OS TCP stack, Electron internals, HTTP
idle timeouts). Previously this caused the stream to appear "completed"
with partial content and no error message.
Two-part fix:
Server-side heartbeat (claude-client.ts):
- Send keep_alive SSE events every 30s independently of SDK activity
- Prevents intermediate layers from considering the connection idle
- Timer properly cleaned up in all exit paths including cancel()
Client-side detection (useSSEStream.ts + stream-session-manager.ts):
- Track whether the server's 'done' SSE event was received
- If reader finishes without 'done', treat as connection drop
- Show "Connection lost" error and clear stale SDK session
- Flush residual SSE buffer after reader signals done
i18n (en.ts + zh.ts):
- Add streaming.connectionDrop translation key
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: src/i18n/en.ts
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -57,6 +57,7 @@ const en = {
57
57
'streaming.allowForSession': 'Allow for Session',
58
58
'streaming.allowed': 'Allowed',
59
59
'streaming.denied': 'Denied',
60
+
'streaming.connectionDrop': 'Connection lost — the server stream ended unexpectedly. Claude may still be running in the background. Please try sending your message again.',
// Detect premature stream end (connection drop without server 'done' event)
362
+
if(!result.receivedDone){
363
+
cleanupTimers(stream);
364
+
365
+
constdropMsg='Connection lost — the server stream ended unexpectedly. Claude may still be running in the background. Please try sending your message again.';
0 commit comments