Skip to content

fix(browser): import cookie files into client-hosted sessions - #29054

Closed
oliver-mee wants to merge 9 commits into
stablyai:mainfrom
oliver-mee:fix/client-hosted-browser-profile-parity
Closed

oliver-mee wants to merge 9 commits into
stablyai:mainfrom
oliver-mee:fix/client-hosted-browser-profile-parity

Conversation

@oliver-mee

@oliver-mee oliver-mee commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

A paired desktop can host a remote session's browser locally, but importing a cookie file is still rejected just because a remote runtime is selected. This lets that import reach the browser's actual cookie jar.

What Changed

The renderer passes the selected environment to the existing desktop cookie-file picker. Main resolves the client-hosted route partition and uses the same importer as native-browser imports.

The import checks the connection and partition binding after the picker closes and after import finishes. Cancellation stays cancellation. Unsupported hosting modes fail explicitly instead of falling back to a desktop-local profile jar.

A server-owned profile missing from the desktop catalogue is accepted only when its main-derived partition already belongs to an authorised active route. Unknown profile IDs without that route are rejected before opening the picker.

Why

Matching profile names do not imply matching cookie jars. Reusing the route importer keeps authority, execution host and profile isolation intact. Existing local imports remain unchanged when no environment is supplied. Cookie filtering and Google exclusions are unchanged.

Linked Issue

Fixes #29052

Visual Proof

Automated paired Electron evidence from the combined integration checkout, not the standalone PR head or installed app. A synthetic page reports the cookie received by its HTTP server before and after import.

Before import After import
No imported cookie Imported cookie reaches paired page

The test invokes the shipping profile-store action and preload importer. Only the native file chooser is replaced with a synthetic JSON file. It also checks the desktop-local profile partition contains no imported cookie. This is not a manual Settings-button or OS file-picker acceptance test.

Testing

October 25 refresh: merged current main at 1d2b5361efa7851e95c4b24e5a9b298863f8fb7b, preserving the existing contribution history. Current head 644ebf02e5cec1c7f81212ec7ce22f76225e9649 passes 45 tests across client-route imports, partition parity, profile IPC and profile-store suites, the Node native typecheck and scoped lint/format checks. Kept upstream’s cookie-module relocation and partition-binding alias handling. Earlier paired application acceptance below belongs to its recorded earlier head and was not repeated for this refresh. Substantive upstream CI remains subject to maintainer approval.

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

On macOS, submitted head 759d8b6c1, refreshed against upstream ba6599eab:

  • 41 tests passed across the route importer, real page-partition regression, trusted IPC boundary and renderer profile-store suites.
  • Node typecheck passed using the repository's native compiler option. Renderer typecheck passed before the latest main refresh, not on this head.
  • Scoped Oxlint and git diff --check passed for the latest importer changes.
  • A fresh app and bundled CLI build completed. paired-client-hosted-cookie-file.spec.ts passed on the first attempt with retries disabled (20.3 seconds for the test). It proves guest-cookie delivery and desktop-local jar isolation on this submitted head.

Earlier combined-checkout screenshot evidence passed on retry and Playwright reported 1 flaky, because its first attempt failed during paired-tab creation before reaching import. Those screenshots remain integration evidence, not new final-head visual proof. The new first-attempt pass does not establish that the intermittent startup issue is fixed. The earlier Linux run peaked at 790 MiB with zero swap under a 1 GiB cap; that resource measurement does not describe the new macOS run. Acceptance runs use isolated homes and profiles.

The partition regression compares manual/native imports with an actual paired-server page's partition and distinguishes nested SSH/WSL ownership. It does not launch an installed application. Windows, packaged builds and full UI interaction remain unverified. Full repository lint/test/build were not run.

AI Disclosure

OpenAI GPT-6.1 Sol implemented and tested this change under human direction.

Review

Please check route ownership and connection-change guards in particular. This does not implement profile switching or duplicate #22813's annotation work.

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

Upstream validation for 759d8b6c1a is waiting for maintainer approval: PR Checks. Focused local evidence above remains unchanged; no substantive current-head CI pass is claimed.

The optional environment field preserves existing local callers. Only client-hosted environments are accepted for remote imports. No arbitrary remote path is read from the desktop.

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)
  • 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)

🤖 Generated with GPT-6.1 Sol
🧑‍💻 Ideated, directed and reviewed by a human, @oliver-mee

Route desktop file imports to the paired environment partition using the existing native-browser import safeguards. Reject non-client-hosted targets and connection changes without falling back to the local profile jar.
@oliver-mee

Copy link
Copy Markdown
Contributor Author

Updated against main 506aa03 in 06b53aa. All 38 focused tests and both Node and renderer typechecks pass again. The native partition regression checks that imports reach the client route partition without touching the local profile jar.

This stays draft pending the before/after interaction evidence. No cookie policy or Google-import exclusion was changed.

@oliver-mee
oliver-mee marked this pull request as ready for review October 18, 2026 14:14
@coderabbitai

coderabbitai Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 55e30a0d-a636-4477-ba17-0868ef5e0bb1
📥 Commits

Reviewing files that changed from the base of the PR and between 1c1ae25 and 759d8b6.

📒 Files selected for processing: 4
  • src/main/browser/browser-client-route-cookie-import-partition-parity.test.ts
  • src/main/browser/browser-client-route-cookie-import.test.ts
  • src/main/browser/browser-client-route-cookie-import.ts
  • src/preload/api/browser-api.ts

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

Walkthrough

Manual cookie-file imports can target the route partition of a browser hosted on a paired desktop. The renderer passes the runtime environment ID through the session-import API and IPC handler. Requests without an environment ID retain the existing profile-based flow. Tests cover partition selection, cancellation, authorization, and the paired-client cookie import path.

Priority: Normal

Merge Risk: Minimal · up to 759d8

No actionable merge-blocking issue remains in the reviewed change. Complete the planned interaction and platform checks before release.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 10 functions across 10 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: importing cookie files into client-hosted browser sessions.
Linked Issues check Passed Issue [#29052] requires client-hosted imports, rejection of non-client-hosted environments, no implicit local read of remote paths, and route-partition isolation. The renderer passes environmentId w…
Out of Scope Changes check Passed The preload API updates, IPC routing, client-route importer, renderer action, route guards, and focused and paired tests directly support issue [#29052]. The changes preserve local imports and add val…
Description check Passed The pull request description follows the required template and clearly explains the user impact, implementation, rationale, linked issue, visual proof, testing, AI disclosure, review focus, compatibil…
Full details: Linked Issues check

Explanation

Issue [#29052] requires client-hosted imports, rejection of non-client-hosted environments, no implicit local read of remote paths, and route-partition isolation. The renderer passes environmentId when a runtime is selected. The IPC handler calls importCookieFileIntoClientRoutePartition; that function derives and binds the paired client route partition, checks the route after file selection and import, preserves cancellation, and returns null for unsupported hosting. The no-environment path keeps the existing local import flow. Focused tests and the paired Electron test cover authorization, cancellation, connection changes, partition isolation, and cookie delivery.

Full details: Out of Scope Changes check

Explanation

The preload API updates, IPC routing, client-route importer, renderer action, route guards, and focused and paired tests directly support issue [#29052]. The changes preserve local imports and add validation needed for route ownership and file-path safety. No unrelated profile-switching or annotation-controls work is included.

Full details: Description check

Explanation

The pull request description follows the required template and clearly explains the user impact, implementation, rationale, linked issue, visual proof, testing, AI disclosure, review focus, compatibility considerations, and checklist status. It also clearly states unverified platforms and that full repository validation was not run.

  • 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

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5381051f-22f2-4653-8550-ca3115aefc6b
📥 Commits

Reviewing files that changed from the base of the PR and between 506aa03 and 1980fbb.

📒 Files selected for processing: 10
  • src/main/browser/browser-client-route-cookie-import-partition-parity.test.ts
  • src/main/browser/browser-client-route-cookie-import.test.ts
  • src/main/browser/browser-client-route-cookie-import.ts
  • src/main/ipc/browser-session-profile-ipc.test.ts
  • src/main/ipc/browser-session-profile-ipc.ts
  • src/preload/api/browser-api.ts
  • src/preload/api/browser-bridge-page-interaction-and-sessions.ts
  • src/renderer/src/store/slices/browser-session-profiles.test.ts
  • src/renderer/src/store/slices/browser/browser-profile-import-actions.ts
  • tests/e2e/paired-client-hosted-cookie-file.spec.ts

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

@nwparker

nwparker commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Closing as superseded — the linked issue (#29052) has been resolved on main by #35989 (badab9cc41). Thanks for the contribution!

@nwparker nwparker closed this Nov 5, 2026
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.

[Bug]: Cookie-file import rejects client-hosted browsers in remote sessions

2 participants