fix: resolve four silent failure modes in WebSocket communication#154
Merged
Zhang-Henry merged 1 commit intoOpenLAIR:mainfrom Apr 9, 2026
Merged
Conversation
1. Provider crash error reporting: .catch() blocks now send error messages to the browser instead of only logging to server console. Frontend already handles all error types — was just missing the server-side writer.send() calls. (7 catch blocks across 6 providers) 2. Session-busy notifications: concurrent requests to active sessions now return a 'session-busy' message instead of silently dropping. Added frontend handler to show inline notification. (7 guards + 1 handler) 3. WebSocket exponential backoff: replaces fixed 3s reconnect with 3s → 6s → 12s → 24s → 30s (cap). Resets on successful connection. 4. Database indexes: adds last_activity and composite (project_name, last_activity) indexes to session_metadata for sort query performance. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes four P0 stability issues identified during architecture brainstorm analysis:
Provider crash error reporting —
.catch()blocks across all 6 providers (7 sites) now send error messages to the browser via WebSocket instead of onlyconsole.error(). The frontend already handlesclaude-error,cursor-error,codex-error,gemini-error,openrouter-error,localgpu-error— was just missing the server-sidewriter.send()calls. Previously, users saw an infinite loading spinner when a provider crashed mid-stream.Session-busy notifications — When a concurrent request hits an already-active session, the server now sends a
session-busymessage instead of silently dropping the request. Added frontend handler to display inline notification (7 guard sites + 1 new switch case).WebSocket exponential backoff — Replaces fixed 3-second reconnect interval with exponential backoff: 3s → 6s → 12s → 24s → 30s (cap). Resets on successful connection. Prevents hammering the server during extended outages.
Database indexes — Adds
last_activityand composite(project_name, last_activity)indexes tosession_metadatatable. The hot query ingetSessionsByProjects()sorts bylast_activity DESCbut previously had no index, requiring full table scan.Files Changed
server/index.jssrc/components/chat/hooks/useChatRealtimeHandlers.tssession-busyhandlersrc/contexts/WebSocketContext.tsxserver/database/db.jsCREATE INDEX IF NOT EXISTSin migrationsTest plan
PRAGMA index_list(session_metadata)includes new indexes after restart🤖 Generated with Claude Code