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(ui): SSE connection status indicators for mobile network drops (NeuralNomadsAI#549)
## 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
1. **server-events.ts**: Add `onDisconnect()` handler
- Mirrors existing `onOpen()` pattern
- 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 subsequent
events)
- Log transitions for debug visibility
3. **AGENTS.md**: Add PR Review Principles
- Check regressions first, 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 disconnect
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)
## Related
- Complements PR NeuralNomadsAI#519 (pong retry with timeout) - merged upstream
- Addresses mobile UX gap: workspace-level SSE state now visible to all
users (not just debug overlay)
---------
Co-authored-by: Shantur Rathore <i@shantur.com>
Co-authored-by: Pascal André <pascalandr@gmail.com>
0 commit comments