Add WebSocket disconnect recovery and slow RPC toast UX#1730
Add WebSocket disconnect recovery and slow RPC toast UX#1730juliusmarminge merged 10 commits intomainfrom
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
ApprovabilityVerdict: Needs human review This PR introduces substantial new functionality: WebSocket disconnect recovery with automatic reconnection, slow RPC toast notifications, and blocking connection states. The scope includes new state management (~500 lines), new UI components, modified transport behavior, and changes to error propagation throughout the app. While well-tested and from a trusted author, the feature's breadth and runtime impact warrant human review. You can customize Macroscope's approvability policy. Learn more. |
Resolve the replay recovery merge conflict by keeping main's bounded replay retry logic and the PR's reconnect-triggered resubscribe recovery path. Co-authored-by: codex <codex@users.noreply.github.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix prepared a fix for 1 of the 2 issues found in the latest run.
- ✅ Fixed: Dead conditional returns identical value in both branches
- Changed the null-nextRetryAt branch to return 'Reconnecting to T3 Server' to differentiate the actively-retrying state from the waiting-for-next-retry state.
Or push these changes by commenting:
@cursor push c69586f797
Preview (c69586f797)
diff --git a/apps/web/src/components/WebSocketConnectionSurface.tsx b/apps/web/src/components/WebSocketConnectionSurface.tsx
--- a/apps/web/src/components/WebSocketConnectionSurface.tsx
+++ b/apps/web/src/components/WebSocketConnectionSurface.tsx
@@ -60,7 +60,7 @@
function buildReconnectTitle(status: WsConnectionStatus): string {
if (status.nextRetryAt === null) {
- return "Disconnected from T3 Server";
+ return "Reconnecting to T3 Server";
}
return "Disconnected from T3 Server";You can send follow-ups to the cloud agent here.
Reviewed by Cursor Bugbot for commit 4cd078a. Configure here.
| } | ||
|
|
||
| return "Disconnected from T3 Server"; | ||
| } |
There was a problem hiding this comment.
Dead conditional returns identical value in both branches
Low Severity
In buildReconnectTitle, the conditional check on status.nextRetryAt always returns "Disconnected from T3 Server". This makes the conditional effectively dead code, suggesting an incomplete implementation where different titles were intended for various reconnection states.
Reviewed by Cursor Bugbot for commit 4cd078a. Configure here.
- Show a blocking connection surface when the socket is unavailable - Add reconnect/offline toasts and slow RPC ack warnings - Hide transport errors from thread-level error displays
- Drop the slow-ack warning threshold from 15s to 2.5s - Extend the websocket transport test timeout to avoid flake
Co-authored-by: codex <codex@users.noreply.github.com>
4cd078a to
6e70a96
Compare
|
It'd definitely help if we add UI that shows websocket errors! |
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: Hwanseo Choi <hwanseoc@nvidia.com> Co-authored-by: codex <codex@users.noreply.github.com>
…nnect-recovery Merge upstream: Add WebSocket disconnect recovery and slow RPC toast UX (pingdotgg#1730)
Co-authored-by: Hwanseo Choi <hwanseoc@nvidia.com> Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: Hwanseo Choi <hwanseoc@nvidia.com> Co-authored-by: codex <codex@users.noreply.github.com>



Summary
online/focusevents, plus a manual retry action and recovery toast when the connection returns.Testing
bun fmtbun lintbun typecheckbun run testNote
Medium Risk
Touches core WebSocket transport/protocol and subscription recovery logic; regressions could impact connectivity, retries, and event replay during disconnects, though changes are mostly additive with tests.
Overview
Improves WebSocket resiliency and UX by adding a blocking
WebSocketConnectionSurfaceduring initial connection failures plus coordinators that auto-reconnect on browseronline/focus, show reconnect/offline/exhausted/recovered toasts, and allow manual retry.Adds global WebSocket connection state tracking with exponential backoff and a
WsTransport.reconnect()path that swaps sessions without disposing the transport; stream subscriptions now supportonResubscribecallbacks and orchestration recovery triggers replay on resubscribe.Introduces slow RPC acknowledgment tracking and a persistent warning toast when unary RPCs exceed a threshold, and sanitizes transport-level connection errors out of thread error surfaces (store + ChatView) while allowing toasts to suppress the error copy button and improving long-message wrapping.
Reviewed by Cursor Bugbot for commit 9782434. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add WebSocket disconnect recovery UI and slow RPC acknowledgment warning toasts
WebSocketConnectionCoordinatorto manage automatic reconnection on browser online/focus events, with exponential backoff capped atWS_RECONNECT_MAX_RETRIES, and lifecycle toasts for reconnecting, offline, exhausted, and recovered states.WebSocketConnectionSurfaceto gate the main layout behind server config availability, showing a blocking status screen until connected.SlowRpcAckToastCoordinatorto display a persistent warning toast when RPC requests exceedSLOW_RPC_ACK_THRESHOLD_MSwithout acknowledgment.requestLatencyState.ts; acknowledges requests on response and clears all on transport error.WsTransport.reconnect()for explicit session replacement without disposal, and wiresonResubscribecallbacks into stream subscriptions to trigger replay recovery after reconnect.transportError.tsso they no longer appear in the UI.Macroscope summarized 9782434.