Skip to content

feat: add independent native desktop windows - #33112

Open
LuweiLiao wants to merge 10 commits into
stablyai:mainfrom
LuweiLiao:feat/native-desktop-multi-window
Open

LuweiLiao wants to merge 10 commits into
stablyai:mainfrom
LuweiLiao:feat/native-desktop-multi-window

Conversation

@LuweiLiao

@LuweiLiao LuweiLiao commented Oct 24, 2026 •

Copy link
Copy Markdown

ELI5

Open a project in another full Orca window and keep a different workspace visible on each monitor or desktop. Each window has its own selection and bounds. Closing or reloading one window leaves the other windows and their terminals running.

What Changed

  • Add New Window to the app menu and keyboard bindings, plus Open in New Window in the workspace context menu.
  • Load the desktop renderer and full preload in every window, including editors, browser panes, settings, clipboard, file pickers, and skills.
  • Keep window selection and bounds separate while sharing the existing runtime, terminal processes, and workspace layout stream. Merge pending local layout edits and retain unsaved editor drafts when another window closes its clean copy.
  • Route terminal delivery credit, native controls, dialogs, browser guests, certificate challenges, remote browser renderer bridges, and teardown to their owning window. Process services start once; closing the first window does not end its peers.
  • Restore the windows that remained open at quit. Keep desktop window state out of paired-client UI responses, and preserve saved-window records during SSH identity and gated WSL project migration.

This branch started directly from upstream main at 04f7ed24b6 and now includes upstream 42f59f34604c56ca2b80235b080660c2080d317d through a merge that preserves the existing feature commits. It contains the multi-window change and its regression fixes. It does not include the fork's WSL picker/template changes, annotation recovery changes, packaging changes, or local auto-update policy.

Why

Independent project contexts are useful across monitors and OS desktops. Reusing the desktop workbench preserves its native capabilities; independent renderer registration and per-window lifetime handling avoid making the first window a special parent. Existing runtime graphs, layout streams, and terminal processes remain the shared backend.

Linked Issue

Fixes #6074

Visual Proof

The screenshots use the same disposable project and hidden renderers on Windows. The before capture is from unmodified upstream 04f7ed24b6; the after captures are from this branch before the later Linux review fixes. No screenshot assets are committed to the PR.

Before After
Upstream workspace menu Workspace menu with Open in New Window

An additional window runs the full editor:

Native peer editor

Testing

  • The contributor manually tested multiple windows in the Windows packaged build containing this feature. That package predates the upstream extraction and subsequent review fixes.
  • Automated tests added/updated for window lifetime, restore, terminal delivery, concurrent layout edits, browser guest ownership, skills, remote renderer bridges, certificate isolation, migration, and unsaved draft retention.

Current Linux validation applies to 39612f50db3ea0caaf2f0fb2096b33d8c3625b31 after integrating upstream 42f59f3460:

  • Integrated changed/dependent unit tests: 63 files, 840 passed and 2 skipped, including quick-command client capabilities and paired UI-state isolation. The earlier 696-pass, 105-pass browser and 33-pass WSL suites overlap with this set and should not be summed.
  • pnpm tc passes. The complete PR changed-code quality gate against the integrated upstream base reports zero new findings across 209 source files. Diff checks and commit hooks pass.
  • A fresh current-head build:electron-vite --mode e2e passes. 15/15 real Electron scenarios pass on isolated Linux Xvfb: four windows and terminal input, first-window close, individual selections/bounds and restore, independent browser ownership, concurrent rename/reorder, dirty draft retention and save, profile notifications through reload, skills, folder/worktree watchers, and default/custom New Window shortcuts sent through real browser-guest input with repeat prevention.
  • The full 15-case run deliberately inherits ELECTRON_RENDERER_URL=http://127.0.0.1:59999; the launch fixtures clear it after environment overlays. The pre-fix four-window failure was reproduced, and the three lifecycle cases passed twice (6/6) after the fixture correction. These repeated cases overlap with the 15-case run.
  • Two independent read-only reviews checked state/persistence and final integration without identifying another confirmed defect. The merge preserves both upstream quick-command capability validation and this PR's desktop-window state isolation.

Earlier extraction-stage builds also passed build:desktop:assets (projected web client, skills CLI verification and mobile web bundle) and build:orcad dependency/plain-Node checks with zero Electron imports. Those older build results do not certify a current packaged installer or a new mobile/remote deployment. Detailed follow-up evidence and review request: #33112 (comment) .

To exercise the UI, open several windows using File > New Window or the workspace context menu, choose different workspaces, edit in one window, and close/reload another. Quit with several windows open and relaunch to check their selections and bounds.

All agent-launched apps used ORCA_BACKGROUND_LAUNCH=1, disposable HOME/userData and hidden Playwright/CDP renderers. Linux runs used an isolated Xvfb display. The installed application was not closed or replaced for testing. Current fixes are not certified on actual Windows/WSL, macOS, live mixed-version SSH/remote hosts, Wayland/IME, hardware GPU/multiple monitors or foreground/native desktop focus. Full cross-platform CI remains separate from these local results; the GitHub clean workflow alone is not that CI matrix.

AI Disclosure

Developed with Claude and Codex. Independent source reviews used gpt-6.1-sol with high reasoning. Findings were reproduced with regression tests and corrected before submission. Later Codex agents reproduced the Linux environment failure and independently reviewed migration/state behavior and upstream integration.

Review

Reviewed renderer identity and IPC trust, independent cleanup, draft persistence, terminal delivery/resize arbitration, native browser guest ownership, and remote renderer lifetime. Platform paths and shortcuts follow the existing cross-platform wrappers. Folder workspaces and mixed-version paired clients retain their existing paths. No provider-specific agent or Git provider behavior is added. Remaining platform and focus validation is stated above.

Agent Skill Upstream Boundary

  • Not applicable: this change copies no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

This adds peer workbench windows, not drag-to-detach tabs or a new in-window tiling interface. No installer, release version change, or binary artifact is included.

Author: @LuweiLiao. PR feature commits use author and committer Luviewer <[email protected]>; upstream commits retain their original authors. X/Twitter handle: not provided.

Checklist

  • Focused on native desktop multi-window behavior; the change spans the shared runtime and window lifecycle contracts it needs.
  • Explained the user-facing change, mechanism and reason.
  • Before/after screenshots attached.
  • Reviewed correctness, IPC trust, lifetime cleanup and performance risk.
  • Considered cross-platform shortcuts/paths, remote clients, mobile state boundaries and folder workspaces.
  • Local types, targeted tests and changed-code quality checks pass. Full repository CI remains authoritative for the broader test/platform matrix.

Open full desktop windows from the app menu, shortcut, or workspace context menu. Keep window views and bounds independent while sharing runtime graphs, terminal processes, settings, and agent state. Scope controls, dialogs, browser guests, skill authorization, terminal delivery credit, and cleanup to their owning desktop renderers. Restore open windows without coupling their lifetime to the first window.

Extract the reviewed multi-window work onto current upstream without local WSL, annotation, packaging, or auto-update changes.

Fixes stablyai#6074
Keep remote browser renderer bridges alive independently, bind certificate failures to their guest, and preserve unsaved editor tabs when another window closes its clean view. Remove the unused paired-window prototype and route menu actions to the selected native renderer while retaining saved-window migration.
Place a retained dirty editor in a surviving incoming group rather than restoring the previous group tree. Cover dirty and debounce-only drafts while the peer replaces their old group.
@LuweiLiao
LuweiLiao force-pushed the feat/native-desktop-multi-window branch from ff500cc to d8f42ca Compare October 24, 2026 09:35
@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Reviews paused

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.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
Walkthrough

The pull request adds native desktop windows with independent IDs, saved window state, restoration, and worktree-specific launch targets. It adds renderer registration, window-scoped runtime graphs and notifications, and session/layout reconciliation across windows. Browser guests and PTY delivery are scoped across native renderers. New menu items and shortcuts open windows. Tests cover lifecycle behavior, concurrent updates, renderer routing, and multi-window workflows.

Priority: Normal

Merge Risk: Low · up to cb163

Multi-window browser behavior has a small gap: when two windows share a browser page, hovering a link in one window can lose the link-preview URL or show it in the wrong window. Two new end-to-end tests also do not check what is rendered in the window. Neither issue is severe, but both are worth fixing before or soon after merge.

Pre-merge checks: Passed 4 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Docstring Coverage Inconclusive Docstring coverage is 4.17% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 24 functions across 52 files. (166 skipped… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title "feat: add independent native desktop windows" matches the main change: the PR adds independent native Orca desktop windows, each with its own workspace selection and bounds, sharing the run…
Description check Passed The description follows the template sections: ELI5, What Changed, Why, Linked Issue (Fixes #6074), Visual Proof (before/after images), Testing with manual and automated test details, AI Disclosure, R…
Linked Issues check Passed Issue [#6074] requires multiple Orca windows for separate project contexts and the ability to move projects between windows. The PR adds native window creation through the File menu, keybindings, rend…
Out of Scope Changes check Passed The reviewed changes remain connected to [#6074]. Browser, PTY, native-control, notifier, dialog, watcher, updater, and runtime changes route shared services to the correct surviving window. Persisten…
Full details: Title check

Explanation

The title "feat: add independent native desktop windows" matches the main change: the PR adds independent native Orca desktop windows, each with its own workspace selection and bounds, sharing the runtime, terminals, and layout stream. It is short, specific, and uses a conventional commit prefix.

Full details: Description check

Explanation

The description follows the template sections: ELI5, What Changed, Why, Linked Issue (Fixes #6074), Visual Proof (before/after images), Testing with manual and automated test details, AI Disclosure, Review, Agent Skill Upstream Boundary, Notes, and Checklist. The What Changed and Why sections explain the mechanism and the reasoning. Testing details are thorough and state which platforms were covered.

Full details: Linked Issues check

Explanation

Issue [#6074] requires multiple Orca windows for separate project contexts and the ability to move projects between windows. The PR adds native window creation through the File menu, keybindings, renderer shortcuts, and the workspace context menu. NativeDesktopWindows assigns window IDs, restores open windows, and preserves per-window state. The open command accepts a worktreeId, so a project can open in a selected new window. Shared layout, terminal, browser, editor, and automation routing keeps each full project context usable. Regression tests cover window lifecycle, restoration, selection, bounds, layout edits, drafts, terminal delivery, browser ownership, and shortcuts. The suggested main-window-only tasks compromise is contextual issue text, not a required objective.

Full details: Out of Scope Changes check

Explanation

The reviewed changes remain connected to [#6074]. Browser, PTY, native-control, notifier, dialog, watcher, updater, and runtime changes route shared services to the correct surviving window. Persistence, SSH migration, and WSL migration changes preserve per-window selections, layouts, drafts, and host identity when state moves. The web launch-worktree flow supports opening a requested project in a new window. The added tests validate these multi-window contracts. No unrelated product feature is demonstrated. The PR description also excludes packaging, annotation recovery, and unrelated WSL picker/template work.

Full details: Docstring Coverage

Explanation

Docstring coverage is 4.17% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 24 functions across 52 files. (166 skipped: 7 unsupported, 159 over the file limit.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • 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 @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 10

🧹 Nitpick comments: 2
src/main/ipc/pty/delivery/native-desktop-delivery.ts: 1

257-289: Trivial · Functional Correctness · Quick win

Clear drivers and hints entries when a PTY exits.

The pty:exit branch resets per-window delivery accounting for the PTY. It does not remove this.drivers or the per-window entry.hints for that id. These entries live until the owning window navigates, crashes or closes. The maps grow with every PTY that was ever driven or hinted.

Stable-pane adoption and replaced-PTY flows can also reuse a PTY id. A stale driver entry then decides canReply and canResize for the new PTY. A window that is not the live terminal owner can block query replies or resizes.

Delete the entries when channel === 'pty:exit':

♻️ Proposed fix
       if (id && (channel === 'pty:exit' || channel === 'pty:spawned')) {
+        if (channel === 'pty:exit') {
+          this.drivers.delete(id)
+          for (const entry of this.windows.values()) {
+            entry.hints.delete(id)
+          }
+        }
         const pending = session.pendingData.delete(id)

This edit runs once per window in the loop. It is idempotent. Move it before the for loop if you prefer a single pass.

src/main/persistence/desktop-window-session-writes.ts: 1

58-58: Trivial · Performance & Scalability · Heavy lift

Avoid cloning the full session on every operation.

prepareDesktopWindowSessionWrite clones the full session before returning. Moving that clone into commit only shifts the work because the normal session:set, session:patch, and shutdown paths all call commit after a successful write. readDesktopWindowSession also clones the full session for every window-scoped session:get.

Use a baseline representation that avoids copying unchanged localOnlyScrollbackByTabId data while preserving snapshot isolation.


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: ec0ff10d-81e2-4f41-a2b0-dac615d5b481
Commits

Reviewing files that changed from the base of the PR and between 6ed2e6d and d8f42ca.

Files selected for processing: 189
  • src/main/browser/agent-browser-bridge-core-commands.ts
  • src/main/browser/agent-browser-bridge-lifecycle.ts
  • src/main/browser/agent-browser-bridge-navigation.test.ts
  • src/main/browser/agent-browser-bridge-queue.ts
  • src/main/browser/agent-browser-bridge-session-lifecycle.test.ts
  • src/main/browser/agent-browser-bridge-shutdown.ts
  • src/main/browser/agent-browser-bridge-state.ts
  • src/main/browser/agent-browser-bridge-tabs.ts
  • src/main/browser/agent-browser-bridge-types.ts
  • src/main/browser/browser-certificate-trust-controller.test.ts
  • src/main/browser/browser-certificate-trust-controller.ts
  • src/main/browser/browser-client-page-renderer-bridge.test.ts
  • src/main/browser/browser-client-page-renderer-bridge.ts
  • src/main/browser/browser-client-page-renderer-runtime.ts
  • src/main/browser/browser-manager-bindings.ts
  • src/main/browser/browser-manager-destroyed-guest-test-fixture.ts
  • src/main/browser/browser-manager-download-lifecycle.ts
  • src/main/browser/browser-manager-event-forwarding.ts
  • src/main/browser/browser-manager-final.ts
  • src/main/browser/browser-manager-grab.ts
  • src/main/browser/browser-manager-guest-cleanup.ts
  • src/main/browser/browser-manager-guest-navigation-policy.ts
  • src/main/browser/browser-manager-guest-popup-policy.ts
  • src/main/browser/browser-manager-native-guests.test.ts
  • src/main/browser/browser-manager-native-guests.ts
  • src/main/browser/browser-manager-native-viewport.test.ts
  • src/main/browser/browser-manager-navigation.ts
  • src/main/browser/browser-manager-queries.ts
  • src/main/browser/browser-manager-registration.ts
  • src/main/browser/browser-manager-state.ts
  • src/main/browser/browser-manager-viewport-ownership.test.ts
  • src/main/browser/browser-manager-viewport-scroll-state.ts
  • src/main/browser/browser-manager-viewport.ts
  • src/main/browser/browser-manager-visibility.ts
  • src/main/browser/browser-page-prompts.ts
  • src/main/browser/browser-popup-compatibility-manager-fixture.ts
  • src/main/browser/browser-webauthn-account-picker.test.ts
  • src/main/browser/browser-webauthn-account-picker.ts
  • src/main/host/electron-runtime-desktop-surface.ts
  • src/main/ipc/automations.ts
  • src/main/ipc/browser-annotation-viewport-ipc.test.ts
  • src/main/ipc/browser-client-page-metadata-ipc.test.ts
  • src/main/ipc/browser-grab-ipc.ts
  • src/main/ipc/browser-guest-view-ipc.ts
  • src/main/ipc/browser-native-registration.test-fixture.ts
  • src/main/ipc/browser-preview-tool-authorization.test.ts
  • src/main/ipc/browser-renderer-selection.ts
  • src/main/ipc/browser-renderer-trust.ts
  • src/main/ipc/browser-session-profile-ipc.test.ts
  • src/main/ipc/browser-session-profile-ipc.ts
  • src/main/ipc/browser.test.ts
  • src/main/ipc/browser.ts
  • src/main/ipc/folder-repo-git-upgrade.test.ts
  • src/main/ipc/folder-repo-git-upgrade.ts
  • src/main/ipc/pty/delivery/accounting.ts
  • src/main/ipc/pty/delivery/native-desktop-delivery.test.ts
  • src/main/ipc/pty/delivery/native-desktop-delivery.ts
  • src/main/ipc/pty/delivery/payload.ts
  • src/main/ipc/pty/delivery/wire-session.ts
  • src/main/ipc/pty/ipc/renderer-delivery-credit.ts
  • src/main/ipc/pty/ipc/resize-visibility.ts
  • src/main/ipc/pty/ipc/write-input.ts
  • src/main/ipc/pty/ipc/write.ts
  • src/main/ipc/pty/register-handlers.ts
  • src/main/ipc/pty/session.ts
  • src/main/ipc/register-core-handlers/register-core-handlers.test.ts
  • src/main/ipc/register-core-handlers/register-core-handlers.ts
  • src/main/ipc/renderer-shutdown-checkpoint.ts
  • src/main/ipc/repos/repo-clone-lifecycle.ts
  • src/main/ipc/repos/repo-folder-picker-handlers.ts
  • src/main/ipc/repos/repos-changed-notification.ts
  • src/main/ipc/repos/sparse-preset-handlers.ts
  • src/main/ipc/runtime-client-window.ts
  • src/main/ipc/runtime.ts
  • src/main/ipc/session.ts
  • src/main/ipc/skill-ipc-main-window.test.ts
  • src/main/ipc/skill-ipc-main-window.ts
  • src/main/ipc/ui.ts
  • src/main/ipc/worktree-base-directory-watcher.test.ts
  • src/main/ipc/worktree-base-directory-watcher.ts
  • src/main/ipc/worktree-remote.ts
  • src/main/menu/app-menu-shortcut-label.ts
  • src/main/menu/app-menu-window.ts
  • src/main/menu/register-app-menu.test.ts
  • src/main/menu/register-app-menu.ts
  • src/main/persistence/desktop-window-session-writes.test.ts
  • src/main/persistence/desktop-window-session-writes.ts
  • src/main/persistence/desktop-window-state.test.ts
  • src/main/persistence/desktop-window-state.ts
  • src/main/persistence/tracking-repos/worktree-identity-migration-field-coverage.test.ts
  • src/main/persistence/tracking-repos/worktree-identity-migration.ts
  • src/main/rate-limits/service/service-state.ts
  • src/main/runtime/native-desktop-window-graphs.test.ts
  • src/main/runtime/native-desktop-window-graphs.ts
  • src/main/runtime/rpc/methods/client-ui-pairing-local-fields.test.ts
  • src/main/runtime/rpc/methods/client-ui.ts
  • src/main/runtime/rpc/methods/ui-state-schema-parity-checks.ts
  • src/main/ssh/targets/ssh-target-id-migration.test.ts
  • src/main/ssh/targets/ssh-target-id-migration.ts
  • src/main/startup/main-process-i18n-menu.ts
  • src/main/startup/main-process-runtime-launch.ts
  • src/main/startup/main-window-agent-status.ts
  • src/main/startup/main-window-controller.ts
  • src/main/startup/main-window-core-services.ts
  • src/main/updater/updater-install-execution.ts
  • src/main/updater/updater-mac-install-preflight.ts
  • src/main/updater/updater-nudge.ts
  • src/main/updater/updater-state.ts
  • src/main/updater/updater-status.ts
  • src/main/window/attach-main-window-services.ts
  • src/main/window/clipboard-ipc-handlers.ts
  • src/main/window/createMainWindow-close-confirmation.test.ts
  • src/main/window/createMainWindow-markdown-editor-focus.test.ts
  • src/main/window/createMainWindow-tray-minimize-close.test.ts
  • src/main/window/createMainWindow.ts
  • src/main/window/dashboard-popout-window.ts
  • src/main/window/desktop-renderer-registry.test.ts
  • src/main/window/desktop-renderer-registry.ts
  • src/main/window/dropped-path-preparation-ipc.test.ts
  • src/main/window/dropped-path-preparation-ipc.ts
  • src/main/window/main-window-close-lifecycle.ts
  • src/main/window/main-window-contracts.ts
  • src/main/window/main-window-state-lifecycle.ts
  • src/main/window/main-window-worktree-watchers.test.ts
  • src/main/window/main-window-worktree-watchers.ts
  • src/main/window/native-desktop-automations.test.ts
  • src/main/window/native-desktop-automations.ts
  • src/main/window/native-desktop-notifiers.test.ts
  • src/main/window/native-desktop-notifiers.ts
  • src/main/window/native-desktop-windows.test.ts
  • src/main/window/native-desktop-windows.ts
  • src/main/window/native-window-controls.test.ts
  • src/main/window/native-window-controls.ts
  • src/main/window/native-window-service-handlers.ts
  • src/main/window/runtime-client-window-open-command.ts
  • src/main/window/runtime-client-window-records.ts
  • src/main/window/runtime-window-lifecycle-native-graphs.test.ts
  • src/main/window/runtime-window-lifecycle.ts
  • src/main/window/window-zoom-shortcuts.ts
  • src/preload/api/ui-bridge-clipboard-and-window-controls.ts
  • src/preload/api/ui-window-api.ts
  • src/preload/index.ts
  • src/renderer/src/app-shell/reconcile-hydrated-workspace-tab-models.ts
  • src/renderer/src/app-shell/use-global-keybindings.ts
  • src/renderer/src/components/sidebar/WorktreeContextMenuView.tsx
  • src/renderer/src/components/sidebar/WorktreeOpenInNewWindowMenuItem.tsx
  • src/renderer/src/env.d.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/fr.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/pt.json
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/lib/open-runtime-client-window.ts
  • src/renderer/src/main.tsx
  • src/renderer/src/runtime/native-desktop-frame-edits.test.ts
  • src/renderer/src/runtime/native-desktop-frame-edits.ts
  • src/renderer/src/runtime/workspace-layout-frame-builds.ts
  • src/renderer/src/runtime/workspace-layout-frame-drawn-workspaces.ts
  • src/renderer/src/runtime/workspace-layout-frame-sync.ts
  • src/renderer/src/store/slices/browser/browser-hydration-state.ts
  • src/renderer/src/web/main.tsx
  • src/renderer/src/web/preload-api/web-ui-api.ts
  • src/renderer/src/web/web-launch-worktree-target.test.ts
  • src/renderer/src/web/web-launch-worktree-target.ts
  • src/renderer/src/web/web-pairing.test.ts
  • src/renderer/src/web/web-pairing.ts
  • src/shared/desktop-window-state-types.ts
  • src/shared/desktop-window-tab-order.test.ts
  • src/shared/desktop-window-tab-order.ts
  • src/shared/desktop-window-worktree-identity.ts
  • src/shared/keybindings/definitions-core-4.ts
  • src/shared/keybindings/types.ts
  • src/shared/native-desktop-window-argument.ts
  • src/shared/persisted-ui-state-types.ts
  • src/shared/runtime-client-window-fragment.ts
  • src/shared/runtime-client-window-open-result.ts
  • src/shared/wsl-move/wsl-move-ui-dispositions.ts
  • tests/e2e/helpers/native-desktop-window.ts
  • tests/e2e/native-desktop-browser-ownership.spec.ts
  • tests/e2e/native-desktop-concurrency.spec.ts
  • tests/e2e/native-desktop-editor.spec.ts
  • tests/e2e/native-desktop-peer-reorder.spec.ts
  • tests/e2e/native-desktop-skills.spec.ts
  • tests/e2e/native-desktop-watchers.spec.ts
  • tests/e2e/runtime-client-window.spec.ts
  • tests/e2e/terminal-layout-parity-snapshot.ts
  • tests/e2e/terminal-layout-parity-snapshot.unit.test.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.

@LuweiLiao

Copy link
Copy Markdown
Author

Pushed the CodeRabbit corrections in b3066538a2dcce92e89259be3494f302280c7ebe. The nine inline replies now describe changes present in this PR branch. The earlier two local-only replies have been updated to reference this commit. Threads remain open for review.

The additional PTY-exit finding in the review body is also fixed: exit removes the PTY's driver, all per-window hints, aggregated visibility/active state, and delivery interest before an ID can be reused. A passing exit/respawn regression verifies that the previous driver no longer blocks another window's replies or resize.

Validation:

  • 268 tests passed across 21 edited/directly dependent unit-test files; all four Bun typecheck projects passed.
  • Changed-code quality checks reported no new findings. Electron and CLI builds, formatting, and the E2E type ratchet passed. The commit hooks also passed after moving lifecycle wiring and New Window tests into focused files to satisfy the file-size rules.
  • The eight hidden Windows Electron scenarios previously produced seven passes and one temporary-profile cleanup EPERM after the restore behavior assertions completed. That same restore scenario passed in an isolated rerun. The rebuilt app also passed the two-window profile/reload/recovery scenario after the final lifecycle extraction. The original failure and rerun records are retained; this is not a claim of an all-green combined run or full cross-platform CI.

Left unchanged for now: the WSL desktopWindows rewrite integration (the move feature is gated off and rewrite registration needs separate integration), full-session clone optimization (snapshot isolation is retained; no performance measurement justifies changing it yet), and blanket docstring coverage (the repository asks for concise comments where needed).

This pushes the source/test corrections. It does not merge the PR or replace an installed application.

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 2


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: efbe3150-82ac-4b06-a3f9-06a41443f01e
Commits

Reviewing files that changed from the base of the PR and between d8f42ca and b306653.

Files selected for processing: 48
  • src/main/browser/browser-certificate-trust-controller.test.ts
  • src/main/browser/browser-certificate-trust-controller.ts
  • src/main/browser/browser-client-page-command-executor-test-harness.ts
  • src/main/browser/browser-client-page-profile-switch.test.ts
  • src/main/browser/browser-client-page-profile-switch.ts
  • src/main/browser/browser-guest-shortcut-dispatch.ts
  • src/main/browser/browser-guest-shortcut-forwarding.test.ts
  • src/main/browser/browser-manager-native-guests.ts
  • src/main/browser/browser-manager-native-viewport.test.ts
  • src/main/browser/browser-manager-queries.ts
  • src/main/browser/browser-manager-state.ts
  • src/main/browser/browser-manager-viewport-scroll-state.ts
  • src/main/browser/browser-manager-viewport.ts
  • src/main/ipc/browser-guest-view-ipc.ts
  • src/main/ipc/browser-guest-view-native-renderer-scope.test.ts
  • src/main/ipc/browser-native-registration.test-fixture.ts
  • src/main/ipc/browser-preview-tool-authorization.test.ts
  • src/main/ipc/browser.test.ts
  • src/main/ipc/browser.ts
  • src/main/ipc/pty/delivery/accept.ts
  • src/main/ipc/pty/delivery/native-desktop-delivery.test.ts
  • src/main/ipc/pty/delivery/native-desktop-delivery.ts
  • src/main/ipc/pty/delivery/pending.ts
  • src/main/ipc/pty/session.ts
  • src/main/ipc/runtime.test.ts
  • src/main/ipc/runtime.ts
  • src/main/window/main-window-shortcut-actions.test.ts
  • src/main/window/main-window-shortcut-actions.ts
  • src/main/window/main-window-shortcut-routing-new-window.test.ts
  • src/main/window/main-window-shortcut-routing.ts
  • src/main/window/native-desktop-notifier-readiness.test.ts
  • src/main/window/native-desktop-notifier-readiness.ts
  • src/main/window/native-desktop-notifier-reload.test.ts
  • src/main/window/native-desktop-notifiers.test.ts
  • src/main/window/native-desktop-notifiers.ts
  • src/main/window/native-desktop-windows.test.ts
  • src/main/window/native-desktop-windows.ts
  • src/main/window/runtime-renderer-lifecycle.ts
  • src/main/window/runtime-window-lifecycle-native-graphs.test.ts
  • src/main/window/runtime-window-lifecycle-notifier-readiness.test.ts
  • src/main/window/runtime-window-lifecycle.ts
  • src/preload/api/runtime-api.ts
  • src/preload/api/runtime-bridge.ts
  • src/renderer/src/hooks/ipc-events/app-lifetime-ipc-bridge.ts
  • src/shared/window-shortcut-policy-new-window.test.ts
  • src/shared/window-shortcut-policy.ts
  • tests/e2e/native-desktop-profile-notifications.spec.ts
  • tests/e2e/native-desktop-watchers.spec.ts
Files skipped from review as they are similar to previous changes: 7
  • src/main/window/native-desktop-windows.test.ts
  • src/main/ipc/runtime.ts
  • src/main/window/runtime-window-lifecycle.ts
  • src/main/window/native-desktop-notifiers.test.ts
  • src/main/window/native-desktop-notifiers.ts
  • src/main/ipc/browser.test.ts
  • src/main/window/native-desktop-windows.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.

Comment thread src/main/ipc/browser.ts Resolved
@LuweiLiao

LuweiLiao commented Oct 24, 2026 •

Copy link
Copy Markdown
Author

Pushed the tested follow-up in 8c5a6fad47939f86c73bd8022f75c6aed6cc4cb5. This replaces 43d69f3eec1f37811425e291cda05a475f3fa58d solely to correct author and committer to Luviewer <[email protected]>; the source tree is identical.

This fixes the three outstanding code findings: guest New Window repeat consumption, non-native unregister grab cleanup, and the missing per-window WSL desktop rewrite. It also fixes a Linux multi-window editor regression found during runtime testing: stale peer frames could restore closed file records, and retaining an unsaved draft could switch the active view away from that draft.

Local verification on Ubuntu x86_64:

  • Changed-area unit suite: 54 files, 696 passed, 2 skipped. Separately, the focused browser suite passed 105 tests and the WSL/persistence suite passed 33 tests; these suites contain overlapping tests, so the counts should not be summed.
  • pnpm tc, changed-code quality gate (14 files, zero new findings), and a fresh build:electron-vite --mode e2e: passed. Commit hooks also passed.
  • Real Electron on an isolated Xvfb display, with ORCA_BACKGROUND_LAUNCH=1 and hidden windows: 12/12 passed. Coverage includes four-window terminal input, closing the first window, open-window restoration with individual selections/bounds, unsaved editor drafts and saving, shared browser guest ownership, peer tab changes, skills, and external folder/worktree watchers.
  • Browser lifecycle cases repeated three times each: 6/6 passed. Watcher cases repeated three times each: 6/6 passed.

The runtime runs also exposed two test setup races. The watcher setup now polls the language setting instead of awaiting a renderer promise that can be collected during setup. The browser readiness check now reuses the existing targeted dom-ready retry logic instead of failing before the guest attaches. The final complete 12-test run passed after these changes; earlier failed runs were retained in the local evidence.

These results apply to the source tree committed above. Earlier packaged Linux smoke tests predate this follow-up and do not validate its new browser/WSL changes. Actual Windows/WSL, macOS, physical desktop focus, Wayland/IME and live mixed-version remote execution remain untested here. GitHub CI/re-review should be evaluated separately from these local results. Later follow-up added real guest-input Electron regression coverage in 6b1a281a4819c6e2f4912fc595d5f04052118dff: 14/14 multi-window tests and 6/6 repeated shortcut cases passed. CodeRabbit confirmed the WSL, guest-repeat and unregister fixes. All 12 existing review threads are now resolved; I resolved the original missing-shortcut-route thread after its earlier reviewer acknowledgement and the added runtime evidence, retaining the physical-focus limitation. A new review of the latest test commit was requested and remains unconfirmed. I have not merged the PR.

@LuweiLiao
LuweiLiao force-pushed the feat/native-desktop-multi-window branch from 43d69f3 to 8c5a6fa Compare October 24, 2026 17:18
@LuweiLiao

LuweiLiao commented Oct 24, 2026 •

Copy link
Copy Markdown
Author

Follow-up check completed and additional runtime coverage pushed in 6b1a281a4819c6e2f4912fc595d5f04052118dff.

CodeRabbit's completed review of the prior production fix reported no new actionable comments and explicitly confirmed the WSL desktop-window rewrite. The remaining shortcut thread had been kept open at my earlier request for verification. I have now added actual guest-input Electron cases for the default and custom New Window bindings, including three held-key repeat events, production event prevention and exactly one additional rendered native window.

Verification: 14/14 multi-window Electron tests passed; the new two-case shortcut set passed 6/6 across three repetitions. Typecheck, changed-code quality checks (three files, zero new findings) and commit hooks passed. The existing 696-pass unit run still applies to the unchanged production code; this follow-up changes only E2E tests and their reused native-window page selector. All app runs used hidden windows, ORCA_BACKGROUND_LAUNCH=1, and an isolated Xvfb display. Physical desktop/compositor focus is not certified.

As requested, all commits in this PR now use author and committer Luviewer <[email protected]>. The previous 43d69f3eec1f37811425e291cda05a475f3fa58d became 8c5a6fad47939f86c73bd8022f75c6aed6cc4cb5 solely for that metadata correction; their source trees are identical. The earlier author replies have been updated to preserve this provenance. No PR merge has been performed.

Review-thread status update: all 12 existing threads are now resolved. CodeRabbit confirmed the WSL, guest-repeat and unregister fixes. I resolved the last original missing-shortcut-route thread after its earlier reviewer acknowledgement and the new passing guest-input runtime tests; the physical-focus limitation is retained in the thread. A separate review request for the latest test commit has been posted, but a new completed review of that commit has not yet returned. This status does not certify the absence of future findings or full cross-platform CI.

@LuweiLiao

Copy link
Copy Markdown
Author

@coderabbitai review

Please review the current head 6b1a281a4819c6e2f4912fc595d5f04052118dff, including the new real guest-input shortcut regressions, and recheck the remaining shortcut thread against its original missing-resolver/dispatch finding. The production-fix author metadata was corrected without changing its source tree. The full 14-case Linux Electron run and six repeated shortcut cases passed; physical desktop focus remains explicitly unverified.

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 1


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: 88cfdab6-2114-4f8a-b1fd-c5849d6e3ca8
Commits

Reviewing files that changed from the base of the PR and between 8c5a6fa and 6b1a281.

Files selected for processing: 3
  • tests/e2e/helpers/native-desktop-window.ts
  • tests/e2e/native-desktop-window-shortcuts.spec.ts
  • tests/e2e/runtime-client-window.spec.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.

@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Already reviewed the last commit. Use @coderabbitai full review to rerun a review of the entire changeset.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@LuweiLiao

Copy link
Copy Markdown
Author

@coderabbitai full review

Please review the current head 39612f50db3ea0caaf2f0fb2096b33d8c3625b31 and recheck the renderer-environment finding. The new fixture fix clears ELECTRON_RENDERER_URL in the ordinary launcher, restart launcher (after caller overlays), and launchUntilExit.

This head also merges upstream main at 42f59f34604c56ca2b80235b080660c2080d317d. The single import conflict in client-ui.ts was resolved by retaining both upstream quick-command capability validation and this PR's desktop-window state isolation. An independent read-only agent reviewed the actual merge result and the three launch paths without finding a confirmed additional defect.

Verification on Linux:

  • The environment failure was reproduced before the fix. With ELECTRON_RENDERER_URL=http://127.0.0.1:59999, lifecycle tests passed twice (6/6) after the fix.
  • Fresh current-head E2E build and the complete 15-case multi-window Electron run passed with the same polluted environment, including profile notifications across reload. All windows stayed hidden on isolated Xvfb with ORCA_BACKGROUND_LAUNCH=1.
  • Integrated changed/dependent unit tests: 63 files, 840 passed and 2 skipped. This includes upstream quick-command capability and paired UI-state tests.
  • Typecheck, PR-wide changed-code quality gate (209 source files, zero new findings), diff checks and commit hooks passed.

New commits retain author and committer Luviewer <[email protected]>. Existing public feature commits were preserved. This does not merge the PR. Actual Windows/WSL, macOS, physical focus, Wayland/IME, packaged-installation and mixed-version remote qualification remain outside these Linux results. Please report any further actionable findings against this head.

@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Full review finished.

@LuweiLiao

Copy link
Copy Markdown
Author

Upstream integration follow-up for current head cb163518faf707c0d5086d1bbfa3a189d23fc5ce.

GitHub reported this PR as conflicting while it had advanced beyond the previously merged base 42f59f3460. I fetched upstream main and reproduced one actual content conflict against 62d9706c5a: src/main/browser/browser-manager-registration.ts. The resolution retains the PR's guest-specific browser prompt cleanup, which protects peer native windows, and upstream's new audio-state reset. Both behaviors remain in the merged source. Upstream later advanced to 8e9f86b119; that merge was clean. The two integration commits are 7a5475649c and cb163518fa; both are authored and committed by Luviewer <[email protected]>, while upstream commits retain their original authors.

The new upstream layout also moved the PTY hidden-delivery gate and persistence test harness. I corrected two stale relative imports found by typecheck. A native-guest test initially failed because it treated upstream's legitimate browser:audio-state-changed notification as unwanted peer shortcut traffic; its assertion now checks the actual ui:focusBrowserAddressBar routing. No product shortcut behavior was relaxed.

Validation on Linux for the merged source:

  • Four TypeScript projects: passed after the import corrections, including the final 8e9f86b119 merge.
  • Browser guest, page prompt, PTY delivery and desktop-window persistence tests: 73/73 passed across seven files.
  • Fresh E2E Electron build and CLI build: passed. The complete 15-case native multi-window Electron set passed twice, including 15/15 on final head cb163518fa. The final run used isolated Xvfb, hidden Playwright/CDP renderers, ORCA_BACKGROUND_LAUNCH=1, disposable profiles and an intentionally polluted ELECTRON_RENDERER_URL=http://127.0.0.1:59999.
  • Focused oxlint and commit hooks: passed. The worktree is clean.

The final Electron run covers four windows and terminal input after the first closes, window restore and bounds, browser guest ownership, concurrent edits, unsaved drafts, shortcuts, profile notifications, skills and external filesystem changes. This is Linux source/runtime evidence, not Windows/macOS, physical desktop focus, Wayland/IME, packaged-installation or full CI certification.

GitHub now reports this head MERGEABLE with no unresolved review threads (13/13 resolved). The PR base currently shown by GitHub is 8e9f86b119. Upstream subsequently added 3d24e61726; a local merge-tree check against it also completed without conflicts. GitHub Actions require their own evaluation: the prior head's seven workflows were awaiting maintainer approval, and clean alone is not the full test matrix. The PR remains open and was not merged.

@coderabbitai full review

Please review the new head and the guest cleanup/audio-state conflict resolution, including the upstream integration import and test changes. Report any actionable findings against this SHA.

@coderabbitai

coderabbitai Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Full review finished.

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 3


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: a1e0c6de-6773-4515-9a4a-b1356efbf364
Commits

Reviewing files that changed from the base of the PR and between 8e9f86b and cb16351.

Files selected for processing: 216
  • src/main/browser/agent-browser-bridge-core-commands.ts
  • src/main/browser/agent-browser-bridge-lifecycle.ts
  • src/main/browser/agent-browser-bridge-navigation.test.ts
  • src/main/browser/agent-browser-bridge-queue.ts
  • src/main/browser/agent-browser-bridge-session-lifecycle.test.ts
  • src/main/browser/agent-browser-bridge-shutdown.ts
  • src/main/browser/agent-browser-bridge-state.ts
  • src/main/browser/agent-browser-bridge-tabs.ts
  • src/main/browser/agent-browser-bridge-types.ts
  • src/main/browser/browser-certificate-trust-controller.test.ts
  • src/main/browser/browser-certificate-trust-controller.ts
  • src/main/browser/browser-client-page-command-executor-test-harness.ts
  • src/main/browser/browser-client-page-profile-switch.test.ts
  • src/main/browser/browser-client-page-profile-switch.ts
  • src/main/browser/browser-client-page-renderer-bridge.test.ts
  • src/main/browser/browser-client-page-renderer-bridge.ts
  • src/main/browser/browser-client-page-renderer-runtime.ts
  • src/main/browser/browser-guest-shortcut-dispatch.ts
  • src/main/browser/browser-guest-shortcut-forwarding.test.ts
  • src/main/browser/browser-manager-bindings.ts
  • src/main/browser/browser-manager-destroyed-guest-test-fixture.ts
  • src/main/browser/browser-manager-download-lifecycle.ts
  • src/main/browser/browser-manager-event-forwarding.ts
  • src/main/browser/browser-manager-final.ts
  • src/main/browser/browser-manager-grab.ts
  • src/main/browser/browser-manager-guest-cleanup.ts
  • src/main/browser/browser-manager-guest-navigation-policy.ts
  • src/main/browser/browser-manager-guest-popup-policy.ts
  • src/main/browser/browser-manager-native-guests.test.ts
  • src/main/browser/browser-manager-native-guests.ts
  • src/main/browser/browser-manager-native-viewport.test.ts
  • src/main/browser/browser-manager-navigation.ts
  • src/main/browser/browser-manager-queries.ts
  • src/main/browser/browser-manager-registration.ts
  • src/main/browser/browser-manager-state.ts
  • src/main/browser/browser-manager-viewport-ownership.test.ts
  • src/main/browser/browser-manager-viewport-scroll-state.ts
  • src/main/browser/browser-manager-viewport.ts
  • src/main/browser/browser-manager-visibility.ts
  • src/main/browser/browser-page-prompts.ts
  • src/main/browser/browser-popup-compatibility-manager-fixture.ts
  • src/main/browser/browser-webauthn-account-picker.test.ts
  • src/main/browser/browser-webauthn-account-picker.ts
  • src/main/host/electron-runtime-desktop-surface.ts
  • src/main/ipc/automations.ts
  • src/main/ipc/browser-annotation-viewport-ipc.test.ts
  • src/main/ipc/browser-client-page-metadata-ipc.test.ts
  • src/main/ipc/browser-guest-view-ipc.ts
  • src/main/ipc/browser-guest-view-native-renderer-scope.test.ts
  • src/main/ipc/browser-native-registration.test-fixture.ts
  • src/main/ipc/browser-preview-tool-authorization.test.ts
  • src/main/ipc/browser-renderer-selection.ts
  • src/main/ipc/browser-renderer-trust.ts
  • src/main/ipc/browser-session-profile-ipc.test.ts
  • src/main/ipc/browser.test.ts
  • src/main/ipc/browser.ts
  • src/main/ipc/folder-repo-git-upgrade.test.ts
  • src/main/ipc/folder-repo-git-upgrade.ts
  • src/main/ipc/pty/delivery/accept.ts
  • src/main/ipc/pty/delivery/accounting.ts
  • src/main/ipc/pty/delivery/native-desktop-delivery.test.ts
  • src/main/ipc/pty/delivery/native-desktop-delivery.ts
  • src/main/ipc/pty/delivery/payload.ts
  • src/main/ipc/pty/delivery/pending.ts
  • src/main/ipc/pty/delivery/wire-session.ts
  • src/main/ipc/pty/ipc/renderer-delivery-credit.ts
  • src/main/ipc/pty/ipc/resize-visibility.ts
  • src/main/ipc/pty/ipc/write-input.ts
  • src/main/ipc/pty/ipc/write.ts
  • src/main/ipc/pty/register-handlers.ts
  • src/main/ipc/pty/session.ts
  • src/main/ipc/register-core-handlers/register-core-handlers.test.ts
  • src/main/ipc/register-core-handlers/register-core-handlers.ts
  • src/main/ipc/renderer-shutdown-checkpoint.ts
  • src/main/ipc/repos/repo-clone-lifecycle.ts
  • src/main/ipc/repos/repo-folder-picker-handlers.ts
  • src/main/ipc/repos/repos-changed-notification.ts
  • src/main/ipc/repos/sparse-preset-handlers.ts
  • src/main/ipc/runtime-client-window.ts
  • src/main/ipc/runtime.test.ts
  • src/main/ipc/runtime.ts
  • src/main/ipc/session.ts
  • src/main/ipc/skill-ipc-main-window.test.ts
  • src/main/ipc/skill-ipc-main-window.ts
  • src/main/ipc/ui.ts
  • src/main/ipc/worktree-base-directory-watcher.test.ts
  • src/main/ipc/worktree-base-directory-watcher.ts
  • src/main/ipc/worktree-remote.ts
  • src/main/menu/app-menu-shortcut-label.ts
  • src/main/menu/app-menu-window.ts
  • src/main/menu/register-app-menu.test.ts
  • src/main/menu/register-app-menu.ts
  • src/main/persistence/desktop-window-session-writes.test.ts
  • src/main/persistence/desktop-window-session-writes.ts
  • src/main/persistence/desktop-window-state.test.ts
  • src/main/persistence/desktop-window-state.ts
  • src/main/persistence/moving-wsl-projects/wsl-move-desktop-windows.ts
  • src/main/persistence/tracking-repos/worktree-identity-migration-field-coverage.test.ts
  • src/main/persistence/tracking-repos/worktree-identity-migration.ts
  • src/main/rate-limits/service/service-state.ts
  • src/main/runtime/native-desktop-window-graphs.test.ts
  • src/main/runtime/native-desktop-window-graphs.ts
  • src/main/runtime/rpc/methods/client-ui-pairing-local-fields.test.ts
  • src/main/runtime/rpc/methods/client-ui.ts
  • src/main/runtime/rpc/methods/ui-state-schema-parity-checks.ts
  • src/main/ssh/targets/ssh-target-id-migration.test.ts
  • src/main/ssh/targets/ssh-target-id-migration.ts
  • src/main/startup/main-process-i18n-menu.ts
  • src/main/startup/main-process-ready-foundation.ts
  • src/main/startup/main-process-runtime-launch.ts
  • src/main/startup/main-window-agent-status.ts
  • src/main/startup/main-window-controller.ts
  • src/main/startup/main-window-core-services.ts
  • src/main/updater/updater-install-execution.ts
  • src/main/updater/updater-mac-install-preflight.ts
  • src/main/updater/updater-nudge.ts
  • src/main/updater/updater-state.ts
  • src/main/updater/updater-status.ts
  • src/main/window/attach-main-window-services.ts
  • src/main/window/clipboard-ipc-handlers.ts
  • src/main/window/createMainWindow-close-confirmation.test.ts
  • src/main/window/createMainWindow-markdown-editor-focus.test.ts
  • src/main/window/createMainWindow-tray-minimize-close.test.ts
  • src/main/window/createMainWindow.ts
  • src/main/window/dashboard-popout-window.ts
  • src/main/window/desktop-renderer-registry.test.ts
  • src/main/window/desktop-renderer-registry.ts
  • src/main/window/dropped-path-preparation-ipc.test.ts
  • src/main/window/dropped-path-preparation-ipc.ts
  • src/main/window/main-window-close-lifecycle.ts
  • src/main/window/main-window-contracts.ts
  • src/main/window/main-window-shortcut-actions.test.ts
  • src/main/window/main-window-shortcut-actions.ts
  • src/main/window/main-window-shortcut-routing-new-window.test.ts
  • src/main/window/main-window-shortcut-routing.ts
  • src/main/window/main-window-state-lifecycle.ts
  • src/main/window/main-window-worktree-watchers.test.ts
  • src/main/window/main-window-worktree-watchers.ts
  • src/main/window/native-desktop-automations.test.ts
  • src/main/window/native-desktop-automations.ts
  • src/main/window/native-desktop-notifier-readiness.test.ts
  • src/main/window/native-desktop-notifier-readiness.ts
  • src/main/window/native-desktop-notifier-reload.test.ts
  • src/main/window/native-desktop-notifiers.test.ts
  • src/main/window/native-desktop-notifiers.ts
  • src/main/window/native-desktop-windows.test.ts
  • src/main/window/native-desktop-windows.ts
  • src/main/window/native-window-controls.test.ts
  • src/main/window/native-window-controls.ts
  • src/main/window/native-window-service-handlers.ts
  • src/main/window/runtime-client-window-open-command.ts
  • src/main/window/runtime-client-window-records.ts
  • src/main/window/runtime-renderer-lifecycle.ts
  • src/main/window/runtime-window-lifecycle-native-graphs.test.ts
  • src/main/window/runtime-window-lifecycle-notifier-readiness.test.ts
  • src/main/window/runtime-window-lifecycle.ts
  • src/main/window/window-zoom-shortcuts.ts
  • src/preload/api/runtime-api.ts
  • src/preload/api/runtime-bridge.ts
  • src/preload/api/ui-bridge-clipboard-and-window-controls.ts
  • src/preload/api/ui-window-api.ts
  • src/preload/index.ts
  • src/renderer/src/app-shell/reconcile-hydrated-workspace-tab-models.ts
  • src/renderer/src/app-shell/use-global-keybindings.ts
  • src/renderer/src/components/sidebar/WorktreeContextMenuView.tsx
  • src/renderer/src/components/sidebar/WorktreeOpenInNewWindowMenuItem.tsx
  • src/renderer/src/env.d.ts
  • src/renderer/src/hooks/ipc-events/app-lifetime-ipc-bridge.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/fr.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/pt.json
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/lib/open-runtime-client-window.ts
  • src/renderer/src/main.tsx
  • src/renderer/src/runtime/native-desktop-frame-edits.test.ts
  • src/renderer/src/runtime/native-desktop-frame-edits.ts
  • src/renderer/src/runtime/workspace-layout-frame-builds.ts
  • src/renderer/src/runtime/workspace-layout-frame-drawn-workspaces.ts
  • src/renderer/src/runtime/workspace-layout-frame-sync.ts
  • src/renderer/src/store/slices/browser/browser-hydration-state.ts
  • src/renderer/src/web/main.tsx
  • src/renderer/src/web/preload-api/web-ui-api.ts
  • src/renderer/src/web/web-launch-worktree-target.test.ts
  • src/renderer/src/web/web-launch-worktree-target.ts
  • src/renderer/src/web/web-pairing.test.ts
  • src/renderer/src/web/web-pairing.ts
  • src/shared/desktop-window-state-types.ts
  • src/shared/desktop-window-tab-order.test.ts
  • src/shared/desktop-window-tab-order.ts
  • src/shared/desktop-window-worktree-identity.ts
  • src/shared/keybindings/definitions-core-4.ts
  • src/shared/keybindings/types.ts
  • src/shared/native-desktop-window-argument.ts
  • src/shared/persisted-ui-state-types.ts
  • src/shared/runtime-client-window-fragment.ts
  • src/shared/runtime-client-window-open-result.ts
  • src/shared/window-shortcut-policy-new-window.test.ts
  • src/shared/window-shortcut-policy.ts
  • src/shared/wsl-move/wsl-move-ui-dispositions.ts
  • tests/e2e/helpers/native-desktop-window.ts
  • tests/e2e/helpers/orca-app.ts
  • tests/e2e/helpers/orca-restart.ts
  • tests/e2e/native-desktop-browser-ownership.spec.ts
  • tests/e2e/native-desktop-concurrency.spec.ts
  • tests/e2e/native-desktop-editor.spec.ts
  • tests/e2e/native-desktop-peer-reorder.spec.ts
  • tests/e2e/native-desktop-profile-notifications.spec.ts
  • tests/e2e/native-desktop-skills.spec.ts
  • tests/e2e/native-desktop-watchers.spec.ts
  • tests/e2e/native-desktop-window-shortcuts.spec.ts
  • tests/e2e/runtime-client-window.spec.ts
  • tests/e2e/terminal-layout-parity-snapshot.ts
  • tests/e2e/terminal-layout-parity-snapshot.unit.test.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.

Comment on lines +28 to +35
private captureNativePage(pageId: string): GuestState[] {
return [
capture(this.contextMenuCleanupByTabId, pageId),
capture(this.grabShortcutCleanupByTabId, pageId),
capture(this.shortcutForwardingCleanupByTabId, pageId),
capture(this.mouseWheelZoomCleanupByTabId, pageId)
]
}

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 · Functional Correctness · Quick win

🔎 Supported by static analysis

Script executed:

#!/bin/bash
rg -nP -C3 '\btargetUrlCleanupByTabId\b' src/main/browser
rg -nP -C6 'setupGuestTargetUrlForwarding' src/main/browser

Repository: stablyai/orca

Length of output: 8415


Script executed:

# Full native guests file with line numbers.
nl -ba src/main/browser/browser-manager-native-guests.ts

# Callers and definitions for the premises in the review comment.
rg -n -F --glob '*.ts' -e 'setupTargetUrlForwarding' -e 'resolveRendererForBrowserTab' -e 'getRendererContextForGuest' -e 'captureNativePage' -e 'stashNativePage' -e 'restoreNativePeer' -e 'selectNativeGuest' -e 'registerGuest' -- src/main/browser || test "$?" -eq 1

# Type of the renderer resolver.
rg -n -F --glob '*.ts' -e 'ResolveRenderer' -- src/main/browser || test "$?" -eq 1
nl -ba src/main/browser/browser-guest-renderer-target.ts

Repository: stablyai/orca

Length of output: 42052


Carry target-URL forwarding through native guest switches.

captureNativePage omits targetUrlCleanupByTabId, so switching native guests leaves the target-URL listener of the wrong guest attached to the page.

When a guest registers on a different renderer, or with retainPreviousGuestPolicies, rememberNativeGuest stashes the current guest's state. The stash does not detach the target-URL entry. registerGuest then calls setupTargetUrlForwarding, which runs the existing page entry before it installs the new guest's listener. That entry still belongs to the previous guest, so the previous guest's target-url listener is removed.

When the new guest unregisters, restoreNativePeer reselects the previous guest. selectNativeGuest restores only the captured state, which has no target-URL entry. The previous guest's listener is not reinstalled.

setupTargetUrlForwarding also resolves the renderer with the tab-level resolveRendererForBrowserTab(tabId). The other forwarding bindings resolve from the guest. Because selectNativeGuest points the tab's renderer mapping at the selected guest, a hover URL from one guest can be sent to the other guest's window.

Include the map in the captured state. Resolve the renderer from the guest, as the sibling bindings already do.

Proposed fix

In src/main/browser/browser-manager-native-guests.ts:

       capture(this.shortcutForwardingCleanupByTabId, pageId),
-      capture(this.mouseWheelZoomCleanupByTabId, pageId)
+      capture(this.mouseWheelZoomCleanupByTabId, pageId),
+      capture(this.targetUrlCleanupByTabId, pageId)
     ]

In src/main/browser/browser-manager-bindings.ts:

-        resolveRenderer: (tabId) => this.resolveRendererForBrowserTab(tabId)
+        resolveRenderer: () => this.getRendererContextForGuest(guest.id)?.renderer ?? null

Comment on lines +116 to +144
await expect
.poll(
() => page.evaluate(() => Number(document.documentElement.dataset.nativeStructureChanges)),
{ timeout: 30_000 }
)
.toBeGreaterThan(0)
await page.evaluate(() => {
document.documentElement.dataset.nativeStatusChanges = '0'
})
const refreshed = await runProcess({
program: 'git',
args: [
'-c',
'user.name=Native Test',
'-c',
'[email protected]',
'commit',
'--allow-empty',
'-m',
'Native watcher metadata'
],
cwd: seededRepoPath
})
expect(refreshed.code, refreshed.stderr).toBe(0)
await expect
.poll(() => page.evaluate(() => Number(document.documentElement.dataset.nativeStatusChanges)), {
timeout: 30_000
})
.toBeGreaterThan(0)

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 · Maintainability & Code Quality · Quick win

Assert the external worktree in the surviving window's DOM.

The second test counts worktrees.onChanged and onGitStatusMetadataChanged IPC callbacks through dataset counters. It makes no assertion on rendered output. If the surviving window receives the events but its sidebar does not render the new native-external worktree, this test still passes.

Keep the counters for synchronization. Then assert that the sidebar of page shows the new worktree, for example with getByRole or a data-worktree-sidebar row locator and toBeVisible().

As per coding guidelines: "Use window.__store for setup; assert user-visible behavior through the DOM (getByRole, toBeVisible, toHaveText). Writing state and reading it back cannot catch broken rendering. This applies to hidden CDP-driven renderers too."

Source: Coding guidelines

Comment on lines +187 to +198
await expect
.poll(async () =>
Promise.all(
restoredPages.map((page) =>
page.evaluate(() => ({
id: window.__ORCA_NATIVE_WINDOW_ID__,
worktree: window.__store?.getState().activeWorktreeId
}))
)
)
)
.toEqual(expect.arrayContaining(expected))

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 · Functional Correctness · Quick win

Assert the restored workspace selection through the DOM, not only through window.__store.

The restore test reads activeWorktreeId from each restored renderer store. A store read can pass when the restored window does not render the selected workspace. The file already has expectWorkspace, which checks data-rendered-active-worktree-id. Use it for each restored page after the window ID mapping is known.

Proposed change
       .toEqual(expect.arrayContaining(expected))
+    for (const page of restoredPages) {
+      const id = await page.evaluate(() => window.__ORCA_NATIVE_WINDOW_ID__)
+      const worktree = expected.find((entry) => entry.id === id)?.worktree
+      if (worktree) {
+        await expectWorkspace(page, worktree)
+      }
+    }

As per coding guidelines: "Use window.__store for setup; assert user-visible behavior through the DOM (getByRole, toBeVisible, toHaveText). Writing state and reading it back cannot catch broken rendering."

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
await expect
.poll(async () =>
Promise.all(
restoredPages.map((page) =>
page.evaluate(() => ({
id: window.__ORCA_NATIVE_WINDOW_ID__,
worktree: window.__store?.getState().activeWorktreeId
}))
)
)
)
.toEqual(expect.arrayContaining(expected))
await expect
.poll(async () =>
Promise.all(
restoredPages.map((page) =>
page.evaluate(() => ({
id: window.__ORCA_NATIVE_WINDOW_ID__,
worktree: window.__store?.getState().activeWorktreeId
}))
)
)
)
.toEqual(expect.arrayContaining(expected))
for (const page of restoredPages) {
const id = await page.evaluate(() => window.__ORCA_NATIVE_WINDOW_ID__)
const worktree = expected.find((entry) => entry.id === id)?.worktree
if (worktree) {
await expectWorkspace(page, worktree)
}
}

Source: Coding guidelines

@neogent-dev

Copy link
Copy Markdown

@brennanb2025 any plans of actually merging this? This is a highly requested basic feature

This branch has not been deployed

No deployments
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.

[Feature]: Multiple windows

2 participants