You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(browser): switch a This-device page between its server's profiles from the ⋯ menu - #47174
A paired server's browser tab that runs on this computer ("This device") now has the same ⋯ › Profile menu as a local tab. You can pick one of that server's profiles, or make a new one, and the tab switches to it.
Files
Added
Deleted
Net
Test
0
0
0
0
Prod
4
$\color{#1a7f37}{\Huge{\mathbf{+}}}$91
$\color{#cf222e}{\Huge{\mathbf{−}}}$22
$\color{#1a7f37}{\Huge{\mathbf{+}}}$69
What Changed
On This-device pages, ⋯ › Profile lists the owning server's profiles, with a check on the one the server's page snapshot reports. It does not list this desktop's profiles: matching ids don't mean the same owner or the same jar.
Picking a profile goes through the same confirm dialog as local, then calls the server's existing browser.tabSetProfile {page, profileId}. That runs the host-owned staged guest swap from fix(browser): switch client-hosted profiles by staging the replacement guest #30452. The server's next page snapshot moves this desktop's guest and the check mark. If the RPC fails or times out, the renderer shows the error and leaves the guest alone; a late success still lands. The submenu is disabled while a switch is in flight.
New Profile… creates the profile on that server (browser.profileCreate) and switches to it.
The server now advertises browser.clientHost.profileSwitch.v1. Desktops show the submenu on This-device pages only when the server advertises it.
The RPC is marked as a user action (suppressFeatureInteraction), so it doesn't count as agent browser use.
Why
This is the UI half of #31039. The runtime already switches client-hosted pages safely (#30452), but nothing in the This-device UI exposed it. Routing the switch to the server that owns the page reuses that transaction rather than building a desktop-side one. The capability gate keeps older servers fail-closed. Before #30452 a server's browser.tabSetProfile had no client-page branch: it would act on its own window and report success while this desktop's guest stayed put.
Before, ⋯ on a This-device page had no Profile row (see the "before" capture in #47142).
After, ⋯ › Profile on a This-device page lists the server's profiles:
Testing
On macOS, a hidden dev build was paired to a worktree-built orca serve, both with scratch HOMEs and the mock keychain.
Server built from main, without the capability: the Profile row stays hidden on This-device pages, so it fails closed.
Server built from this branch: the Profile row lists the server's profiles. Default → ServerWork showed "Switched to ServerWork profile", the page handle's browserProfileId moved to ServerWork's id and the guest got a new pageHostGeneration. New Profile… "DevMade" was created on the server (this desktop's local list stayed Default) and the page switched to it.
pnpm check:changed --base=fix/dev-page-cookie-import passes. One review-loop round (Codex + Claude). Accepted and fixed: the capability gate for older servers, refetching after a failed listing (an empty list), a renderer timeout longer than the server's 30 s swap, disabling the submenu while a switch is in flight, and suppressFeatureInteraction.
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
No tests were added. This is UI wiring onto an existing, tested server transaction, proven by the live run.
Performance
None, because it only runs when the ⋯ menu opens (one profile listing for the server, the first time) or when the user switches.
Risk
Known limit, already on main and not caused by this PR: after the desktop window reloads (or the app restarts), switching a restored This-device page fails with browser_client_page_placement_required from the server. The server's lease placement for the restored page is missing, though its page registry still has it. Agents' orca browser tab profile set hits the same error. A page opened after the reload switches fine. I'm reporting it as a separate server-side follow-up.
Older desktops ignore the new capability. Older servers don't advertise it, so the row stays hidden there. A plain revert backs it out.
Level: Low
AI Disclosure
Review
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
Server (streamed) pages keep the Profile row hidden. Mobile is not touched.
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)
Cookie imports can target a local route, an SSH route, or a client-hosted page’s cookie jar. Client-hosted imports pass page and optional profile metadata through the renderer, preload API, and IPC. The import path validates profiles and reports when a page closes or changes profile. The browser toolbar also loads profiles for a client-hosted page’s execution host and supports profile switching when the host advertises the required capability.
Severity of issue fixed: Medium
Merge Risk: Low · up to 23117
This adds a server-owned Profile submenu for This-device browser pages and routes cookie imports to the page's own jar. Normal use should work. Two narrow cases remain: cookie import on an SSH page after SSH routing is turned off, and a stale profile appearing after a server re-pair. Restored pages after a desktop reload still cannot switch profile, as the author notes. Fixing the two edge cases before merge is advisable, but neither should block normal use.
Pre-merge checks: 3 · 1
Failed checks: 1 inconclusive
Check name
Status
Explanation
Resolution
Out of Scope Changes check
The profile-switch changes map to #31039. Other changes in the whole-PR summary do not map to that issue. These include the cookie-import route work (browser-cookie-import-actions, browser-client-page…
Confirm the file list of commit 23117b6 against b217413 (for example, make the changed blobs available). Confirm that the cookie-import, pageChanged, and related i18n changes belong only to the stacked base #47142. If they belong to thi…
Passed checks: 3 passed
Check name
Status
Explanation
Title check
The title names the main change: a This-device browser page can switch between its server's profiles from the ⋯ menu. The changeset adds a Profile submenu on This-device pages that lists the owning se…
Linked Issues check
Directly linked issue #31039 has coding requirements. The change set from the whole-PR summary covers them: (1) On This-device pages, the ⋯ › Profile submenu lists the owning server's profiles, not de…
Description check
The description is largely complete and follows the template. It has a clear ELI5, a What Changed section, Why, a linked issue (Fixes #31039), Visual Proof (before/after referenced with an image), Tes…
Full details: Title check
Explanation
The title names the main change: a This-device browser page can switch between its server's profiles from the ⋯ menu. The changeset adds a Profile submenu on This-device pages that lists the owning server's profiles and calls browser.tabSetProfile. The title uses the conventional feat(browser) prefix and is specific. It omits the New Profile action, which is a minor detail.
Full details: Linked Issues check
Explanation
Directly linked issue #31039 has coding requirements. The change set from the whole-PR summary covers them: (1) On This-device pages, the ⋯ › Profile submenu lists the owning server's profiles, not desktop profiles. BrowserToolbarMenu loads profiles from the page's execution host, and the summary says the list and check mark use the host's profile list. (2) Selecting a profile uses the existing confirm dialog and calls browser.tabSetProfile through switchClientHostedBrowserPageProfile, a new client-host helper. (3) New Profile… calls createBrowserSessionProfile with the host ID, so creation runs on the server. (4) The submenu is hidden unless the host advertises browser.clientHost.profileSwitch.v1 (BROWSER_CLIENT_PROFILE_SWITCH_RUNTIME_CAPABILITY), which keeps older servers fail-closed. (5) The renderer does not change guest state on RPC failure. It shows an error toast and shows success only after a successful call. The submenu is disabled while a switch is in flight. The RPC carries suppressFeatureInteraction. The issue's requirement that a timed-out call must not destroy or roll back guests is supported by the client-side flow, which only reports errors. Disconnected-host behavior is inferred from the capability gate and empty-list handling, not from a direct test. No automated tests were added, so the evidence comes from code and the author's live run.
Full details: Description check
Explanation
The description is largely complete and follows the template. It has a clear ELI5, a What Changed section, Why, a linked issue (Fixes #31039), Visual Proof (before/after referenced with an image), Testing with manual macOS validation, a Performance line, and a Risk section with level and revert path. The AI Disclosure and Review sections are empty, and the Notes section is generic. Several checklist items are unchecked, including the lint, typecheck, test, and build item. The template's test checkbox also remains unchecked for added tests, which the author explains in prose. These gaps are non-critical, so the check passes.
Full details: Out of Scope Changes check
Explanation
The profile-switch changes map to #31039. Other changes in the whole-PR summary do not map to that issue. These include the cookie-import route work (browser-cookie-import-actions, browser-client-page-cookie-jars, browser-client-route-cookie-import, cookie-import IPC and preload types, ClientHostedBrowserPageStandIn, BrowserImportHintButton) and the new pageChanged error copy in the i18n locales. The issue says cookie import should stay separate. The PR description states that the PR is stacked on #47142 and that review covers only commits after b217413. Commit b217413 is in the whole-PR diff from merge base 096a87b. The per-commit diff for 23117b6 against b217413 was unavailable because changed blobs are missing from the checkout. So the file set of this PR's own commit cannot be confirmed. The attribution of the cookie-import changes to the stacked base therefore cannot be verified from the available evidence.
Resolution
Confirm the file list of commit 23117b6 against b217413 (for example, make the changed blobs available). Confirm that the cookie-import, pageChanged, and related i18n changes belong only to the stacked base #47142. If they belong to this PR, explain their link to #31039 or remove them.
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.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
⚠️ Outside diff range comments (2)
Minor · Keep an SSH page's import route tied to its partition… · use-browser-page-cookie-import.ts:76
src/renderer/src/components/browser-pane/assemble-chrome/profile-routing/use-browser-page-cookie-import.ts:76 Minor · Security & Privacy · Quick win
Keep an SSH page's import route tied to its partition after SSH routing is disabled.
When SSH routing is disabled for a mounted SSH page, the route state becomes unrouted. The page stays mounted, and its guest keeps the stored partition. Meanwhile pageRoute changes to local, so cookie import writes to the desktop profile. The import can therefore report success for a jar that the page is not using.
While a mounted SSH page keeps its guest, its import must either write to that page's route or stay unavailable. Either keep the SSH route until the page remounts under the new state, or disable import for that page. The import must not reach the desktop profile for a guest that does not use it.
Minor · Check the pairing revision before adding a created… · browser-profile-list-actions.ts:120-124
src/renderer/src/store/slices/browser/profiles/browser-profile-list-actions.ts:120-124 Minor · Data Integrity & Integration · Quick win
Check the pairing revision before adding a created profile to the host list.
The request already carries the pairing revision from the call start, so a request sent before a re-pair is refused. A creation that succeeds on the old pairing is still added to the list for hostId. That ID is the stable environment ID, and no retirement listener clears browser profile lists. The menu can therefore offer a profile created on the previous server under the re-paired host until the list is refreshed.
Capture the revision before the RPC starts. After the call succeeds, compare it with the current revision and skip the list write when they differ. Treat a same-machine rotation as the same pairing, using the continued revision from resolveContinuedRuntimeEnvironmentRevision. Choose how the user learns that the profile was created but not listed. Do not leave the stale profile in the list.
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: 0b640a2a-7bd6-4907-9705-318cb6ac765a
Commits
Reviewing files that changed from the base of the PR and between 9322056 and 23117b6.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.
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
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 paired server's browser tab that runs on this computer ("This device") now has the same ⋯ › Profile menu as a local tab. You can pick one of that server's profiles, or make a new one, and the tab switches to it.
What Changed
browser.tabSetProfile {page, profileId}. That runs the host-owned staged guest swap from fix(browser): switch client-hosted profiles by staging the replacement guest #30452. The server's next page snapshot moves this desktop's guest and the check mark. If the RPC fails or times out, the renderer shows the error and leaves the guest alone; a late success still lands. The submenu is disabled while a switch is in flight.browser.profileCreate) and switches to it.browser.clientHost.profileSwitch.v1. Desktops show the submenu on This-device pages only when the server advertises it.suppressFeatureInteraction), so it doesn't count as agent browser use.Why
This is the UI half of #31039. The runtime already switches client-hosted pages safely (#30452), but nothing in the This-device UI exposed it. Routing the switch to the server that owns the page reuses that transaction rather than building a desktop-side one. The capability gate keeps older servers fail-closed. Before #30452 a server's
browser.tabSetProfilehad no client-page branch: it would act on its own window and report success while this desktop's guest stayed put.Linked Issue
Fixes #31039
Visual Proof
Before, ⋯ on a This-device page had no Profile row (see the "before" capture in #47142).
After, ⋯ › Profile on a This-device page lists the server's profiles:

Testing
On macOS, a hidden dev build was paired to a worktree-built
orca serve, both with scratch HOMEs and the mock keychain.Server built from
main, without the capability: the Profile row stays hidden on This-device pages, so it fails closed.Server built from this branch: the Profile row lists the server's profiles. Default → ServerWork showed "Switched to ServerWork profile", the page handle's
browserProfileIdmoved to ServerWork's id and the guest got a newpageHostGeneration. New Profile… "DevMade" was created on the server (this desktop's local list stayedDefault) and the page switched to it.Local pages still switch and create locally, as in fix(browser): import cookies on This-device pages, into the page's own login store #47142.
pnpm check:changed --base=fix/dev-page-cookie-importpasses. One review-loop round (Codex + Claude). Accepted and fixed: the capability gate for older servers, refetching after a failed listing (an empty list), a renderer timeout longer than the server's 30 s swap, disabling the submenu while a switch is in flight, andsuppressFeatureInteraction.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
No tests were added. This is UI wiring onto an existing, tested server transaction, proven by the live run.
Performance
None, because it only runs when the ⋯ menu opens (one profile listing for the server, the first time) or when the user switches.
Risk
Known limit, already on
mainand not caused by this PR: after the desktop window reloads (or the app restarts), switching a restored This-device page fails withbrowser_client_page_placement_requiredfrom the server. The server's lease placement for the restored page is missing, though its page registry still has it. Agents'orca browser tab profile sethits the same error. A page opened after the reload switches fine. I'm reporting it as a separate server-side follow-up.Older desktops ignore the new capability. Older servers don't advertise it, so the row stays hidden there. A plain revert backs it out.
Level: Low
AI Disclosure
Review
Agent skill upstream boundary
Notes
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
Server (streamed) pages keep the Profile row hidden. Mobile is not touched.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)