fix: share SSE connections across tabs, preserve login redirect URL (#153, #157)#159
fix: share SSE connections across tabs, preserve login redirect URL (#153, #157)#159myakove wants to merge 10 commits into
Conversation
|
Report bugs in Issues Welcome! 🎉This pull request will be automatically processed with the following features: 🔄 Automatic Actions
📋 Available CommandsPR Status Management
Review & Approval
Testing & Validation
Container Operations
Cherry-pick Operations
Branch Management
Label Management
✅ Merge RequirementsThis PR will be automatically approved when the following conditions are met:
📊 Review ProcessApprovers and ReviewersApprovers:
Reviewers:
Available Labels
AI Features
Security Checks
💡 Tips
For more information, please refer to the project documentation or contact the maintainers. |
PR Summary by QodoFix shared SSE across tabs and preserve post-login redirect
AI Description
Diagram
High-Level Assessment
Files changed (10)
|
Code Review by Qodo
Context used✅ Tickets:
🎫 fix: share SSE connections across tabs to avoid browser connection limit 🎫 Feedback: Clicking a link to a specific analysis opens the general dashboard✅ Compliance rules (platform):
40 rules 1.
|
|
Code review by qodo was updated up to the latest commit 19233f4 |
|
#153 - not fixed; check logs or simulate - when opmning multiple browser tabs, some get stuck in loading |
|
Code review by qodo was updated up to the latest commit 09d7aad |
|
@rnetser The SSE connection issue has been redesigned. Instead of per-URL connection sharing (which didn't help when different tabs view different jobs), we now use a single multiplexed SSE endpoint ( The dev server has been redeployed with this fix — please test with multiple browser tabs and let us know if the loading issue is resolved. |
|
Investigated the multiple-tabs-stuck-in-loading issue. Found and fixed three root causes in 1. Split-brain leader election → multiple EventSources 2. Browser auto-reconnect creating duplicate connections 3. No leader liveness detection All 251 frontend tests pass. Please re-test with 3+ tabs. |
|
Code review by qodo was updated up to the latest commit b55c922 |
|
Investigated the issue — the root cause was that the deployed container image was built before the The fix (already in the codebase) uses Redeployed the dev server from staging (commit 406e1f5) which includes the full fix. Verified the new JS bundle contains |
|
#153 looks like it is fixed |
… exhaustion (#153) Three fixes for tabs stuck in loading when opening multiple browser tabs: 1. navigator.locks-based leader election: replaces the BroadcastChannel timeout-based election which was prone to split-brain. The browser guarantees only one tab holds the lock, and auto-releases on close. 2. Explicit EventSource close on error: prevents browser auto-reconnect from opening duplicate connections that exhaust the 6-per-domain limit. 3. Leader heartbeat + follower watchdog: detects unresponsive leaders and triggers re-election after 12s timeout. All 251 frontend tests pass.
c516667 to
3645e95
Compare
|
Code review by qodo was updated up to the latest commit 3645e95 |
|
I have just tried accessing job |
|
Code review by qodo was updated up to the latest commit cdb76af |
|
Code review by qodo was updated up to the latest commit 28ffd5c |
|
Code review by qodo was updated up to the latest commit d48f3f2 |
Summary
Fix two browser UX issues:
Shared SSE connections (fix: share SSE connections across tabs to avoid browser connection limit #153): Browsers enforce a 6 concurrent HTTP/1.1 connection limit per domain. Each tab opened 2-4 persistent SSE connections, causing the app to hang with 3+ tabs. Now uses a
BroadcastChannel-baseduseSharedSSEhook — one tab owns theEventSourceconnections and relays events to all other tabs. If the leader tab closes, a follower takes over.Preserve login redirect URL (Feedback: Clicking a link to a specific analysis opens the general dashboard #157): Deep links (e.g.,
/results/abc123) were lost during login redirect.ProtectedRoutenow passes the original location in state, andRegisterPagenavigates back to it after login.Closes #153
Closes #157
Changes
frontend/src/lib/useSharedSSE.ts— BroadcastChannel leader-election hook with exponential backoff reconnectEventSourceusages (Layout, Dashboard, Status, Report, ChatUI, TokenUsage, ServerSettings)sessionKey/sseReconnectCountin ChatUIProtectedRoute.tsx: passstate={{ from: location }}to/loginRegisterPage.tsx: navigate tostate.from.pathnameafter login (3 navigation points)