Skip to content

fix(session-tabs): paired devices follow every tab they open, not just the first - #38336

Merged
AmoabaKelvin merged 2 commits into
mainfrom
fix/session-tabs-follow-every-link
Nov 5, 2026
Merged

AmoabaKelvin merged 2 commits into
mainfrom
fix/session-tabs-follow-every-link

Conversation

@AmoabaKelvin

@AmoabaKelvin AmoabaKelvin commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

ELI5

On a desktop paired with an orca serve host, 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.

Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​6 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​5
Prod 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​4 $\color{#cf222e}{\Huge{\mathbf{−}}}$​4 0

What Changed

Before: the first target="_blank" or window.open link 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, createMobileSessionTabsDelivery projected every frame again for each subscription. The second project() added a second :client-navigation to 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:

  • Make the callers pass unprojected frames so the delivery is the single projector. activate() and reopen() 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.
  • Make 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 serve host and a paired Electron client (hidden, CDP screenshots), with a page of target="_blank" / window.open links. 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 in shouldApplyRecoveredWebSessionTabsSnapshot, because their epoch was …:client-navigation:client-navigation.

  • created-mobile-session-tab-caller-selection.test.ts now 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-desktop and session-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 withSessionTabsHolds before 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

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

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-navigation epoch got past the draft-pruning check in use-mobile-session-tab-application.ts.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • I stated the risk: what could break, for whom, and how to back it out
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

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.
@coderabbitai

coderabbitai Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The delivery path now passes frames with a defined client navigation ID through unchanged and projects frames without one for the client. The caller-selection test verifies that selecting the launched terminal leaves the publication epoch unchanged and increments the snapshot version by one. It also retains checks for caller-only selection and no additional PTY.

Merge Risk: Minimal · up to 68815

The targeted-delivery change is supported by the inspected producer and broadcast contracts and is ready to merge.

Pre-merge checks: Passed 5

Check name Status Explanation
Title check Passed The title names the change: paired devices now follow every tab they open, not only the first. The raw summary and objectives describe a fix that skips duplicate client projection in createMobileSessi…
Description check Passed The description follows the repository template. It includes ELI5, What Changed (before/after and mechanism), Why (alternatives considered), Visual Proof (before/after screenshots), Testing (checkboxe…
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the change: paired devices now follow every tab they open, not only the first. The raw summary and objectives describe a fix that skips duplicate client projection in createMobileSessionTabsDelivery for frames aimed at one client, which is the mechanism behind this user-visible symptom. The title is specific and matches the changeset. It is 80 characters, slightly long, but within a reasonable range for a conventional-commit style title.

Full details: Description check

Explanation

The description follows the repository template. It includes ELI5, What Changed (before/after and mechanism), Why (alternatives considered), Visual Proof (before/after screenshots), Testing (checkboxes and steps), Risk (with level and rollback), Review, Agent skill boundary, Notes, and Checklist. The Linked Issue section is marked 'None' with an explanation, but the template says an issue should always exist for outside contributors. The author says this was found by a maintainer-side investigation and that a follow-up issue is being filed separately, so the omission is explained but does not fully meet the template requirement. The AI Disclosure section is empty. The final pnpm checklist item is unchecked. These are minor gaps, and the description is mostly complete.

Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 2 files.

Finishing Touches

Generate docstrings

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e8f78c12-6b3e-4f9f-9de5-5ee63374bfbc
Commits

Reviewing files that changed from the base of the PR and between 43d7555 and 6881530.

Files selected for processing: 2

  • src/main/runtime/created-mobile-session-tab-caller-selection.test.ts
  • src/main/runtime/session-tabs/session-tabs-change-publication.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.

@AmoabaKelvin
AmoabaKelvin merged commit 902fc52 into main Nov 5, 2026
54 checks passed
brennanb2025 added a commit that referenced this pull request Nov 5, 2026
Apply main's single-client frame projection fix (#38336) where this PR moved
mobile session tab delivery.
tpmeredith added a commit to tpmeredith/orca that referenced this pull request Nov 5, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant