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
Cookie import adds cookies without signing you out of sites - #34113
Importing cookies can sign the built-in browser out of sites because the import removes existing cookies before it knows whether replacements can be written. A rejected row can also undo successful writes, and a stuck browser command can block later imports on that profile.
Cookie import now adds readable cookies to the existing jar, one coordinate at a time. It preserves source host-only/domain scope and partition keys, skips unreadable or expired rows, continues after individual rejections, and reports only successful live writes as imported. Destination cookies at other names, paths or domains survive. A confirmed non-mutating rejection leaves the previous value; a transport failure after dispatch remains an uncertain write outcome.
New imports no longer write restart stages or register replay. A completed native live-write phase still clears any older pending stage for that partition, so a previously delayed shipped record cannot overwrite the newer import at restart. Cookies rejected by the live writer, including name+value over Chromium's approximately 4 KB limit, are skipped and counted. They will not be retried at restart. Brennan approved this support boundary on October 26: the common pattern has no replay writer, and the retained fallback could erase cookies preserved by the live merge, replay an older import after a newer success, or drop valid sibling cookies during cold loading. Previously, cookies merely staged for restart were counted as imported; they now count as skipped unless their live write succeeds.
The change removes pre-clear, destination snapshots from import, rollback, family-wide withholding, unnamed-family refusal, target-database initialization probes, new-stage construction and its obsolete warning. Expired rows are skipped before dispatch because Chromium otherwise treats their write as deletion of the destination coordinate. Attachment and commands have a ten-second deadline; the first timeout retires the dedicated hidden target before releasing the shared Session lock. Remaining rows fail immediately and a later import can proceed. Flush runs outside the lock. Pinned implementation evidence establishes that an already accepted mutation precedes later same-coordinate writes on the partition's cookie manager; retirement is not presented as cancellation.
Differences from the common pattern and compatibility boundaries:
Intended: importing a snapshot of a running source browser remains supported. Existing Google exclusion remains because those sessions are device-bound.
Intended: destination names and paths not overwritten by a source cookie survive. JSON, Firefox and Safari imports can partially succeed rather than roll back all writes. Whether a non-Google site rejects a mix of old and imported cookies is unmeasured.
Intended: the startup compatibility reader and its scope helpers remain for pending records saved by shipped builds, including direct upgrades and inactive profiles. Unsuperseded valid scoped records keep their existing replay contract and are consumed once; completed native live-write imports supersede older records under the shared Session lock, while source refusals and zero-decrypted imports retain them. Known permanent failures remove the record and stage. Transient SQLite locking/I/O failures retry until the stage file is fourteen days old, derived from mtime. Unknown outer formats remain pending; unmarked legacy images are never applied and expire unapplied. This can discard a requested imported value; the source can be imported again. The reader has no release-count removal deadline.
Intended: destination-removal, identity snapshot/restore and grouping helpers remain available even though imports no longer call them. The partition-copy work depends on their APIs, and the separate repeatable Google-only clear work tracked in STA-4398 will reuse snapshot, per-coordinate removal and restoration.
Accepted P2 limitation: paired clients running an older shipped renderer retain its inaccurate partition-warning wording until that renderer updates. The current renderer's warning is corrected; the wire format remains compatible.
Deferred P3 copy nits: partition warnings can show a truthful zero related-skip count, and a single ordinary skip reads “1 cookies skipped.” The current renderer safely uses its generic warning for an old host's removed fallback-warning code.
The import toast includes the skipped count when ordinary rejected rows accompany successful writes. The existing page banner names only domains from confirmed successful live writes; rejected-only sites are excluded. Existing warning paths keep their own explanations without repeating that count. The partition-skip warning describes skipped cookies without claiming that successfully imported readable siblings were left unchanged. The restart-fallback warning and its catalog strings are removed with the writer.
Tracked in STA-3654, STA-4240, STA-4183, STA-4969, STA-4986.
Review path: full; this changes saved-data recovery and ordering and has an approved private plan. QA type: targeted real native Chromium import from a synthetic source profile, host-only re-import, preservation across restart without a new stage, shipped-format pending-record compatibility, and the extended real-Electron partition fixture. No agent code changes.
Validation: CI run 40453551528 passed on 15bfa3a (static analysis/types, Linux and Windows packages, all five node24 shards, relay and aggregate checks). The final successful-domain correction passed 49 targeted native/store/banner-hook tests. Targeted tests cover source/writer consumers, deadline operations at 200 / 2,000 rows, queued preparation at 2 / 20 imports, and real SQLite shipped-stage terminal/supersession contracts.
Targeted M4Air QA passed using only synthetic profiles and isolated background copies: native Settings import accepted 2 / skipped 2 while preserving a working session and unrelated path; reimport updated one loopback identity without a twin; graceful restart kept site-updated values and created no new stage. A shipped scoped-v1 record applied once; a real SQLITE_BUSY-retained record was superseded by a newer native import and did not replay after another process restart. Main with the same input reported 4 imported while only 2 live writes remained and working/path cookies were removed. The current toast screenshot shows both 2 imported and 2 skipped using the actual shipped emitter with that recorded native summary.
The explicit extended real-Electron partition fixture passed in the admitted slot on dea8cc8: 1 test passed, 0 failed / 0 skipped, asserting exact DNS host/domain identity, working session under rejection, unrelated path, CHIPS and 5 imported/2 skipped. Loopback CDP has no explicit hostOnly flag; the real-Electron fixture supplies the DNS scope assertion. Native/recovery evidence is on d8caeae, toast screenshot on 4abc1f, and subsequent changes are reviewed test-only deltas, the authorized main merge, the successful-domain feedback correction at bc65521, and final main-repair merge 15bfa3a (independently reviewed). Cookie delivery and recovery are unchanged by the feedback correction. No agent code changed or agent QA was required. The full loop status comment contains the visual proof and final evidence marker.
It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.
Cookie imports now merge eligible cookies into the destination store without deleting existing cookies. Import flows count rejected and expired rows as skipped and can flush the store after successful writes. Chromium imports no longer create replay stages. Persisted staged imports expire after 14 days and distinguish retryable from permanent failures. The session registry’s pending-import controls were removed. Cookie debugger attachment and disposal now use a dedicated helper with bounded operations.
Priority: Normal
Merge Risk: Moderate · up to 4abc1
A completed cookie import can be replaced by an older pending stage after a transient metadata failure. Resolve that risk before merging; the remaining findings affect import reporting, mixed-version warnings, and test coverage.
Pre-merge checks: 3 · 1
Failed checks: 1 warning
Check name
Status
Explanation
Resolution
Description check
The description gives detailed information about the change, rationale, testing, QA, compatibility boundaries, and review scope. However, it does not follow the required template structure and does no…
Reorganize the content under the required headings: ELI5, What Changed, Why, Linked Issue, Visual Proof, Testing, AI Disclosure, Review, Agent skill upstream boundary, Notes, and Checklist. Add an actual issue link using the required “Fixes…
Passed checks: 3 passed
Check name
Status
Explanation
Title check
The title clearly and concisely describes the main behavior change: cookie imports add cookies without signing users out of existing sites.
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: Description check
Explanation
The description gives detailed information about the change, rationale, testing, QA, compatibility boundaries, and review scope. However, it does not follow the required template structure and does not provide the required actual linked issue in a “Fixes #…” entry. It also omits explicit template sections and checklist confirmations.
Resolution
Reorganize the content under the required headings: ELI5, What Changed, Why, Linked Issue, Visual Proof, Testing, AI Disclosure, Review, Agent skill upstream boundary, Notes, and Checklist. Add an actual issue link using the required “Fixes #…” format, or document the maintainer exception. Add visual proof or state “N/A” with a reason, identify tested platforms, complete the testing and checklist items, and provide the required AI disclosure if applicable.
Finishing Touches: 💡 1
🛠️ Fix failing CI checks: 💡
Commit to this branch
Create a new PR
📝 Generate docstrings
Commit to this branch
Create a new PR
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.
Strengthen the late-attach assertions. They pass even if the late load attaches.
The test name says a late load is disposed "without attaching". Neither assertion checks that.
lease.release is called only from dispose. A wrongly acquired lease would also leave it uncalled.
attach never sends a command, so sendCommand stays uncalled in either case.
If the signal.throwIfAborted() guard in attachCookieClearSession is removed, this test still passes. Assert directly that the lease was not acquired. Use the existing mock for acquireElectronDebugger from ../electron-debugger-lease. Add await vi.advanceTimersByTimeAsync(0) instead of the single await Promise.resolve() so the continuation has run.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 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 (1)
Major · Do not complete degraded-import cleanup when… · browser-session-cookie-staging.ts:178-180
src/main/browser/browser-session-cookie-staging.ts:178-180 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift
Do not complete degraded-import cleanup when metadata loading fails.
When a live write is rejected, finalizeChromiumCookieImport still calls clearPendingBrowserCookieImport and returns ok: true. A transient metadata read failure makes that function see an empty map, so it leaves the shipped stage and its metadata entry untouched. If metadata is readable at the next startup, replay can delete in-scope live rows and replace them with the older staged rows.
The loader and early return existed in the base. The PR-specific degraded-import path changed from replacing the pending entry with setPendingCookieImport to unconditionally clearing it. Make metadata-read failure distinct from an empty pending-import map, and do not report supersession as complete until the staged file and metadata entry are retired.
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: 168edf05-2f88-49a9-bb13-37eacab6f6a0
Commits
Reviewing files that changed from the base of the PR and between f932ae6 and 5c734ad.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
⚠️ Outside diff range comments (1)
Major · Clear the shipped pending stage after direct imports. · browser-cookie-import-pipeline.ts:102-144
src/main/browser/cookies/browser-cookie-import-pipeline.ts:102-144 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Clear the shipped pending stage after direct imports.
A validated JSON, Firefox, or Safari import writes cookies through importValidatedCookies, but this path does not clear pendingCookieImports. Startup replay can then apply overlapping staged cookies with INSERT OR REPLACE and replace the newly imported cookies.
This requires a correction in the direct-import path. It is independent of Chromium's finalize cleanup and its metadata-read-failure handling.
Suggested fix
import {
emptyImportWritePhase,
planImportWrites,
writeImportedCookies,
type ImportWritePhase
} from './browser-cookie-import-write'
+import { browserSessionRegistry } from '../browser-session-registry'
@@
if (cookieClearStore) {
const releaseMutationLock = await acquireCookieMutationLock(target.mutationLockOwner)
try {
@@
}
}
}
+ if (phase.importedCount > 0) {+ browserSessionRegistry.clearPendingCookieImport(targetPartition)+ }+
if (phase.importedCount > 0) {
try {
await target.flushStore?.()
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: 76ae074a-e733-49ec-9e27-51e37252dc5d
Commits
Reviewing files that changed from the base of the PR and between 5c734ad and d8caeae.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
⚠️ Outside diff range comments (1)
Minor · Restore the legacy warning to the shared type and renderer. · browser-cookie-import-toast.ts:30
src/renderer/src/lib/browser-cookie-import-toast.ts:30 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win
Restore the legacy warning to the shared type and renderer.
An older host can return restart-fallback-unavailable when live writes fail and restart staging is unavailable. The current renderer routes this code to the generic unrecognized-warning message. Restore the warning union member, formatter branch, and the existing restartFallbackUnavailableNone and restartFallbackUnavailablePartial localization keys.
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: 1aa7542e-2c48-4ab1-a5d2-485e853c5f42
Commits
Reviewing files that changed from the base of the PR and between d8caeae and 4abc1f5.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.
Cookie import could sign the built-in browser out because it deleted existing cookies before knowing whether replacements would work. Import now merges successful writes, preserves unrelated cookies, and counts rejected rows as skipped. The existing toast now reports ordinary skipped rows too, and the page banner names only sites with a successful live write.
The full review closed three restart/data-loss findings by removing the new restart writer, corrected both misleading warning paths, and bounded queued source preparation with the existing Session lock. The shipped-record startup reader and terminal policy remain. Completed native imports retire older pending records before flush, preventing a delayed shipped stage from overwriting the newer import. Clear/snapshot APIs remain intentionally available for the partition-copy and Google-only-clear work.
Brennan approved skipping live-rejected cookies without restart retry on October 26, including oversized name+value rows. An older paired renderer's shipped partition-warning copy remains an accepted P2 deferral. Two P3 copy nits are deferred: a zero related-skip count and singular grammar in “1 cookies skipped.” The removed old-host warning uses the previously verified generic warning fallback. A transport failure after dispatch remains an uncertain write outcome; per-site reactions to a mixture of accepted and preexisting cookies are unmeasured.
Verification: four correctness rounds, architecture challenge/panel, independent performance and readiness checks, and continued merge/test/copy reviews. CI run 40453551528 passed on 15bfa3a, including static/types, both desktop packages and all test shards. N / 10N deadline and source-preparation operation contracts passed. Targeted M4Air QA passed through the actual native Settings import, host-only reimport, graceful restart, shipped scoped-v1 apply-once, and a real SQLite BUSY→new native import→cold-start supersession. The explicit real-Electron partition fixture passed on dea8cc8 (1 test, 0 failures / 0 skips), covering DNS host/domain identity, unrelated path, SameSite rejection, CHIPS and 5 imported/2 skipped. No agent code changed.
Main's same four-row native input reported 4 imported while only 2 valid cookies remained live and working/path cookies were gone. Branch reports 2 imported/2 skipped and preserves both. Both loopback reimports produced one updated identity; CDP exposes no explicit hostOnly boolean there, so the real-Electron fixture supplies the exact DNS scope assertion.
For Brennan's review:
Native result
Main
Branch
Counts
Session
Reimport
The corrected-toast screenshot invokes the actual shipped emitter with the recorded native 2 imported / 2 skipped summary; it is rendering evidence, not a repeated native/recovery run.
Restart/recovery flow
Full-window proof
Post-import restart: working/session-current/path values survive; no new stage
Shipped scoped-v1 stage applies once
Second process keeps site-rotated value
New native import supersedes BUSY-retained shipped stage
Cold restart keeps new-import, with old stage/pending absent
Native/recovery QA head d8caeae. Later 59e5389/feb4935f/dea8cc8 are test-only; 4abc1f changes the toast tests-row flow (37 targeted tests, continued reviewer AGREE, screenshot above); 489236f is the authorized main merge, independently checked. Commit bc65521 corrects only native summary domains, with 49 targeted native/store/banner-hook tests; cookie delivery and recovery match the native QA head. The explicit Electron fixture passed on dea8cc8 and carries across that feedback-only correction. Final main-repair merge 15bfa3a includes #34256; an independent narrow review confirmed all PR code and QA carry are preserved.
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.
Importing cookies can sign the built-in browser out of sites because the import removes existing cookies before it knows whether replacements can be written. A rejected row can also undo successful writes, and a stuck browser command can block later imports on that profile.
Cookie import now adds readable cookies to the existing jar, one coordinate at a time. It preserves source host-only/domain scope and partition keys, skips unreadable or expired rows, continues after individual rejections, and reports only successful live writes as imported. Destination cookies at other names, paths or domains survive. A confirmed non-mutating rejection leaves the previous value; a transport failure after dispatch remains an uncertain write outcome.
New imports no longer write restart stages or register replay. A completed native live-write phase still clears any older pending stage for that partition, so a previously delayed shipped record cannot overwrite the newer import at restart. Cookies rejected by the live writer, including name+value over Chromium's approximately 4 KB limit, are skipped and counted. They will not be retried at restart. Brennan approved this support boundary on October 26: the common pattern has no replay writer, and the retained fallback could erase cookies preserved by the live merge, replay an older import after a newer success, or drop valid sibling cookies during cold loading. Previously, cookies merely staged for restart were counted as imported; they now count as skipped unless their live write succeeds.
The change removes pre-clear, destination snapshots from import, rollback, family-wide withholding, unnamed-family refusal, target-database initialization probes, new-stage construction and its obsolete warning. Expired rows are skipped before dispatch because Chromium otherwise treats their write as deletion of the destination coordinate. Attachment and commands have a ten-second deadline; the first timeout retires the dedicated hidden target before releasing the shared Session lock. Remaining rows fail immediately and a later import can proceed. Flush runs outside the lock. Pinned implementation evidence establishes that an already accepted mutation precedes later same-coordinate writes on the partition's cookie manager; retirement is not presented as cancellation.
Differences from the common pattern and compatibility boundaries:
The import toast includes the skipped count when ordinary rejected rows accompany successful writes. The existing page banner names only domains from confirmed successful live writes; rejected-only sites are excluded. Existing warning paths keep their own explanations without repeating that count. The partition-skip warning describes skipped cookies without claiming that successfully imported readable siblings were left unchanged. The restart-fallback warning and its catalog strings are removed with the writer.
Tracked in STA-3654, STA-4240, STA-4183, STA-4969, STA-4986.
Review path: full; this changes saved-data recovery and ordering and has an approved private plan. QA type: targeted real native Chromium import from a synthetic source profile, host-only re-import, preservation across restart without a new stage, shipped-format pending-record compatibility, and the extended real-Electron partition fixture. No agent code changes.
Validation: CI run 40453551528 passed on 15bfa3a (static analysis/types, Linux and Windows packages, all five node24 shards, relay and aggregate checks). The final successful-domain correction passed 49 targeted native/store/banner-hook tests. Targeted tests cover source/writer consumers, deadline operations at 200 / 2,000 rows, queued preparation at 2 / 20 imports, and real SQLite shipped-stage terminal/supersession contracts.
Targeted M4Air QA passed using only synthetic profiles and isolated background copies: native Settings import accepted 2 / skipped 2 while preserving a working session and unrelated path; reimport updated one loopback identity without a twin; graceful restart kept site-updated values and created no new stage. A shipped scoped-v1 record applied once; a real SQLITE_BUSY-retained record was superseded by a newer native import and did not replay after another process restart. Main with the same input reported 4 imported while only 2 live writes remained and working/path cookies were removed. The current toast screenshot shows both 2 imported and 2 skipped using the actual shipped emitter with that recorded native summary.
The explicit extended real-Electron partition fixture passed in the admitted slot on dea8cc8: 1 test passed, 0 failed / 0 skipped, asserting exact DNS host/domain identity, working session under rejection, unrelated path, CHIPS and 5 imported/2 skipped. Loopback CDP has no explicit hostOnly flag; the real-Electron fixture supplies the DNS scope assertion. Native/recovery evidence is on d8caeae, toast screenshot on 4abc1f, and subsequent changes are reviewed test-only deltas, the authorized main merge, the successful-domain feedback correction at bc65521, and final main-repair merge 15bfa3a (independently reviewed). Cookie delivery and recovery are unchanged by the feedback correction. No agent code changed or agent QA was required. The full loop status comment contains the visual proof and final evidence marker.