Repository navigation
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 4 minutes. View limit details
📝 Walkthrough
Priority: ➖ Normal Merge Risk: 🔵 Low · up to
|
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
e9c8f390-d8f2-4232-90ff-c11008c937ce
📥 Commits
Reviewing files that changed from the base of the PR and between fa35698 and 6e81d2ed973af661a5bb258acb7aceea74c76f41.
📒 Files selected for processing: 16
src/main/browser/browser-cdp-cookie.tssrc/main/browser/browser-cookie-clear-store.tssrc/main/browser/browser-cookie-import-clear.tssrc/main/browser/browser-partition-cookie-copy.test.tssrc/main/browser/browser-partition-cookie-copy.tssrc/main/browser/browser-session-startup.tssrc/main/browser/wsl-host-browser-route-partition.test.tssrc/main/browser/wsl-host-browser-route-partition.tssrc/main/persistence/moving-wsl-projects/wsl-move-browser-cookie-copy.test.tssrc/main/persistence/moving-wsl-projects/wsl-move-browser-cookie-copy.tssrc/main/persistence/moving-wsl-projects/wsl-move-browser-cookie-store.tssrc/main/persistence/moving-wsl-projects/wsl-move-desktop-rewrite-stores.tssrc/main/startup/main-process-ready-foundation.tssrc/shared/wsl-move/wsl-move-browser-cookie-copy.tssrc/shared/wsl-move/wsl-move-cutover.tssrc/shared/wsl-move/wsl-move-out-of-store-dispositions.ts
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 startup pass ran before browser sessions and any window existed, so `browser-cookies` paused. | ||
| runAfterFirstWindowShown(() => { | ||
| void runGatedWslMoveDesktopRewritePass({ | ||
| userDataPath: getAppEnvironment().getPath('userData') | ||
| }) | ||
| }, WSL_MOVE_BROWSER_COOKIES_FALLBACK_MS) |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
rg -n 'runAfterFirstWindowShown' src --type=ts -g '!**/*.test.ts' | head -20
rg -n -A30 'export function runAfterFirstWindowShown' src
sed -n '1,60p' src/main/persistence/moving-wsl-projects/wsl-move-browser-cookie-store.ts
sed -n '290,312p' src/main/startup/main-process-ready-foundation.ts
rg -n 'sessions_not_ready|destination-committed|fence' src/main/persistence/moving-wsl-projects/*.ts | head -40Repository: stablyai/orca
Length of output: 12143
🏁 Script executed:
set +e
rg -n -F --glob '*.ts' \
-e 'runGatedWslMoveDesktopRewritePass' \
-e 'wsl_move_browser_sessions_not_ready' \
-e 'destination-committed' \
-e 'setInterval' \
-e 'runWslMoveDesktopRewritePass' \
src/main/persistence/moving-wsl-projects src/main/startup
printf '\n--- rewrite runner definitions ---\n'
rg -n -A100 -B15 'function runGatedWslMoveDesktopRewritePass|export .*runGatedWslMoveDesktopRewritePass|runGatedWslMoveDesktopRewritePass' src/main/persistence/moving-wsl-projects src/main/startup
printf '\n--- browser cookie copy ---\n'
rg -n -A120 -B20 'runWslMoveBrowserCookieCopy|wsl_move_browser_sessions_not_ready' src/main/persistence/moving-wsl-projects
printf '\n--- fence and journal consumers ---\n'
rg -n -A80 -B20 -e 'destinationCommitted' -e 'destination-committed' -e 'sessionFrozen' -e 'fenced' src/main/persistence/moving-wsl-projects/wsl-move-fence.ts src/main/persistence/moving-wsl-projects/wsl-move-scope-guard.ts
printf '\n--- startup and periodic move processing ---\n'
rg -n -A80 -B20 -e 'registerWslMoveDesktopRewriteStore' -e 'process.*move' -e 'rewrite.*pass' -e 'desktop.*rewrite' src/main/persistence/moving-wsl-projects src/main/startupRepository: stablyai/orca
Length of output: 45663
🏁 Script executed:
printf '%s\n' '--- wsl-move-desktop-rewrite.ts ---'
nl -ba src/main/persistence/moving-wsl-projects/wsl-move-desktop-rewrite.ts | sed -n '1,230p'
printf '%s\n' '--- wsl-move-desktop-rewrite-stores.ts ---'
nl -ba src/main/persistence/moving-wsl-projects/wsl-move-desktop-rewrite-stores.ts | sed -n '1,180p'
printf '%s\n' '--- wsl-move-browser-cookie-copy.ts ---'
nl -ba src/main/persistence/moving-wsl-projects/wsl-move-browser-cookie-copy.ts | sed -n '55,215p'
printf '%s\n' '--- wsl-move-background-backoff.ts ---'
nl -ba src/main/persistence/moving-wsl-projects/wsl-move-background-backoff.ts | sed -n '1,240p'
printf '%s\n' '--- wsl-move-fence.ts ---'
nl -ba src/main/persistence/moving-wsl-projects/wsl-move-fence.ts | sed -n '1,180p'
printf '%s\n' '--- scope guard phase handling ---'
nl -ba src/main/persistence/moving-wsl-projects/wsl-move-scope-guard.ts | sed -n '1,165p'
nl -ba src/main/persistence/moving-wsl-projects/wsl-move-scope-guard.ts | sed -n '250,335p'Repository: stablyai/orca
Length of output: 38409
🏁 Script executed:
printf '%s\n' '--- startup call sites ---'
nl -ba src/main/startup/main-process-ready-foundation.ts | sed -n '145,180p'
nl -ba src/main/startup/main-process-ready-foundation.ts | sed -n '292,312p'
rg -n -F --glob '*.ts' --glob '!**/*.test.ts' -- 'runWslMoveDesktopRewritePass(' src
rg -n -F --glob '*.ts' --glob '!**/*.test.ts' -- 'runGatedWslMoveDesktopRewritePass(' src
printf '%s\n' '--- first-window deferral implementation and tests ---'
nl -ba src/main/startup/first-window-deferral.ts | sed -n '1,100p'
rg -n -A100 -B20 -F -- 'runAfterFirstWindowShown' src/main/startup --glob '*test.ts'
printf '%s\n' '--- deferred startup call-site context ---'
nl -ba src/main/startup/main-process-ready-runtime.ts | sed -n '70,112p'
nl -ba src/main/host/deferred-secret-protection-report.ts | sed -n '55,85p'
printf '%s\n' '--- move commit and post-commit triggers ---'
rg -n -F --glob '*.ts' --glob '!**/*.test.ts' -e 'phase: '\''destination-committed'\''' -e 'destination-committed' -e 'recordWslMoveRendererStoreRewritten' src/main src/sharedRepository: stablyai/orca
Length of output: 42425
Retry the deferred pass if the fallback fires before a window exists.
runAfterFirstWindowShown runs its task once. If the 30-second fallback runs before a window exists, sessionsReady() returns false, and runWslMoveBrowserCookieCopy throws wsl_move_browser_sessions_not_ready. The pass then stops before later stores, and no other production caller retries it during that launch. The move remains at destination-committed until a later startup pass.
This does not keep the projects in the pre-commit fenced state. destination-committed places them in the post-commit hidden state and keeps their sessions frozen. The browser-cookie rewrite still remains incomplete.
The fallback is intentionally allowed to run without a window for GPU-failure and headless startup. Preserve that behavior, but retry this browser-dependent pass on the next window's ready-to-show event when the fallback finds no live window.
🐛 Suggested fix
-import { app, session } from 'electron'
+import { app, BrowserWindow, session } from 'electron'
...
// The startup pass ran before browser sessions and any window existed, so `browser-cookies` paused.
+ const runDeferredWslMovePass = (): void => {
+ void runGatedWslMoveDesktopRewritePass({
+ userDataPath: getAppEnvironment().getPath('userData')
+ })
+ }
runAfterFirstWindowShown(() => {
- void runGatedWslMoveDesktopRewritePass({
- userDataPath: getAppEnvironment().getPath('userData')
- })
+ if (BrowserWindow.getAllWindows().some((window) => !window.isDestroyed())) {
+ runDeferredWslMovePass()
+ return
+ }
+ app.once('browser-window-created', (_event, window) => {
+ window.once('ready-to-show', runDeferredWslMovePass)
+ })
}, WSL_MOVE_BROWSER_COOKIES_FALLBACK_MS)6e81d2e to
57a2667
Compare
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
🟡 Minor · Limit the profile list before copying. · wsl-move-browser-cookie-copy.ts:153-173
src/main/persistence/moving-wsl-projects/wsl-move-browser-cookie-copy.ts:153-173
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winLimit the profile list before copying.
When more than 256 browser profiles exist,
runWslMoveBrowserCookieCopybinds and copies every profile but records only the first 256. A later move into the same host does not find recorded partitions beyond that prefix, so it can copy those profiles again. If a user signed out on the host, the second move can restore the desktop cookie.Suggested fix
- const profiles = dependencies.listBrowserProfiles() + const profiles = dependencies + .listBrowserProfiles() + .slice(0, WSL_MOVE_BROWSER_COOKIE_COPY_MAX_PROFILES)
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
0e812120-a6c4-4656-bed5-bfa638909c6b
📥 Commits
Reviewing files that changed from the base of the PR and between 6e81d2ed973af661a5bb258acb7aceea74c76f41 and 57a2667.
📒 Files selected for processing: 2
src/main/startup/main-process-ready-foundation.tssrc/main/startup/main-process-ready-runtime.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
…ve (D1b-7f) A committed WSL move now copies each in-app browser profile's cookies once into the WSL host's stable route partition (owner decision 3a), merging without overwriting what the host jar holds and never touching the source. Where that is infeasible (no deployment link so no stable partition, the destination is not a WSL host or is gone, or the partition name is held by another identity) the host starts fresh and the move journal records why (3b). Registered as the ledgered browser-cookies rewrite store; it runs only once browser sessions and an app window exist. WSL_MOVE_DESKTOP_REWRITE_REGISTRY_COMPLETE stays false.
57a2667 to
4cf77a5
Compare
|
Contained in the dark landing PR #34059 (its head commit is an ancestor of the landing branch). Closing in favour of it; branch kept. |
ELI5
When a project moves from the Windows desktop to a WSL host (the internal-only "lossless mover", off unless
ORCA_INTERNAL_WSL_HOSTSis set), its in-app browser tabs now open on the WSL host. Those tabs use a separate cookie jar, so today the user would be signed out of every site after a move. This PR copies the desktop's browser cookies into the WSL host's jar once, when the move finishes. If that can't be done safely, the host starts with an empty jar and the move records why.Builds on #29610's merged design: a WSL host Orca deployed keeps one browser partition across orcad relaunches and re-pairs (environment id + host key; bindings carry an alias fingerprint).
What Changed
Before: after a WSL move, the moved project's in-app browser pages on the WSL host started signed out everywhere.
After: they stay signed in. The first move into a host copies each in-app browser profile's cookies into that host's partition. Later moves into the same host leave its jar alone.
Mechanism:
browser-cookieson the D1b-7b registry (wsl-move-browser-cookie-store.ts,wsl-move-browser-cookie-copy.ts). It runs at most once per move: run, then flush the cookie store to disk, then the ledger entry. A crash before the ledger entry re-runs it, and the merge finds every cookie already present.wsl-host-browser-route-partition.tsresolves the host's partition from the environment record alone, so no live connection or open page is needed. It uses the same identity, compatible identity and alias binding as page creation (derivePairedRuntimeBrowserAuthorityIdentity+resolveBrowserRoutePartitionBinding), so the copy lands where the host's first page will look. A test drives the real client-host runtime through two orcad relaunches/re-pairs and checks the partitions match.browser-partition-cookie-copy.tsreads both jars and writes through CDP (Network.getAllCookies/Network.setCookie, via the existing hidden, never-shown debugger window inbrowser-cookie-clear-store.ts). Electron'scookies.get/setdrop the partition key, so they are not used. It merges: a cookie the host already holds keeps the host's value. The desktop's own partition is only read.browserCookieCopyfield, eithercopiedwith per-profile counts, orfresh-partitionwith a reason.previewWslMoveBrowserCookieCopygives the move preview the same reason ahead of time.WSL_MOVE_DESKTOP_REWRITE_REGISTRY_COMPLETEstaysfalse. A one-line note sits where the registry is defined. The flip waits for 7c–7e.Shared paths touched
browser-cookie-clear-store.ts(new read-onlyreadAllCdpCookies; the CDP cookie type moved tobrowser-cdp-cookie.ts);browser-cookie-import-clear.ts(type only);browser-session-startup.ts(abrowserSessionsInitialized()getter).main-process-ready-foundation.tsregisters the store;main-process-ready-runtime.tsschedules one gated pass after the first window (next to the other first-window chores). With the gate closed, that pass does nothing.Feasibility of copying each cookie kind (Electron 43)
partitionKey; Electron's cookies API would silently drop it and make the cookie cross-site__Host-/__Secure-, host-only vs domainrejectedWhen the move uses a fresh partition instead, the journal says why:
no-stable-partitiondestination-not-wsl-hostdestination-environment-missingdestination-partition-conflictWhy
Owner decision 3 (2026-10-16): (a) copy once at move time where feasible, otherwise (b) start fresh and say why. Literally binding the host to the desktop's partition is impossible. The binding store only accepts
persist:orca-browser-v1-<hex>names, and route sessions put a SOCKS proxy on the whole session, so the desktop jar can't double as the host's jar.Scope: whole jar, once per host. Cookies aren't scoped per project. A browser profile's jar is shared by every project, so there is nothing per-project to pick out. So each profile's jar is copied once into its partition on that host, by the first move into the host. Later moves skip partitions an earlier, ledgered move already copied into, so they never bring back a login the user signed out of on the host.
CDP over Electron's cookies API. Electron's API loses partition keys. Copying a partitioned cookie through it would quietly widen it to every site, which is a privacy regression rather than a lossless copy.
Merge, never overwrite. This makes a re-run after a crash harmless and keeps any session the user already started on the host.
The source is never written. There is no reverse mover (decision 2), so the desktop jar stays the safety net.
Linked Issue
N/A (internal WSL mover step D1b-7f, maintainer PR).
Visual Proof
N/A. This is a gated-dark, main-process data copy with no UI. The move preview UI that shows the reason is D1b-9.
Testing
wsl-host-browser-route-partition.test.ts:browser-partition-cookie-copy.test.ts:wsl-move-browser-cookie-copy.test.ts(through the real D1b-7b driver and journal):pnpm tc;pnpm run check:code-quality:changed;check-focus-read-ratchet;check-layout-writer-ratchets;moving-wsl-projects,shared/wsl-move).Review
An adversarial reviewer found one HIGH and one MEDIUM issue; both are fixed here.
Agent skill upstream boundary
Notes
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)