Skip to content

fix(wsl-move): land on the workspace view after a move's window reload - #37376

Merged
nwparker merged 3 commits into
mainfrom
fix/wsl-move-reload-navigation
Nov 2, 2026
Merged

nwparker merged 3 commits into
mainfrom
fix/wsl-move-reload-navigation

Conversation

@nwparker

@nwparker nwparker commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​156 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​155
Prod 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​33 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​31

ELI5

Moving projects to a WSL host (or bringing them back with "Use on this computer again") reloads the Orca window. If you started from Settings, the reload dropped you on Settings → General, and Orca kept opening there on later launches too. Now the reload drops you on your workspace, showing the project you moved.

What Changed

  • Before: you finish a move from Settings → Remote Orca Servers, the window reloads, and you land on Settings → General. Quit and relaunch, and you're in Settings → General again.
  • After: the reload opens the normal workspace view. If the moved project was the one you had open, it is still selected (the move already pointed focus at its new copy). Later launches open the workspace view as well.

Mechanism: Orca saves which top-level screen is open (workspace, Settings, Tasks, and so on) and restores it when the window loads. It does not save which Settings page was open, so restoring "Settings" always shows General. During a move, main ignores saves from the window until the reload, so the saved screen stayed "Settings" and both the reload and the next launch restored it. Right before main reloads the window for a move or an undo, it now changes a saved "Settings" to the workspace view (leaveSettingsForWslMoveReload in src/main/ipc/wsl-move-reloadable-window.ts). Any other saved screen is left alone.

Why

Move and undo both reload through one function in main, so one change there fixes both entry points, and also moves started automatically. Alternatives I considered:

  • Saving the open Settings page across reloads so the user lands back on Remote Orca Servers. That touches general Settings navigation and saved UI state for every reload, not just this one. It also leaves the relaunch problem in place.
  • Never restoring Settings on startup. That would change what every Settings reload does, not just reloads after a move.
  • Dropping the reload. It's needed: the window has stale project state that main rewrote on disk, and the reload is how the window picks up the new state. Removing it is not a small or safe change.

Moving and undoing work exactly as before. Only the screen you land on after the reload is different.

Linked Issue

N/A (pre-release WSL hosts feedback)

Visual Proof

N/A: this only changes which screen opens after the reload. The covering unit test checks the saved screen before the reload and after a simulated relaunch.

Testing

  • src/main/ipc/wsl-move-reloadable-window.test.ts (new): a reload from Settings saves the workspace view, and a relaunched store reads the workspace view. Other screens such as Tasks are kept. The window adapter switches the screen before it calls reload.

  • Re-ran wsl-move-window-write-hold.test.ts and wsl-move-release-here.test.ts.

  • pnpm tc, pnpm typecheck:ci, pnpm run check:code-quality:changed, oxlint, oxfmt.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

Risk

Only the WSL move and undo reload are affected. SSH and remote Orca servers don't use this reload, so they don't change. Folder workspaces and git worktrees behave the same because the change doesn't depend on workspace type. The worst case is that someone who wanted to stay in Settings after a move lands on the workspace view and has to reopen Settings. A plain revert backs it out.

Level: Low

AI Disclosure

Review

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

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)

Co-Authored-By: Claude [email protected]

A move or "Use on this computer again" reloads the window from Settings.
Settings cannot restore which page was open, so the reload opened General,
and the saved view kept reopening Settings on later launches. Main now
switches the saved view from Settings to the workspace view right before
that reload.

Co-Authored-By: Claude <[email protected]>

@nwparker nwparker left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Independent review: APPROVE (at c47290b)

  • Correctness: leaveSettingsForWslMoveReload runs only inside the move's held reload (reloadWslMoveWindowWithWritesHeld → setImmediate → reload). It flips a saved activeView of settings to terminal and keeps any other view.
  • Write-hold race: the hold only drops renderer-originated writes (ui:set, session saves, the unload checkpoint). The main-side store.updateUI isn't affected, and the stale page can't write settings back before the new page loads and hydrates terminal.
  • Persistence: updateUI → ActiveViewPreference (active-view.json), so the next launch opens the workspace view too. The test proves this by reopening a real store.
  • Other reload paths: SSH, crash and settings reloads don't go through this window adapter, so they're unchanged. A destroyed window skips both the reload and the flip.
  • Tests: mutation-checked. Dropping the flip, flipping every view, and flipping after reload() each fail a test. tc:node is clean and CI is green.

Flag-off: none (WSL move/undo reload only). User-risk: low.

The landing view now comes from the write hold whenever a reload is owed,
so a window closed before the reload still relaunches on the workspace view.

Co-Authored-By: Claude <[email protected]>
@nwparker
nwparker marked this pull request as ready for review November 2, 2026 06:52
Picking the landing view is now best-effort, so a failing store write no
longer strands the write hold or skips the reload. Adds a wiring test that
fails if the landing is not registered.

Co-Authored-By: Claude <[email protected]>
@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Warning

Review limit reached

You'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 1 minute.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

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: 582626db-e35e-4a5a-b6d2-2702ccebbadc
Commits

Reviewing files that changed from the base of the PR and between de309dd and cbff6a2.

Files selected for processing: 3
  • src/main/ipc/wsl-move-driver-wiring-reload-landing.test.ts
  • src/main/persistence/moving-wsl-projects/wsl-move-window-write-hold.test.ts
  • src/main/persistence/moving-wsl-projects/wsl-move-window-write-hold.ts
Recent 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: 6a718873-a091-471a-a173-14e54918e8ee
Commits

Reviewing files that changed from the base of the PR and between 4343dc2 and de309dd.

Files selected for processing: 5
  • src/main/ipc/wsl-move-driver-wiring.ts
  • src/main/ipc/wsl-move-reloadable-window.test.ts
  • src/main/ipc/wsl-move-reloadable-window.ts
  • src/main/persistence/moving-wsl-projects/wsl-move-window-write-hold.test.ts
  • src/main/persistence/moving-wsl-projects/wsl-move-window-write-hold.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.

Walkthrough

The WSL move reload flow now registers a landing callback. When the active view is Settings, the callback changes it to terminal. Other active views remain unchanged. Tests cover callback timing, destroyed windows, and persistence of the selected view after reopening the store.

Merge Risk: Low · previous review de309

A WSL move from Settings may still reopen to Settings instead of the workspace view; flush the landing-view preference before reloading.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: selecting the workspace view after a WSL move window reload.
Description check Passed The description is mostly complete. It explains the user impact, implementation, rationale, testing, risk, rollback, cross-platform considerations, and visual-proof exception. The linked issue is mark…
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description is mostly complete. It explains the user impact, implementation, rationale, testing, risk, rollback, cross-platform considerations, and visual-proof exception. The linked issue is marked N/A, the AI Disclosure and Review sections are empty, manual testing was not completed, and the full lint/typecheck/test/build checklist is not checked.

Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 2 functions across 5 files.

Finishing Touches
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.

Share

Comment on lines +10 to +13
export function leaveSettingsForWslMoveReload(ui: Pick<Store, 'getUI' | 'updateUI'>): void {
if (ui.getUI().activeView === 'settings') {
ui.updateUI({ activeView: 'terminal' })
}

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.

Minor · Data Integrity & Integration · Quick win

Supported by static analysis

Script executed:

sed -n '1,80p' src/main/ipc/wsl-move-reloadable-window.ts
sed -n '1,140p' src/main/persistence/applying-settings/ui-state-update.ts
sed -n '1,130p' src/main/active-view-preference.ts
sed -n '70,115p' src/main/persistence/moving-wsl-projects/wsl-move-window-write-hold.ts
rg -n "flush\\(|updatePersistedUI|setActiveView|activeView" src/main/persistence src/main/ipc src/main/active-view-preference.ts

Repository: stablyai/orca

Length of output: 41395


Script executed:

set -o pipefail
printf '%s\n' '--- leaveSettings usages and changed diff ---'
rg -n -F --glob '*.ts' -e 'leaveSettingsForWslMoveReload' -e 'reloadWslMoveWindowWithWritesHeld' -e 'holdWslMoveWindowWrites' -e 'setWslMoveWindow' src/main
git diff cb031c45173bbfd65ee0dd5eecf0906cf942dccb de309dd4ed6c6fc469f1b6b097b7b8ca490cbbeb -- src/main/ipc/wsl-move-reloadable-window.ts src/main/persistence/moving-wsl-projects/wsl-move-window-write-hold.ts

printf '%s\n' '--- write hold complete module ---'
sed -n '1,240p' src/main/persistence/moving-wsl-projects/wsl-move-window-write-hold.ts

printf '%s\n' '--- direct callers and surrounding owner blocks ---'
for f in $(rg -l -F --glob '*.ts' 'leaveSettingsForWslMoveReload' src/main); do
  echo "FILE $f"
  nl -ba "$f" | sed -n '1,220p'
done

printf '%s\n' '--- store flush and active-view wiring ---'
nl -ba src/main/persistence/loading-store/store.ts | sed -n '80,175p'
nl -ba src/main/persistence/loading-store/primary-state-writes.ts | sed -n '1,100p'
nl -ba src/main/persistence/loading-store/write-scheduling.ts | sed -n '1,100p'
nl -ba src/main/active-view-preference.ts | sed -n '130,285p'

Repository: stablyai/orca

Length of output: 42025


Script executed:

set -o pipefail
printf '%s\n' '--- Store flush APIs and profile persistence wiring ---'
rg -n -F --glob '*.ts' -e 'flush(): void' -e 'flushOrThrow()' -e 'flushActiveViewPreferenceOrThrow' -e 'flushAsync()' -e 'registerWslMoveWiring(' src/main/persistence/loading-store src/main | head -160

printf '%s\n' '--- Store class flush methods ---'
rg -n -F --glob 'store.ts' -e 'class Store' -e 'flush' src/main/persistence/loading-store/store.ts
nl -ba src/main/persistence/loading-store/store.ts | sed -n '175,290p'

printf '%s\n' '--- production registration context ---'
rg -n -F --glob '*.ts' -e 'registerWslMoveWiring(' src/main --glob '!*.test.ts'

Repository: stablyai/orca

Length of output: 21107


Script executed:

set -o pipefail
printf '%s\n' '--- Store declaration and public persistence methods ---'
nl -ba src/main/persistence/loading-store/store.ts | sed -n '1,90p'
nl -ba src/main/persistence/loading-store/store.ts | sed -n '285,390p'
rg -n -F --glob '*.ts' -e 'export type Store' -e 'interface Store' -e 'flushActiveViewPreferenceOrThrow' -e 'this.domains.flush' -e 'this.domains.writes' src/main/persistence/loading-store

printf '%s\n' '--- write flush barriers ---'
nl -ba src/main/persistence/loading-store/write-flush-barriers.ts | sed -n '1,215p'

printf '%s\n' '--- Store construction/domain installation ---'
rg -n -F --glob '*.ts' -e 'installStoreDomainContexts' -e 'createStoreDomains' src/main/persistence/loading-store

Repository: stablyai/orca

Length of output: 17405


Script executed:

set -o pipefail
printf '%s\n' '--- domain operation composition ---'
nl -ba src/main/persistence/loading-store/store-domain-composition.ts | sed -n '1,155p'

printf '%s\n' '--- reload callers and complete surrounding functions ---'
rg -n -F --glob '*.ts' -e 'reloadWslMoveWindowWithWritesHeld(' src/main/persistence src/main/ipc --glob '!*.test.ts'
nl -ba src/main/persistence/moving-wsl-projects/wsl-move-desktop-rewrite.ts | sed -n '145,190p'
nl -ba src/main/ipc/wsl-move-release-here.ts | sed -n '140,175p'
nl -ba src/main/persistence/moving-wsl-projects/wsl-move-window-write-hold.ts | sed -n '45,115p'

Repository: stablyai/orca

Length of output: 15055


Flush the active-view sidecar before the move reload.

The landing callback only schedules the settings to terminal update. setImmediate can run before the 100 ms debounce, so the reload or next launch can still read settings.

Call flushActiveViewPreferenceOrThrow() after updateUI:

--- "a/src/main/ipc/wsl-move-reloadable-window.ts"
+++ "b/src/main/ipc/wsl-move-reloadable-window.ts"
@@ -7,11 +7,14 @@
  * Settings cannot restore its page, so a reload from it would open General (and keep reopening
  * there on launch); land on the workspace view, which the move already focused on its projects.
  */
-export function leaveSettingsForWslMoveReload(ui: Pick<Store, 'getUI' | 'updateUI'>): void {
+export function leaveSettingsForWslMoveReload(
+  ui: Pick<Store, 'getUI' | 'updateUI' | 'flushActiveViewPreferenceOrThrow'>
+): void {
   if (ui.getUI().activeView === 'settings') {
     ui.updateUI({ activeView: 'terminal' })
+    ui.flushActiveViewPreferenceOrThrow()
   }
 }
 
 export function wslMoveReloadableWindow(contents: WebContents): WslMoveReloadableWindow {
   return {

@nwparker
nwparker merged commit 2bbf73a into main Nov 2, 2026
50 checks passed
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.

1 participant