Skip to content

fix(browser): import cookies on This-device pages, into the page's own login store - #47142

Merged
AmoabaKelvin merged 1 commit into
mainfrom
fix/dev-page-cookie-import
Nov 22, 2026
Merged

AmoabaKelvin merged 1 commit into
mainfrom
fix/dev-page-cookie-import

Conversation

@AmoabaKelvin

@AmoabaKelvin AmoabaKelvin commented Nov 22, 2026 •

Copy link
Copy Markdown
Collaborator

ELI5

When a paired server's browser tab runs on this computer ("This device", the default), its ⋯ menu had no Import Cookies and its new tab page had no import button, so you couldn't sign it in. Now it has both, and the cookies go into that tab's own login store. Separately, a normal local tab's import no longer goes to a server just because Settings › Browser was showing that server.

Files Added Deleted Net
Test 0 0 0 0
Prod 44 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​581 $\color{#cf222e}{\Huge{\mathbf{−}}}$​206 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​375

What Changed

  • This-device pages get Import Cookies and the new tab "Import browser data" hint. Before: showProfiles={false} hid both, so the only way in was Settings › Browser with the server as host. After: the same local submenu and hint, reading this desktop's browsers. Main finds the page's live jar (its partition and server profile) through the client-page executor that created it, so a page whose network runs on an SSH host or WSL distro behind the server fills its own jar, not the server-native one that Settings imports fill.
  • A page's import and profile list follow the page, not the Settings host. Before: BrowserToolbarMenu and the hint called the store actions with no target, so they routed by getBrowserSettingsHostId. Once a paired server was the Settings host (the active-server setting is enough), a local page's import wrote this desktop's cookies into that server's This-device store while the toast said it worked. Its Profile submenu also listed the server's profiles, and New Profile… created one there. After: the page passes a route (local, ssh or client-host), and its profile list and profile creation use that host.
  • Settings imports into a server's non-default profile work. Before: the desktop-side client-route import looked the server's profile id up in this desktop's registry and failed with "Session profile not found." After: the renderer sends the server profile's metadata (id, label, scope), and main checks it the way route page creation does. That check now lives in one place, validateBrowserRouteProfile, which both paths use.
  • If a page closes or switches profile while the picker or keychain prompt is open, the import fails with a new pageChanged message, in every locale, rather than filling a different jar.

Why

These are parity fixes. Local pages already import into their own jar from the ⋯ menu and the new tab page, and SSH pages were already made page-relative (#45913). Resolving the target from the page, at the layer that owns it (the executor that holds each client page's partition), covers nested execution hosts too. A Settings-level fix can't, because the server's own jar identity is the wrong store for those pages. Passing the server's profile metadata reuses the rule page creation already trusts, rather than adding a second profile registry.

Linked Issue

No issue. These are gaps M28, NEW-1, NEW-3 and NEW-11 from the remote browser parity audit. The profile switcher for these pages (#31039) follows in a separate PR.

Visual Proof

The captures come from a hidden dev build paired to a worktree-built orca serve, on a This-device page of the server's workspace.

Before, the ⋯ menu on a This-device page has no Import Cookies row:
before-dev-menu.png

After, Import Cookies › From Firefox / From File… on the same page:
after-dev-import-menu-full.png

After, the new tab page's "Import browser data" hint on a This-device page:
after-dev-newtab-hint.png

Testing

Real remote runtime, macOS: a worktree-built orca serve paired to a hidden dev build, both with scratch HOMEs and the mock keychain. The scratch HOME has a fake Firefox profile, so "From Firefox" ran with no keychain prompt. I read each guest's cookies through its own CDP target (Network.getCookies).

  • This-device page, switched to a fresh non-default server profile: the guest had no cookies, then ⋯ › Import Cookies › From Firefox, then the guest had both cookies. The new tab hint path did the same on another fresh profile. The local page's guest was untouched.

  • Settings host set to the server, Settings import into its non-default profile: "Session profile not found." on main, ok on the branch.

  • Local page while the paired server is the Settings host. On main, the Profile list showed the server's profile and the import toast said "stored here for the wrbdci-server workspace". On the branch, it lists only local profiles and the import lands in the local page's jar.

  • Nested SSH/WSL execution hosts behind a server were not run live (no nested target here). The page path reads the jar from the page's own executor record, so it doesn't depend on the host kind.

  • pnpm check:changed passes. One review-loop round (Codex + Claude): one accepted finding, fixed. A profile switch while the picker was open could redirect the import, so the page jar is now pinned to the one the request saw.

  • 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. The change is routing between the renderer, IPC and main, proven by the live run above. A unit test here would only assert mock calls.

Performance

None, because the new work runs only when the ⋯ menu opens or an import starts: one in-memory map lookup, plus a profile listing fetch for the page's host the first time its list isn't loaded.

Risk

The riskiest part is that page imports no longer use the Settings host. If the page route were wrong, an import would land in the wrong jar, so each route was checked live. Settings › Browser imports keep their old routing, plus metadata for server profiles. No server RPC or wire format changes, so older servers and phones see no difference: the renderer↔main IPC args are same-build and only gained optional fields. Server (streamed) pages still hide import and profiles. A plain revert backs it out.

Level: Medium

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

SSH-routed pages keep their existing page-relative import. Folder workspaces are unaffected. 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)

… own jar

This-device pages now offer Import Cookies and the new tab import hint, filling the page's own jar (its server profile on its own network host). A page's import and profile list follow the page, not Settings › Browser's host, and Settings imports into a server's non-default profile validate it by the server's metadata.
@coderabbitai

coderabbitai Bot commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Client-hosted browser pages can now provide their own cookie jar as an import destination. Cookie-import routes and arguments carry page and host details through the renderer, preload, IPC, and main-process import logic. The renderer also scopes profile lookup and creation to the selected host and connects page imports to hosted-page controls. New error copy covers a page closing or changing profiles during an import.

Merge Risk: Minimal · up to b2174

This change lets This-device browser pages import cookies into the page's own cookie jar, including when the page's network runs on a server, SSH host or WSL distro. The page-change protection and the routing to the page's host check out in the code. The remaining risks are narrow edge cases, and I found no merge-blocking issue.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title states the primary change: cookie import is enabled on This-device pages and writes into the page's own login store. The changeset adds the ⋯ menu and new-tab import entry points, routes imp…
Description check Passed The description follows the repository template and is thorough. It has ELI5, What Changed, Why, Visual Proof with before/after captures, Testing with live macOS verification, Performance, Risk with l…
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 states the primary change: cookie import is enabled on This-device pages and writes into the page's own login store. The changeset adds the ⋯ menu and new-tab import entry points, routes imports to the page's jar, and adds a client-host cookie import target. The title is specific and matches the main objective, and it follows the conventional commit style.

Full details: Description check

Explanation

The description follows the repository template and is thorough. It has ELI5, What Changed, Why, Visual Proof with before/after captures, Testing with live macOS verification, Performance, Risk with level and revert path, and Checklist. Gaps: the Linked Issue section has no issue and says none exists, which the template asks for (the author notes this is a parity-audit item). The AI Disclosure section is empty, and the Testing and Checklist lint/typecheck/test/build item is unchecked. The Performance line is filled in. The description also has no explicit statement on test coverage beyond 'no tests were added', which is explained.

Resolution

Optional improvements: link an issue or explain the issue exemption more explicitly, complete the AI Disclosure section (or mark it N/A for internal contributors), and confirm the pnpm lint, typecheck, test, and build status once run locally.

  • 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: 08070a1c-f0c7-4c4a-86a7-1eb84818be92
Commits

Reviewing files that changed from the base of the PR and between a104c13 and b217413.

Files selected for processing: 44

  • config/focus-setting-read-baseline.txt
  • src/main/browser/client-hosts/lifecycle/browser-client-host-environment-routes.ts
  • src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-runtime.ts
  • src/main/browser/client-pages/execution/browser-client-page-command-executor.ts
  • src/main/browser/client-pages/lifecycle/browser-client-page-cookie-jars.ts
  • src/main/browser/client-pages/lifecycle/browser-client-page-retained-state.ts
  • src/main/browser/cookies/client-route/browser-client-route-cookie-import.ts
  • src/main/browser/routing/sessions/browser-route-profile-validation.ts
  • src/main/browser/routing/sessions/browser-route-session-runtime.ts
  • src/main/ipc/browser/browser-client-host-cookie-import-ipc.ts
  • src/preload/api/browser/browser-api.ts
  • src/preload/api/browser/browser-bridge-page-interaction-and-sessions.ts
  • src/preload/api/browser/browser-session-cookie-api.ts
  • src/renderer/src/components/browser-pane/assemble-chrome/client-hosted/ClientHostedBrowserPagePane.tsx
  • src/renderer/src/components/browser-pane/assemble-chrome/client-hosted/client-hosted-browser-page-stand-in.tsx
  • src/renderer/src/components/browser-pane/assemble-chrome/client-hosted/client-hosted-browser-page-toolbar.tsx
  • src/renderer/src/components/browser-pane/assemble-chrome/client-hosted/use-client-hosted-browser-profile-id.ts
  • src/renderer/src/components/browser-pane/assemble-chrome/profile-routing/BrowserImportHintButton.tsx
  • src/renderer/src/components/browser-pane/assemble-chrome/profile-routing/browser-toolbar-import-cookies-sub.tsx
  • src/renderer/src/components/browser-pane/assemble-chrome/profile-routing/use-browser-page-cookie-import.ts
  • src/renderer/src/components/browser-pane/assemble-chrome/toolbar/BrowserToolbarMenu.tsx
  • src/renderer/src/components/browser-pane/assemble-chrome/toolbar/browser-toolbar-menu-dropdown.fixture.tsx
  • src/renderer/src/components/browser-pane/new-tab/BrowserNewTabPage.tsx
  • src/renderer/src/components/settings/browser/profiles/BrowserCookieImportMachineNotice.tsx
  • src/renderer/src/i18n/en-runtime-required.json
  • src/renderer/src/i18n/locales/de.json
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/fr.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/pt.json
  • src/renderer/src/i18n/locales/ru.json
  • src/renderer/src/i18n/locales/tr.json
  • src/renderer/src/i18n/locales/zh-Hant.json
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/lib/browser/cookies/browser-cookie-import-error-copy.ts
  • src/renderer/src/store/slices/browser/browser-slice-contract.ts
  • src/renderer/src/store/slices/browser/profiles/browser-cookie-import-actions.ts
  • src/renderer/src/store/slices/browser/profiles/browser-page-cookie-import-route.ts
  • src/renderer/src/store/slices/browser/profiles/browser-profile-import-actions.ts
  • src/renderer/src/store/slices/browser/profiles/browser-profile-list-actions.ts
  • src/shared/browser/cookies/browser-cookie-import-failure-copy.ts
  • src/shared/browser/workspaces/browser-workspace-types.ts

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

@AmoabaKelvin
AmoabaKelvin merged commit 5ffd08b into main Nov 22, 2026
34 checks passed
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