fix(tabs): preserve label across transient remote-host disconnects#95
Merged
Conversation
When a remote uplink dropped (host network blip, host process crash, relay-side prune), the relay's session listing stopped including the affected session_ids. sweepMissingSessions() then nulled each referencing pane's sessionId and the TabBar fell back to "(空)" — the user lost every tab's identity in one poll cycle. Cache the SessionInfo on the pane just before nulling it (Pane. lastSeenInfo) by snapshotting localList + remoteList right before either is replaced. tabSummaries surfaces the cached info plus a disconnected flag; TabBar uses it for the title and adds a dimmed + italic style so the disconnected state is visible at a glance. If the same session_id reappears in a later poll (transient network loss), the live entry is preferred again automatically. If the host returns with new session_ids the user can still read which tab was which and close them by hand.
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.
Repro
Open several remote-mirrored tabs from a single desktop host. Let the relay poll for a while; when that host's network/process briefly drops (or it ever does), the relay's session list stops including those IDs for one or more polls — and every tab that referenced them collapses to "(空)" / "(empty)". Even after the host comes back, the title doesn't.
Root cause
`sweepMissingSessions()` reacts to the relay's new session list by nulling `pane.sessionId` for every pane whose session isn't there anymore. After that, the TabBar's `shortTitle()` sees `activeSession === null` and renders `i18n("terminal.emptyTab")` — i.e. "(空)". The tab is now indistinguishable from any other empty pane.
Fix
If the same `session_id` reappears in a later poll (transient blip resolved), `findSessionInfo` returns the live entry and the disconnected styling is gone automatically — no manual reattach needed. If the host returns with new session ids, the cached label still tells the user which tab is which.
Test plan