Repository navigation
fix(browser): switch client-hosted profiles with staged guest replacement - #30351
oliver-mee wants to merge 6 commits into
Conversation
Negotiate profile-switch support before mutation and derive desktop route partitions from validated authority-owned metadata. Keep the old guest available until its replacement is bound, then advance placement and command generations together. Preserve rollback bindings and cached switch replies.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to
|
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
26c2047e-20f1-40b2-87a0-035e7b1f2439
📒 Files selected for processing: 40
src/main/browser/browser-client-host-command-page.tssrc/main/browser/browser-client-host-command-state.tssrc/main/browser/browser-client-page-automation-runtime.test.tssrc/main/browser/browser-client-page-automation-runtime.tssrc/main/browser/browser-client-page-availability.tssrc/main/browser/browser-client-page-command-executor-dependencies.tssrc/main/browser/browser-client-page-command-executor-test-harness.tssrc/main/browser/browser-client-page-command-executor.tssrc/main/browser/browser-client-page-creation.tssrc/main/browser/browser-client-page-executor-close.tssrc/main/browser/browser-client-page-guest-binding.tssrc/main/browser/browser-client-page-profile-binding.test.tssrc/main/browser/browser-client-page-profile-switch.test.tssrc/main/browser/browser-client-page-profile-switch.tssrc/main/browser/browser-client-page-reconciliation.tssrc/main/browser/browser-client-page-retained-state.tssrc/main/browser/browser-manager-registration.tssrc/main/browser/browser-route-session-policy.tssrc/main/browser/browser-route-session-registry-contract.tssrc/main/browser/browser-route-session-registry.test.tssrc/main/browser/browser-route-session-registry.tssrc/main/browser/browser-route-session-runtime.tssrc/main/browser/browser-route-session-state.tssrc/main/browser/paired-runtime-browser-client-host-runtime.tssrc/main/runtime/browser-host-client-page-creation.tssrc/main/runtime/browser-host-client-profile-switch.test.tssrc/main/runtime/browser-host-client-profile-switch.tssrc/main/runtime/browser-host-command-ledger.tssrc/main/runtime/browser-host-command-result-replay.tssrc/main/runtime/browser-host-command-state.tssrc/main/runtime/browser-host-lease-registry.tssrc/main/runtime/browser-host-page-command-admission.tssrc/main/runtime/browser-host-page-placement.tssrc/main/runtime/browser/browser-profiles-client-placement.test.tssrc/main/runtime/browser/browser-profiles.tssrc/main/runtime/runtime-browser-page-registry.tssrc/renderer/src/components/browser-pane/browser-client-page-profile-staging.test.tssrc/shared/browser-client-host-protocol.tssrc/shared/browser-client-profile-switch-protocol.tstests/e2e/paired-client-hosted-profile-cookies.spec.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.
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
a3e57872-7379-4a00-93a2-ecfd4aa48da9
📒 Files selected for processing: 11
src/main/runtime/browser-host/browser-host-client-page-creation.tssrc/main/runtime/browser-host/browser-host-client-profile-switch.test.tssrc/main/runtime/browser-host/browser-host-client-profile-switch.tssrc/main/runtime/browser-host/browser-host-command-ledger.tssrc/main/runtime/browser-host/browser-host-command-result-replay.tssrc/main/runtime/browser-host/browser-host-command-state.tssrc/main/runtime/browser-host/browser-host-lease-registry.tssrc/main/runtime/browser-host/browser-host-page-command-admission.tssrc/main/runtime/browser-host/browser-host-page-placement.tssrc/main/runtime/browser-host/browser-host-profile-switch-recovery.test.tssrc/main/runtime/browser/browser-profiles-client-placement.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
|
Thank you @oliver-mee. Your staged-replacement design is the basis of #30452, which carries your commit (you remain its author) rebased onto current main, plus follow-ups from review: fencing the staged guest during the switch, keeping the original placement until a timed-out switch settles, releasing the execution-host grant and only the replaced generation's download transfers, carrying host-owned profile metadata on createPage/restorePage so switched pages can be recovered, and resolving folder-workspace targets through the client-page catalog. Closing this in favour of #30452. |
…ment Squashed from #30351 by @oliver-mee onto the current main. Fixes #30350
…t guest (#30452) * fix(browser): switch client-hosted profiles with staged guest replacement Squashed from #30351 by @oliver-mee onto the current main. Fixes #30350 * fix(browser): fence staged profile guests, release switch grants, carry host profile metadata - A fence during automation retirement now revokes and stops the staged guest. - A failed or late-settling switch releases its execution-host grant so the page can be recreated. - Staging cleanup failures before handover stay visible to executor close. - createPage/restorePage carry host-owned profile metadata to profile-switch-v1 desktops, so recovery and restore can rebuild a switched page. * fix(browser): roll back a switch whose replacement died, and report a lost old guest * fix(browser): resolve client-hosted pages before the server-local target path when switching profiles * fix(browser): a staged profile-switch guest owns downloads it starts while loading * fix(browser): keep the original placement until a timed-out switch settles * fix(browser): rebind the original guest before releasing a rolled-back staged guest * test(browser): type the harness guest release mock * fix(browser): release the replaced generation's download transfers when a switch commits * fix(browser): admit file transfers from a staged profile-switch guest while its switch is pending * fix(browser): release only the replaced generation's download transfers after a switch * refactor(shared): import BrowserNetworkExecutionHost from its own module, no re-export * fix(browser): adopt a profile switch the client finished after the caller timed out --------- Co-authored-by: Oliver Mee <102673257+oliver-mee@users.noreply.github.com>
ELI5
Switch a paired browser page to another session profile without destroying the working page before its replacement is ready.
What Changed
Adds a capability-negotiated profile-switch command, validates remote profile metadata, derives the desktop route partition, and stages guest replacement with rollback. Older desktops reject before mutation. Local behavior and same-profile no-ops remain unchanged.
Why
Closing the old guest first loses the working page when replacement fails. Staging keeps its guest and cookie jar intact until the replacement has bound successfully.
Linked Issue
Fixes #30350
Visual Proof
N/A: this PR changes the runtime command and guest lifecycle, not toolbar UI. Toolbar profile selection remains separate unfinished work.
Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
macOS: 728 tests passed across 82 files using the Node runner and an isolated HOME. Node and renderer typechecks, changed-file oxlint and diff checks passed.
Linux: an actual paired Electron E2E passed against a combined integration checkout. It switches default to isolated, back to default, then isolated again, checking native cookie jars retain their own values without leakage.
Combined integration: both typechecks and 49 focused profile/import tests passed.
The Electron result is from an integration checkout containing the separate annotation and controls changes, not a standalone packaged build. No Windows or installed-app manual validation is claimed. Creation/restoration retain existing desktop-profile validation; the remote metadata extension covers switching only. Full repository suites were not run.
AI Disclosure
OpenAI GPT-6.1 Sol implemented and tested this change under human direction.
Review
Please review staged replacement, rollback, stale-generation fencing and old-peer rejection. This does not add a toolbar profile selector or change cookie-import policy.
Agent skill upstream boundary
Notes
Runtime switching is implemented and tested. Toolbar integration is explicitly outside this scoped PR; this is not a claim of complete UI parity.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)🤖 Generated with GPT-6.1 Sol
🧑💻 Ideated, directed and reviewed by a human, @oliver-mee