Repository navigation
fix(session-tabs): a tab stream the host ends resubscribes on the retry backoff - #27098
Merged
Merged
Conversation
Contributor
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 7 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This was referenced Oct 10, 2026
Closed
7 of 9 tasks
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.
ELI5
A desktop or web client paired to an Orca server keeps two live tab streams open. If the server ended one of those streams while the connection stayed up, the client never noticed: its tab list froze until the app was restarted. Now the client notices the end and opens the stream again after a short wait, and the fresh stream brings the tab list back up to date.
What Changed
Before: the all-workspaces stream (
session.tabs.subscribeAll) and the selected-workspace stream (session.tabs.subscribe) logged an end frame or an error response and kept the dead stream registered. The host does end these streams over a healthy socket, for example when an id-lesssession.tabs.unsubscribeAllsweeps every stream on the connection, or when a census fails three times (session_tabs_inventory_unstable). Nothing re-subscribed, because the parking layer only retried a subscribe that failed to start. New terminals and new workspaces then never appeared on that client.After: an end frame, an error response, or the stream's close callback drops that stream and re-subscribes on the parking layer's existing jittered backoff (1 s, doubling to 30 s). On re-subscribe, the all-workspaces stream's census and the selected stream's initial snapshot re-apply through the normal path.
Mechanism:
WindowVisibilitySubscriptionContextgainsended(). It bumps the entry's generation (so the old stream's late frames are ignored), unsubscribes the old handle, and schedules the existing retry. Unsubscribing matters: after an error response the logical subscription stays registered for reconnect replay, and keeping it would put two streams side by side after the next reconnect.onError(a transport drop) is deliberately not an end. Reconnect replay and the host-contact path own that, and loss of contact is never treated as the stream being over.Why
Reusing the parking layer's retry keeps one backoff policy for every session-tabs stream instead of adding new timers in each subscriber. Alternatives considered: re-running the whole mirror install on an end (heavier, and it would repeat the first-load work), or ignoring ends and relying on the host-contact resubscribe (that only fires when contact is lost, which is not the case here).
Takes over the approach of #21061 (@johnmarktaylor91), with credit.
Linked Issue
Refs #21052, #19092. This removes one way the tab list freezes (a stream the host ended), which matches both reports, but neither report proves that was its cause, so they stay open until confirmed. #27094 fixes the other known cause (#21928).
Visual Proof
N/A: background subscription bookkeeping; covered by the tests below.
Testing
window-visibility-subscription-parking-stream-end.test.ts(new; fails onorigin/main): an ended stream is unsubscribed and re-subscribed after the backoff; repeated short-lived streams back off 1 s → 2 s → 4 s → 8 s; a duplicate end and an end after disposal do nothing; a stream that ends before its subscribe settles is unsubscribed and retried once.web-session-tabs-stream-end-resubscribe.test.tsx(new; fails onorigin/main): after an end frame on the all-workspaces stream, the re-subscribed stream's census mirrors a workspace the host created meanwhile; an error response on the selected stream unsubscribes it and re-subscribes once, not before the backoff; a transport error is not treated as an end.web-session-tabs*,window-visibility*,host-session-mirror*andruntime-host-contact*suites pass.pnpm tc:web,oxlint,pnpm run check:code-quality:changed.I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Review
Agent skill upstream boundary
Notes
Renderer-only, no wire change. Works the same with old and new hosts: it only reacts to frames every host already sends. SSH: an unreachable host is not an end, so the existing host-contact handling is unchanged.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)