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
fix(browser): clear default cookies signs out This-device pages of a paired server - #47105
When Settings › Browser is set to a paired Orca server, "Import cookies" signs in the pages this desktop shows for that server. "Clear default cookies" said it worked but cleared a different store, so those pages stayed signed in and the "Imported from …" label stayed. Clear now empties the store that import filled.
Files
Added
Deleted
Net
Test
0
0
0
0
Prod
11
$\color{#1a7f37}{\Huge{\mathbf{+}}}$141
$\color{#cf222e}{\Huge{\mathbf{−}}}$60
$\color{#1a7f37}{\Huge{\mathbf{+}}}$81
What Changed
Before: with a paired server as the Settings browser host, import goes to this desktop's cookie store for the server's This-device pages and records an "Imported from …" label on this desktop. Clear only called the server's browser.profileClearDefaultCookies, which empties the server's own store. The toast said "Default cookies cleared.", but This-device pages stayed signed in and the label stayed.
After: Clear empties both stores of the Default profile: this desktop's store for the server's This-device pages, and the server's own store as before. The desktop-side label is removed with it.
Mechanism:
New clearClientRouteDefaultCookies in main finds the jar the same way import does (bindRoutePartition(routeIdentity, 'default')).
It removes the label first, like the local clear, then restores the jar's saved session cookies, like the Google cookie clear does. Without that restore, the lazy restore on the next page would undo the clear.
It then clears the cookies while holding the cookie mutation lock, so it can't run in the middle of an import.
It is exposed as IPC browser:session:clearDefaultCookiesForClientHost. That returns null when this desktop doesn't host the server's pages, in which case only the server store is cleared, as before.
The label store (client-route-cookie-import-source-store.ts) now reads and writes its file asynchronously, with changes queued. The clear path added a second caller, and it should not block the main thread; the ratchet baselines shrink to match.
Why
The Default row in Settings is the server's Default profile. Its logins live in two jars: this desktop's jar for This-device pages, which is where import puts them, and the server's jar for Server (streamed) pages, phones and server agents. The confirm dialog says "This may sign you out of sites in this profile."
Clearing only the desktop jar would stop clearing the server jar, which Clear does today. Clearing only the server jar is the bug. So Clear now clears both. This holds whether we later keep two stores per server or merge them into one, which is still an open question.
This reuses the existing route-jar pieces: the import's bindRoutePartition, the Google clear's restore-then-clear order, and the shared mutation lock. It does not add a second remote-only clear.
Linked Issue
No GitHub issue. This is gap NEW-2 from the remote browser parity audit (2026-11-22).
Visual Proof
Settings › Browser, host = paired server, with a This-device page of that server open.
Before (main): after Import, then Clear, the row still read "Firefox (default-release)" and the This-device page's jar still held the imported cookie (.example.com:wrbcc_site=yes). It looked like this:
After (this branch): Clear → "No cookies imported", and the This-device jar is empty ([]), also after an app restart.
Testing
Real remote runtime on macOS:
Setup:
A headless orca serve built from this worktree, paired to a hidden dev build (ORCA_BACKGROUND_LAUNCH=1, mock keychain, scratch HOME). The import source is a Firefox profile in the scratch HOME, so no real browser data or keychain is touched.
On the paired server, a folder workspace with a This-device page open, which starts the client host.
Jar contents were read over CDP Network.getAllCookies on that page's webview.
main: Import put .example.com:wrbcc_site=yes into the This-device jar. Clear returned true and toasted, but the jar still held the cookie, and both the desktop label and the Settings row still showed Firefox.
This branch:
Import, then Clear. The This-device jar is [], the label file is {}, and the row reads "No cookies imported".
The server's own Default profile was also imported first, through browser.profileImportFromBrowser. After Clear its source is null, so the server jar was cleared too.
The jar was still empty after restarting the desktop.
Local host: import then Clear still clears the label, through the unchanged local path.
pnpm check:changed passes.
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 unit test was added. The renderer side is IPC wiring, and the main side is Electron session calls that a test could only reach through mocks. The real paired run above is the proof.
Performance
None, because this only runs when the user confirms "Clear default cookies". The label store's file reads and writes moved off the main thread.
Risk
The riskiest part is moving the label store to async file reads and writes. If it went wrong, an "Imported from …" label could be missing or stale. Cookies themselves are not affected. Writes are queued, so an overlapping import and clear can't drop each other's write.
Older peers: no wire change. The server RPC is unchanged, and the new IPC is between this desktop's own main process and renderer. Older servers work as before, phones are untouched, and the web client's stub returns null, which means only the server store is cleared. SSH hosts can't be chosen as the Settings browser host, so SSH is unchanged.
Back out with a plain revert.
Level: Low
AI Disclosure
Review
One review-loop round, with Codex and a Claude subagent. No P0 or P1 findings. Two P2s were left out of this PR:
Clear during a running import. Clear confirmed while an import into the same jar is still running can leave the label on an emptied jar, because the import writes its label after it releases the lock. The local clear has the same race. A real fix would disable Clear while an import runs, which is a UI change, so it's left as a follow-up.
Label when this desktop no longer hosts the server's pages. In that case Clear can't find the jar, so it keeps the label. That jar still holds the cookies and is used again when This-device hosting resumes, so removing the label would hide cookies that are really still there.
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
Security: the IPC checks isTrustedBrowserRenderer and the argument type. Main derives the jar from the live route identity, never from a renderer-supplied partition.
Cross-platform: Electron session APIs and fs/promises only.
Mobile and SSH: unchanged.
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)
The change adds an IPC and preload API for clearing default cookies in a client-hosted route. The clear operation removes the default-profile import source and clears cookies in the route partition. Import-source storage now uses asynchronous filesystem operations and serialized updates. The renderer attempts client and server cookie clearing concurrently and refreshes profiles if either succeeds and the selected host is unchanged.
Merge Risk: Low · up to ab7dc
Clearing default cookies for a paired server now also clears this desktop's jar and its label. In the rare case where the label file cannot be written, the "Imported from …" label may reappear after a restart. This is low risk and mergeable, with an optional follow-up.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the main change: Clear default cookies now clears the This-device pages of a paired server, which the changeset implements. It uses the conventional fix(browser) prefix and is specific…
Description check
The description follows the repository template. It has ELI5, What Changed, Why, Linked Issue (explains no GitHub issue exists, which the template requires for outside contributors, but the author is …
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the main change: Clear default cookies now clears the This-device pages of a paired server, which the changeset implements. It uses the conventional fix(browser) prefix and is specific. The title is 82 characters, slightly longer than ideal, but it is clear.
Full details: Description check
Explanation
The description follows the repository template. It has ELI5, What Changed, Why, Linked Issue (explains no GitHub issue exists, which the template requires for outside contributors, but the author is a maintainer-style contributor and the audit reference is given), Visual Proof with before/after images, Testing with a detailed real paired-runtime run, Performance, Risk with level and revert method, AI Disclosure left empty, Review, Agent skill boundary, Notes, and Checklist. Gaps: the Linked Issue section has no 'Fixes #' issue reference, the AI Disclosure section is empty, and the Performance line is completed. The Risk section names the riskiest change and the back-out method. The Testing checkbox for automated tests is unchecked with a reason given.
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; 5 remain after this review.
…red server
Settings import for a paired server fills this desktop's route jar for its
This-device pages, but Clear only called the server's RPC, so those pages
stayed signed in and the Imported badge stayed. Clear now empties that jar
and its badge too, alongside the server's own jar.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 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
When Settings › Browser is set to a paired Orca server, "Import cookies" signs in the pages this desktop shows for that server. "Clear default cookies" said it worked but cleared a different store, so those pages stayed signed in and the "Imported from …" label stayed. Clear now empties the store that import filled.
What Changed
browser.profileClearDefaultCookies, which empties the server's own store. The toast said "Default cookies cleared.", but This-device pages stayed signed in and the label stayed.clearClientRouteDefaultCookiesin main finds the jar the same way import does (bindRoutePartition(routeIdentity, 'default')).browser:session:clearDefaultCookiesForClientHost. That returnsnullwhen this desktop doesn't host the server's pages, in which case only the server store is cleared, as before.client-route-cookie-import-source-store.ts) now reads and writes its file asynchronously, with changes queued. The clear path added a second caller, and it should not block the main thread; the ratchet baselines shrink to match.Why
The Default row in Settings is the server's Default profile. Its logins live in two jars: this desktop's jar for This-device pages, which is where import puts them, and the server's jar for Server (streamed) pages, phones and server agents. The confirm dialog says "This may sign you out of sites in this profile."
Clearing only the desktop jar would stop clearing the server jar, which Clear does today. Clearing only the server jar is the bug. So Clear now clears both. This holds whether we later keep two stores per server or merge them into one, which is still an open question.
This reuses the existing route-jar pieces: the import's
bindRoutePartition, the Google clear's restore-then-clear order, and the shared mutation lock. It does not add a second remote-only clear.Linked Issue
No GitHub issue. This is gap NEW-2 from the remote browser parity audit (2026-11-22).
Visual Proof
Settings › Browser, host = paired server, with a This-device page of that server open.
Before (main): after Import, then Clear, the row still read "Firefox (default-release)" and the This-device page's jar still held the imported cookie (
.example.com:wrbcc_site=yes). It looked like this:After (this branch): Clear → "No cookies imported", and the This-device jar is empty (
[]), also after an app restart.Testing
Real remote runtime on macOS:
Setup:
orca servebuilt from this worktree, paired to a hidden dev build (ORCA_BACKGROUND_LAUNCH=1, mock keychain, scratch HOME). The import source is a Firefox profile in the scratch HOME, so no real browser data or keychain is touched.Network.getAllCookieson that page's webview.main: Import put
.example.com:wrbcc_site=yesinto the This-device jar. Clear returnedtrueand toasted, but the jar still held the cookie, and both the desktop label and the Settings row still showed Firefox.This branch:
[], the label file is{}, and the row reads "No cookies imported".browser.profileImportFromBrowser. After Clear itssourceisnull, so the server jar was cleared too.Local host: import then Clear still clears the label, through the unchanged local path.
pnpm check:changedpasses.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 unit test was added. The renderer side is IPC wiring, and the main side is Electron session calls that a test could only reach through mocks. The real paired run above is the proof.
Performance
None, because this only runs when the user confirms "Clear default cookies". The label store's file reads and writes moved off the main thread.
Risk
The riskiest part is moving the label store to async file reads and writes. If it went wrong, an "Imported from …" label could be missing or stale. Cookies themselves are not affected. Writes are queued, so an overlapping import and clear can't drop each other's write.
Older peers: no wire change. The server RPC is unchanged, and the new IPC is between this desktop's own main process and renderer. Older servers work as before, phones are untouched, and the web client's stub returns
null, which means only the server store is cleared. SSH hosts can't be chosen as the Settings browser host, so SSH is unchanged.Back out with a plain revert.
Level: Low
AI Disclosure
Review
One review-loop round, with Codex and a Claude subagent. No P0 or P1 findings. Two P2s were left out of this PR:
Agent skill upstream boundary
Notes
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
isTrustedBrowserRendererand the argument type. Main derives the jar from the live route identity, never from a renderer-supplied partition.fs/promisesonly.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)