fix(ui): SSE connection status indicators for mobile network drops#549
fix(ui): SSE connection status indicators for mobile network drops#549JDis03 wants to merge 1 commit into
Conversation
Implements immediate visual feedback when SSE transport disconnects (wifi drops, Cloudflare idle timeouts, mobile network switches). ## Problem Per-instance status dots remained frozen at 'connected' (green) when SSE transport dropped because: - Instance status updates travel over SSE (impossible when SSE is down) - EventSource.onerror doesn't fire immediately on mobile wifi drops - No user-facing indication of workspace-level SSE state ## Solution 1. server-events.ts: Add onDisconnect() handler (mirrors existing onOpen) - Fire disconnectHandlers in scheduleReconnect() when connection drops 2. sse-manager.ts: Register SSE lifecycle handlers - onDisconnect: set ALL instances to 'connecting' (amber dot) - onOpen: clear 'connecting' status (green dot restored by events) - Log transitions for debug visibility 3. AGENTS.md: Add PR Review Principles section - Check regressions, look for better implementations - Be the PR gatekeeper, ruthless code quality - Test before responding, UI/server version parity ## Verification - TypeScript compilation clean (pre-existing SDK errors unrelated) - Vite build successful - Mobile testing: SSE disconnect → immediate amber dots - Reconnect → green dots restored ## Edge Cases Handled - Transient drop: amber → green on reconnect (no false modal) - Instance dies during outage: amber → green → 'disconnected' event → red - 0 instances: Map empty, loop is no-op - Rapid reconnect cycles: idempotent (setting 'connecting' on 'connecting' is no-op) Complements PR NeuralNomadsAI#519 (pong retry with timeout) - merged upstream.
|
PR builds are available as GitHub Actions artifacts: https://github.com/NeuralNomadsAI/CodeNomad/actions/runs/27416160552 Artifacts expire in 7 days.
|
|
I want you to perform the gatekeeper checks for latest PR state check for regressions |
|
Gatekeeper review for latest PR state ( Understood request: perform a strict PR review focused on regressions, implementation quality, and better possible approaches. I treated this as a review-only request and did not change code. Findings
This is a real regression because Better implementation: keep transport reachability as separate overlay state instead of overwriting instance stream status. For display, derive
Better implementation: extend the transport callback contract with transport status events, or map native
I found no tests around Verification Attempted
I did not treat those command failures as PR-introduced by themselves, but they mean I could not independently confirm the PR’s claimed clean build/typecheck from this webhook environment. Recommendation -- |
Problem
Mobile users experience SSE disconnections (wifi drops, Cloudflare idle timeouts) but get no visual feedback. The per-instance status dots remain green even when the SSE transport is down, because instance status updates travel over the broken SSE pipe.
Solution
This PR implements immediate connection status feedback by propagating SSE transport state to all instance status indicators:
Changes
server-events.ts: Add
onDisconnect()handleronOpen()patterndisconnectHandlersinscheduleReconnect()when connection dropssse-manager.ts: Register SSE lifecycle handlers
onDisconnect: set ALL instances toconnecting(amber dot)onOpen: clearconnectingstatus (green dot restored by subsequent events)AGENTS.md: Add PR Review Principles
Verification
Edge Cases Handled
disconnectedevent → redconnectingonconnectingis no-op)Related