[Bugfix #442] Add terminal WebSocket auto-reconnect with session resumption#445
Merged
waleedkadous merged 2 commits intomainfrom Feb 19, 2026
Merged
Conversation
- Client-side: exponential backoff (1s to 30s cap), seq tracking from server control frames, ?resume=N query param on reconnect, visual reconnecting overlay, rapid failure detection for session-gone - Server-side: send seq control frame after replay and every 10s heartbeat, support resume from URL query param (browser WS limitation) - Add 'seq' control message type to ws-protocol
- Update tower-websocket tests for seq frame, heartbeat, query param resume - Add Terminal.reconnect.test.tsx: backoff, overlay, rapid failure, max attempts
This was referenced Feb 19, 2026
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 #442
Root Cause
The dashboard Terminal component had zero reconnection logic — when a WebSocket closed (common on cloud connections), it displayed
[Terminal disconnected]and stopped permanently. The only recovery was a full page reload.Fix
Client-side (
Terminal.tsx):seqcontrol frames?resume=Nquery param for session resumption from ring bufferServer-side (
tower-websocket.ts):seqcontrol frame with current ring buffer sequence after replayProtocol (
ws-protocol.ts):seqto theControlMessagetype unionTest Plan
Terminal.reconnect.test.tsx(10 tests): backoff timing, seq tracking, overlay show/hide, rapid failure detection, max attempts, unmount cleanuptower-websocket.test.ts(+4 tests): seq frame after replay, heartbeat, query param resume, interval cleanupCMAP Review
To be added after review