Repository navigation
fix(session-tabs): paired devices follow every tab they open, not just the first - #38336
Conversation
A frame sent to one client (a tab it opened, picked or reopened) was already that client's projection, but delivery projected it again. That stacked the :client-navigation epoch suffix and the selection revision, so the client treated it as another publication and fenced it. A link clicked in a server browser page then only brought its new tab forward the first time.
…the caller-selection test
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Apply main's single-client frame projection fix (#38336) where this PR moved mobile session tab delivery.
Backport stablyai#38336 (902fc52) to the 1.4.248 multi-window preview. Keep targeted deliveries in the existing client publication so later terminal splits are not fenced as stale. Add caller-publication and real secondary-window menu split regressions. Move the packaging builtin regression into the normal unit runner.
ELI5
On a desktop paired with an
orca servehost, clicking a link that opens a new tab took you to that tab the first time only. After you went back and clicked another link, the new tab opened behind you. Now you're taken to every tab you open.What Changed
Before: the first
target="_blank"orwindow.openlink you clicked in a server browser page brought its new tab to the front. If you clicked the original tab and then another link, the new tab only showed up in the tab strip. The host did send the "follow" frame, but the desktop threw it away.After: you're taken to the new tab on every click.
Mechanism: when the host sends a session-tabs frame to a single client (a tab that client opened, picked or reopened), the caller has already projected that frame for the client through
clientSessionTabSelections. Since #36660,createMobileSessionTabsDeliveryprojected every frame again for each subscription. The secondproject()added a second:client-navigationto the publication epoch and counted the selection revision twice. The desktop renderer's freshness tracking then saw the frame as coming from another publication and fenced it. The first follow sometimes got through only because nothing had been recorded against that epoch yet. The delivery now skips projection when the frame is aimed at one client, which matches how these frames were sent before #36660. Broadcast frames are still projected per subscription.Why
The frame was already right when the caller built it. The only problem was that the delivery projected it a second time. I ruled out two other approaches:
activate()andreopen()return the projected frame because their callers need it (the RPC reply, the reopen visibility check). So the work would still happen twice, and there'd be a second path whose result could disagree with the first.project()idempotent by checking the epoch suffix. That guesses from a string, and it would also hide accidental double projection on every read path.Linked Issue
None. I found this while checking a serve-mode browser report on main. That report was already fixed by #37102, and the follow-up issue for this bug is being filed separately.
Visual Proof
The repro: a headless
orca servehost and a paired Electron client (hidden, CDP screenshots), with a page oftarget="_blank"/window.openlinks. Click link D (you follow it), click the original tab in the strip, then click link C.Before: the C tab opens (the third tab, still untitled), but you stay on the source page.

After: you're taken to the C tab.

Testing
Real run: headless serve host plus a paired desktop client on a dev build, with the links clicked in the order D, C, B, A. Before the fix, only D followed. With the fix, D, C and B all follow, and A navigates in the same tab. Traces taken during the investigation showed the host emitting
navigationIntent: 'follow'for every open. The renderer dropped the second and later ones inshouldApplyRecoveredWebSessionTabsSnapshot, because their epoch was…:client-navigation:client-navigation.created-mobile-session-tab-caller-selection.test.tsnow asserts that the caller's selection frame has the same publication epoch as that client's earlier frames, and that its version is one higher. It fails without the fix (…:client-navigation:client-navigation).Focused suites pass:
orca-runtime.test.ts(1351),multi-client-navigation-isolation.integration, the agent-launch caller-selection, instant-tab, restart-replay, at-rest and folder-create suites,structured-chat-tab-table,session-tabs-inventory-census-race,session-tabs-sender-pass,browser-tab-create-caller-navigation, the renderer-browser ownership suite,workspace-layout-paired-desktopandsession-tab-browser-placement-mutations. Tested on macOS.I manually tested these changes locally
Automated tests added/updated, or explained why not below
Every added test fails without this change and avoids the test anti-patterns
Risk
This affects every frame the host sends to one client: a tab a paired desktop or phone opens or picks, follow-host frames, and chats reopened on the phone. Those frames now go out exactly as the caller built them, as they did before #36660. Mobile frames still drop agent sender data, and desktop frames still carry it. The riskiest part is if some per-client caller relied on the delivery to add holds. I checked all three callers: each applies
withSessionTabsHoldsbefore projecting. If something were wrong, a paired client would see a stale hold flag on its own selection frame until the next broadcast frame. The wire shape is unchanged, so older phones and desktops are unaffected. Back it out with a plain revert.Level: Low
AI Disclosure
Review
Two Claude review rounds, both with no findings. Codex was at its usage limit, so it didn't review. A cleanup pass (reuse, simplification, efficiency, altitude) also found nothing.
Agent skill upstream boundary
Notes
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
Platform-independent main-process code; works the same for SSH and serve hosts. On phones it also fixes a side effect: a doubled
none:client-navigation:client-navigationepoch got past the draft-pruning check inuse-mobile-session-tab-application.ts.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)