Skip to content

Add experimental multi-window support - #5329

Open
brennanb2025 wants to merge 13 commits into
mainfrom
brennanb2025/multi-window-monitor-support
Open

brennanb2025 wants to merge 13 commits into
mainfrom
brennanb2025/multi-window-monitor-support

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Jun 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds experimental multi-window support for multiple-monitor workflows behind a default-off setting. The main-process policy reads the setting at startup, keeps the legacy singleton behavior when the flag is off, and only exposes File > New Window after restart when the experimental flag is enabled.

The implementation adds a main-window registry/open policy, routes menu/window services through the owning window, and scopes runtime, browser, PTY, and SSH shared state so non-owner windows cannot mutate or read owner-scoped terminal/runtime metadata.

Brennan YOLO Lite pipeline

  • Design doc: /tmp/orca-kelp-multi-window-readiness-design.md
  • Design review: clean after one review/fix iteration; tightened forced-off singleton behavior, restart gating, owner-window invariants, duplicate-id ownership, PTY/browser/SSH shared-state boundaries, and live SSH validation gates.
  • Implementation completeness: verified against the design; default-off policy, restart gate, owner routing, and risky IPC seams are covered.
  • Code review loop:
    • Earlier reviewer findings fixed: direct runtime IPC driver reads/mutations were sender-window scoped; PTY metadata handlers were sender-owner gated.
    • Final clean round: two independent packet-based review-code subagents returned CLEAN for default-off/restart-gated behavior and shared-state owner safety. Tool-backed Claude/Codex review attempts were flaky/silent, so the clean round used source packets from the current tree with tools disabled.

Tests

  • pnpm exec vitest run --config config/vitest.config.ts src/main/window/main-window-registry.test.ts src/main/window/main-window-open-policy.test.ts src/main/window/createMainWindow.test.ts src/main/window/attach-main-window-services.test.ts src/main/menu/register-app-menu.test.ts src/main/ipc/pty.test.ts src/main/runtime/orca-runtime.test.ts src/main/runtime/orca-runtime-browser.test.ts src/main/ipc/browser.test.ts src/main/ipc/runtime.test.ts src/main/ipc/ssh.test.ts src/renderer/src/components/settings/ExperimentalPane.test.tsx src/shared/constants.test.ts — 675 passed, 1 skipped.
  • pnpm run typecheck
  • pnpm run lint
  • git diff --check origin/main...HEAD
  • pnpm build:relay
  • Electron validation from the exact PR worktree (/Users/thebr/orca/workspaces/orca/kelp, branch brennanb2025/multi-window-monitor-support) with isolated user data:
    • Verified window.api.app.getIdentity() points at this branch/root.
    • Verified experimentalMultiWindow defaults false in a fresh profile.
    • Registered local demo-project and verified it appears visibly in the app.
    • Clicked the real Settings > Experimental Multi-window switch; verified the switch becomes checked and the visible “Restart required” banner appears.
    • Relaunched with the persisted flag enabled; Brennan clicked native File > New Window; verified CDP saw two real Orca renderer pages/windows, both on this PR worktree and both sharing the isolated demo-project profile state.
    • Console/app logs showed no relevant branch-caused renderer errors; dev-only React Grab/keychain/notification warnings were observed.
  • Live SSH validation with brennan-test-ssh shape:
    • Restarted Docker Desktop when docker info hung.
    • Built relay, started a throwaway Ubuntu 24.04 Linux container, installed SSH/git/Node.js, and cloned demo-project from a local bundle after GitHub clone requested credentials.
    • Registered the SSH target through the PR app, connected over SSH, deployed the linux-arm64 relay, and spawned a remote PTY in /work/demo-project.
    • Drove the remote PTY through Orca to run pwd, git status, create kelp-ssh-*.txt, observe it in git status, remove it, and print ORCA_REMOTE_OK:<tag>.
    • Verified backing remote state over host SSH: temp file removed and remote repo clean relative to its starting branch.
    • With two Orca windows open, verified the owner window could read remote PTY cwd/foreground metadata while the non-owner window got safe empty metadata (getCwd → "", foreground → null, hasChildProcesses → false).
    • Cleaned up the Docker container, temp SSH keys, isolated Electron profile, and app processes started for validation.

Notes / residual risk

pty:listSessions() remains a global Resource Manager inventory surface and can list SSH PTY id/cwd/title across windows; mutation and detailed metadata paths remain owner-gated. This matches the existing Resource Manager design and was not treated as a blocker.

Made with Orca 🐋

Follow-up validation after CI/main updates

  • Fixed the failed verify job from the first PR run: repos:clone now preserves the legacy fallback window path when a test/defensive caller has no Electron sender, while still routing real clone progress to the initiating window.
  • Reproduced the failing CI file locally and verified the fix with pnpm exec vitest run --config config/vitest.config.ts src/main/ipc/repos-remote.test.ts — 69 passed.
  • Pulled latest origin/main again on June 15 and resolved conflicts in:
    • src/main/ipc/pty.ts — kept both the new provider-inspection guard and the multi-window sender-owner metadata guard.
    • src/main/ipc/repos.ts — kept main’s shared clone-progress parser while sending local clone progress to the initiating window.
    • src/main/runtime/orca-runtime.ts — kept main’s new startup-terminal/tabId/agent-terminal additions while preserving multi-window runtime routing; also made BrowserWindow mock/availability checks tolerate missing webContents.isDestroyed.
    • src/main/window/createMainWindow.ts — kept quit-state tracking plus main’s renderer-owned close-decision comment/behavior.
    • src/renderer/src/components/Terminal.tsx — kept main’s dependency cleanup for the initial-terminal fallback.
  • Post-conflict local validation:
    • pnpm exec vitest run --config config/vitest.config.ts src/main/ipc/repos-remote.test.ts src/main/ipc/pty.test.ts src/main/runtime/orca-runtime.test.ts src/main/window/createMainWindow.test.ts — 646 passed.
    • pnpm run typecheck
    • pnpm run lint
    • git diff --check

Follow-up validation after max-lines CI failure

  • Reproduced the second verify failure locally with pnpm exec oxlint --format github; it identified src/renderer/src/components/settings/CliSection.tsx as over the max-lines limit after the latest main merge.
  • Fixed without disabling max-lines by extracting the concrete CLI registration dialog into src/renderer/src/components/settings/CliRegistrationDialog.tsx.
  • Post-fix local validation:
    • pnpm exec oxlint --format github
    • pnpm exec vitest run --config config/vitest.config.ts src/main/ipc/repos-remote.test.ts src/main/ipc/pty.test.ts src/main/runtime/orca-runtime.test.ts src/main/window/createMainWindow.test.ts — 646 passed.
    • pnpm run typecheck
    • pnpm run lint
    • git diff --check

Remaining perf validation

  • Current PR checks are green after pushing 8aa9055cb (verify, golden E2E mac/linux, and native-smoke ubuntu/windows all passed).
  • Local terminal perf validation is not yet clean enough to call conclusive. The narrow 25 same-workspace OpenCode pane repro still timed out locally, but added diagnostics showed the synthetic key reached xterm and main for the focused PTY, while main/renderer delivery queues were empty at timeout. That points away from Orca PTY batching/backpressure queues and toward local PTY/process scheduling or host contention.
  • The local machine was heavily loaded during these runs, with other terminal-perf/Electron jobs and high-CPU app/system processes active. Treat the local Playwright timeout as contaminated until it is reproduced on a quieter machine.
  • Before landing, rerun npx electron-vite build --mode e2e, then the narrow perf row on a quiet machine/runner:
    SKIP_BUILD=1 ORCA_E2E_OPENCODE_SCALE_PANES=25 \
    ORCA_E2E_OPENCODE_SCALE_PRESSURE_PANES= \
    ORCA_E2E_OPENCODE_SCALE_CROSS_WORKSPACE_PANES= \
    ORCA_E2E_OPENCODE_SCALE_HIDDEN_PRESSURE_PANES= \
    npx playwright test tests/e2e/artificial-opencode-terminal-load.spec.ts \
      --grep "25 same-workspace" \
      --config tests/playwright.config.ts \
      --project electron-headless --workers=1
  • Preferred order: quiet macOS first for apples-to-apples validation, then Windows for cross-platform terminal/input confidence. If the narrow row passes on a quiet machine, treat the local failure as host contention. If it fails there too, continue investigation around accepted local PTY input/process scheduling after the byte reaches main, not renderer scheduler backlog.

@coderabbitai

coderabbitai Bot commented Jun 13, 2026 •

Copy link
Copy Markdown
Contributor

Review 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

Walkthrough

This PR implements experimental multi-window support in the Electron main process. A new main-window-registry module centralizes BrowserWindow tracking with focus-order management, broadcast helpers, and liveness checks. The runtime gains per-window renderer graph state (windowGraphs), ownership maps for tabs, leaves, PTYs, and browser pages, plus a set of resolveOwnerWindowId* helpers. PTY and browser IPC handlers enforce sender ownership via senderOwnsPty and ownsBrowserPage. Terminal RPC methods receive assertSenderOwnsTerminal guards. SSH, repos, and worktree IPC events are routed through broadcastToMainWindows or sender-resolved windows. The app menu adds a conditional "New Window" item and per-window zoom/sidebar callbacks. A QuitConfirmationTransaction coordinates multi-window quit confirmation. Two new experimental settings (experimentalMultiWindow, experimentalUnifiedNewTabLauncher) are added with renderer UI, locale strings, and telemetry whitelisting. Terminal perf budget scripts gain scenario-specific thresholds and a JSON-extraction step for the report gate.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 2.76% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Add experimental multi-window support' is concise and accurately reflects the primary change: introducing experimental multi-window functionality as described throughout the extensive changeset.
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.
Description check ✅ Passed PR description is comprehensive with summary, testing evidence, validation details, and known residual risks clearly documented.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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: 15

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (6)
src/main/index.ts (1)

1249-1261: ⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

Route synthetic PTY title frames to the owning window.

pty:data is terminal-scoped, but this path still broadcasts each synthesized title frame to every main window. That bypasses the ownership routing this stack is adding and can surface another window's PTY status/title updates in the wrong renderer.

src/main/runtime/orca-runtime-browser.ts (1)

1337-1341: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Don't reject tab creation just because the authoritative window is unavailable.

This guard throws before createBrowserTabInRenderer() can use the newly added preferred-renderer path. In a live secondary window, browserTabCreate() will incorrectly report “headless” even though a usable renderer still exists.

Suggested fix
-    if (!this.host.getAvailableAuthoritativeWindow()) {
+    if (
+      !isUsableRendererWindow(this.host.getAvailableAuthoritativeWindow()) &&
+      !isUsableRendererWindow(this.host.getPreferredRendererWindow())
+    ) {
       throw new BrowserError(
         'browser_error',
         'Browser tab creation requires a desktop renderer; headless orca serve does not support browser panes yet.'
       )
     }
src/main/providers/local-pty-provider.ts (1)

1-4: ⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

Remove the eslint-disable max-lines directive and split this module instead.

This change modifies a file-level max-lines disable, which is explicitly disallowed by repo policy. Please split focused PTY lifecycle concerns into smaller modules and drop the disable.

As per coding guidelines, "Never add a max-lines disable comment (eslint-disable max-lines, oxlint-disable max-lines, or line-specific variants). Split the file, extract focused modules, move fixtures/builders into named files, or otherwise reduce the counted lines instead."

Source: Coding guidelines

src/main/ipc/pty.test.ts (1)

1-3: 🛠️ Refactor suggestion | 🟠 Major | 🏗️ Heavy lift

Remove the max-lines suppression and split this suite.

Line [1] adds a prohibited eslint-disable max-lines waiver. Please split this file into focused suites/helpers and drop the suppression instead of disabling the rule.

As per coding guidelines, “Never add a max-lines disable comment (eslint-disable max-lines, oxlint-disable max-lines, or line-specific variants). Split the file, extract focused modules, move fixtures/builders into named files, or otherwise reduce the counted lines instead.”

Source: Coding guidelines

src/main/ipc/pty.ts (2)

1-5: 🛠️ Refactor suggestion | 🟠 Major | 🏗️ Heavy lift

Remove the max-lines suppression.

This new file-level disable conflicts with the repo rule for TS/JS files. Please split the PTY IPC surface into focused modules instead of suppressing the lint.

As per coding guidelines, "Never add a max-lines disable comment (eslint-disable max-lines, oxlint-disable max-lines, or line-specific variants). Split the file, extract focused modules, move fixtures/builders into named files, or otherwise reduce the counted lines instead."

Source: Coding guidelines


3108-3134: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Authorize serializer settle/clear against the declaring WebContents.

declarePendingPaneSerializer records ownerWebContentsId, but pty:settlePaneSerializer and pty:clearPendingPaneSerializer ignore the caller. Any other renderer that knows the paneKey and generation can clear or claim another window's pending serializer, which breaks the single-authoritative hydration contract this map is enforcing.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 7964398a-58e4-404b-badc-64b96a1da481

📥 Commits

Reviewing files that changed from the base of the PR and between c2572bc and 6f4d8c9.

📒 Files selected for processing (54)
  • src/main/browser/browser-manager.ts
  • src/main/codex-accounts/runtime-home-service.test.ts
  • src/main/codex-accounts/service.test.ts
  • src/main/index.ts
  • src/main/ipc/browser.test.ts
  • src/main/ipc/browser.ts
  • src/main/ipc/pty.test.ts
  • src/main/ipc/pty.ts
  • src/main/ipc/repos.ts
  • src/main/ipc/runtime.test.ts
  • src/main/ipc/runtime.ts
  • src/main/ipc/ssh.test.ts
  • src/main/ipc/ssh.ts
  • src/main/ipc/worktree-remote.ts
  • src/main/ipc/worktrees.ts
  • src/main/menu/menu-target-web-contents.ts
  • src/main/menu/register-app-menu-appearance.ts
  • src/main/menu/register-app-menu.test.ts
  • src/main/menu/register-app-menu.ts
  • src/main/providers/local-pty-provider.ts
  • src/main/runtime/orca-runtime-browser.test.ts
  • src/main/runtime/orca-runtime-browser.ts
  • src/main/runtime/orca-runtime.test.ts
  • src/main/runtime/orca-runtime.ts
  • src/main/runtime/rpc/core.ts
  • src/main/runtime/rpc/dispatcher.ts
  • src/main/runtime/rpc/methods/terminal.ts
  • src/main/ssh/ssh-relay-session.ts
  • src/main/window/attach-main-window-services.test.ts
  • src/main/window/attach-main-window-services.ts
  • src/main/window/createMainWindow.test.ts
  • src/main/window/createMainWindow.ts
  • src/main/window/main-window-open-policy.test.ts
  • src/main/window/main-window-open-policy.ts
  • src/main/window/main-window-registry.test.ts
  • src/main/window/main-window-registry.ts
  • src/preload/api-types.ts
  • src/preload/index.ts
  • src/renderer/src/components/Terminal.tsx
  • src/renderer/src/components/browser-pane/BrowserPane.tsx
  • src/renderer/src/components/settings/ExperimentalMultiWindowSetting.tsx
  • src/renderer/src/components/settings/ExperimentalPane.test.tsx
  • src/renderer/src/components/settings/ExperimentalPane.tsx
  • src/renderer/src/components/settings/experimental-search.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/web/web-preload-api.ts
  • src/shared/constants.test.ts
  • src/shared/constants.ts
  • src/shared/telemetry-events.ts
  • src/shared/types.ts
👮 Files not reviewed due to content moderation or server errors (1)
  • src/main/runtime/orca-runtime.ts

Comment thread src/main/index.ts
Comment on lines +654 to +658
function beginQuitConfirmationTransaction(event: Electron.Event): void {
if (!experimentalMultiWindowEnabledAtStartup) {
isQuitting = true
stopAppGlobalServicesForQuit()
return

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.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Don't stop app-global services in before-quit on the single-window path.

This branch shuts down quit-only singletons before quit is irreversible. If the close flow later unwinds through onQuitAborted, isQuitting gets reset but appGlobalQuitServicesStopped stays latched and services like rate-limit polling / awake-state handling never come back.

Comment thread src/main/index.ts
Comment on lines 822 to 824
onBeforeReload: ({ ignoreCache, webContentsId }) => {
if (mainWindow?.webContents.id === webContentsId) {
markExpectedRendererReload(webContentsId)
}
markExpectedRendererReload(webContentsId)
recordCrashBreadcrumb('manual_reload_requested', { ignoreCache })

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.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Track expected renderer reloads per webContentsId, not in one global slot. Multi-window mode can hit any of these reload paths concurrently, but the shared bookkeeping still stores a single { webContentsId, until }. Reloading window B before window A finishes overwrites A's marker, so crash classification/recovery can treat A's expected teardown as an unexpected renderer failure.

  • src/main/index.ts#L822-L824: record an expected reload entry keyed by this window's webContentsId instead of replacing a singleton.
  • src/main/index.ts#L893-L894: use the same per-window bookkeeping for renderer-initiated reloads.
  • src/main/index.ts#L1575-L1577: use the same per-window bookkeeping for menu-triggered reloads.
📍 Affects 1 file
  • src/main/index.ts#L822-L824 (this comment)
  • src/main/index.ts#L893-L894
  • src/main/index.ts#L1575-L1577

Comment thread src/main/ipc/pty.test.ts
Comment on lines +5767 to +5805
setPtyOwnership('pty-owned', null)
registerPtyHandlers(ownerWindow as never, runtime as never)

await expect(
handlers.get('pty:hasChildProcesses')!(
{ sender: otherWindow.webContents },
{ id: 'pty-owned' }
)
).resolves.toBe(false)
await expect(
handlers.get('pty:getForegroundProcess')!(
{ sender: otherWindow.webContents },
{ id: 'pty-owned' }
)
).resolves.toBeNull()
await expect(
handlers.get('pty:getCwd')!({ sender: otherWindow.webContents }, { id: 'pty-owned' })
).resolves.toBe('')
expect(provider.hasChildProcesses).not.toHaveBeenCalled()
expect(provider.getForegroundProcess).not.toHaveBeenCalled()
expect(provider.getCwd).not.toHaveBeenCalled()

await expect(
handlers.get('pty:hasChildProcesses')!(
{ sender: ownerWindow.webContents },
{ id: 'pty-owned' }
)
).resolves.toBe(true)
await expect(
handlers.get('pty:getForegroundProcess')!(
{ sender: ownerWindow.webContents },
{ id: 'pty-owned' }
)
).resolves.toBe('node')
await expect(
handlers.get('pty:getCwd')!({ sender: ownerWindow.webContents }, { id: 'pty-owned' })
).resolves.toBe('/repo/owned')
deletePtyOwnership('pty-owned')
})

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.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Guarantee PTY ownership cleanup even when this test fails early.

Line [5767] sets global PTY ownership, but cleanup at Line [5804] only runs on the success path. Wrap this test body in try/finally so deletePtyOwnership('pty-owned') always executes and test state stays isolated.

Suggested fix
-    setPtyOwnership('pty-owned', null)
-    registerPtyHandlers(ownerWindow as never, runtime as never)
-
-    await expect(
-      handlers.get('pty:hasChildProcesses')!(
-        { sender: otherWindow.webContents },
-        { id: 'pty-owned' }
-      )
-    ).resolves.toBe(false)
-    ...
-    await expect(
-      handlers.get('pty:getCwd')!({ sender: ownerWindow.webContents }, { id: 'pty-owned' })
-    ).resolves.toBe('/repo/owned')
-    deletePtyOwnership('pty-owned')
+    setPtyOwnership('pty-owned', null)
+    try {
+      registerPtyHandlers(ownerWindow as never, runtime as never)
+
+      await expect(
+        handlers.get('pty:hasChildProcesses')!(
+          { sender: otherWindow.webContents },
+          { id: 'pty-owned' }
+        )
+      ).resolves.toBe(false)
+      ...
+      await expect(
+        handlers.get('pty:getCwd')!({ sender: ownerWindow.webContents }, { id: 'pty-owned' })
+      ).resolves.toBe('/repo/owned')
+    } finally {
+      deletePtyOwnership('pty-owned')
+    }
📝 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
setPtyOwnership('pty-owned', null)
registerPtyHandlers(ownerWindow as never, runtime as never)
await expect(
handlers.get('pty:hasChildProcesses')!(
{ sender: otherWindow.webContents },
{ id: 'pty-owned' }
)
).resolves.toBe(false)
await expect(
handlers.get('pty:getForegroundProcess')!(
{ sender: otherWindow.webContents },
{ id: 'pty-owned' }
)
).resolves.toBeNull()
await expect(
handlers.get('pty:getCwd')!({ sender: otherWindow.webContents }, { id: 'pty-owned' })
).resolves.toBe('')
expect(provider.hasChildProcesses).not.toHaveBeenCalled()
expect(provider.getForegroundProcess).not.toHaveBeenCalled()
expect(provider.getCwd).not.toHaveBeenCalled()
await expect(
handlers.get('pty:hasChildProcesses')!(
{ sender: ownerWindow.webContents },
{ id: 'pty-owned' }
)
).resolves.toBe(true)
await expect(
handlers.get('pty:getForegroundProcess')!(
{ sender: ownerWindow.webContents },
{ id: 'pty-owned' }
)
).resolves.toBe('node')
await expect(
handlers.get('pty:getCwd')!({ sender: ownerWindow.webContents }, { id: 'pty-owned' })
).resolves.toBe('/repo/owned')
deletePtyOwnership('pty-owned')
})
setPtyOwnership('pty-owned', null)
try {
registerPtyHandlers(ownerWindow as never, runtime as never)
await expect(
handlers.get('pty:hasChildProcesses')!(
{ sender: otherWindow.webContents },
{ id: 'pty-owned' }
)
).resolves.toBe(false)
await expect(
handlers.get('pty:getForegroundProcess')!(
{ sender: otherWindow.webContents },
{ id: 'pty-owned' }
)
).resolves.toBeNull()
await expect(
handlers.get('pty:getCwd')!({ sender: otherWindow.webContents }, { id: 'pty-owned' })
).resolves.toBe('')
expect(provider.hasChildProcesses).not.toHaveBeenCalled()
expect(provider.getForegroundProcess).not.toHaveBeenCalled()
expect(provider.getCwd).not.toHaveBeenCalled()
await expect(
handlers.get('pty:hasChildProcesses')!(
{ sender: ownerWindow.webContents },
{ id: 'pty-owned' }
)
).resolves.toBe(true)
await expect(
handlers.get('pty:getForegroundProcess')!(
{ sender: ownerWindow.webContents },
{ id: 'pty-owned' }
)
).resolves.toBe('node')
await expect(
handlers.get('pty:getCwd')!({ sender: ownerWindow.webContents }, { id: 'pty-owned' })
).resolves.toBe('/repo/owned')
} finally {
deletePtyOwnership('pty-owned')
}

Comment thread src/main/ipc/pty.ts
Comment on lines +1447 to +1451
const exit = pendingExit.get(id)
if (exit && !pendingData.has(id)) {
pendingExit.delete(id)
sendToPtyOwnerWindow(ownerWindow, 'pty:exit', exit)
}

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.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Release renderer in-flight budget on the deferred exit path.

When an exit is delivered later through pendingExit—or aged out after the owner window never comes back—you delete the pending entry but never decrement rendererInFlightCharsByPty / rendererInFlightTotalChars. If the old renderer disappears before ACKing, those bytes stay counted forever and can throttle unrelated PTYs behind the high-water marks.

Also applies to: 1458-1473

Comment thread src/main/ipc/pty.ts
Comment on lines +1761 to +1765
const candidateIds =
getMainWindows().length === 1
? undefined
: runtime?.resolvePtyIdsForOwnerWindow(mainWindow.id)
const killed = lp.killOrphanedPtys(lp.advanceGeneration() - 1, candidateIds)

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.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Don't fall back to global orphan cleanup in multi-window mode.

If there is more than one window and runtime?.resolvePtyIdsForOwnerWindow(mainWindow.id) is unavailable, candidateIds becomes undefined, which is the same sentinel used for the single-window "kill any orphan" path. A reload in one window can then reap PTYs that still belong to other live windows.

Comment thread src/renderer/src/i18n/locales/es.json Outdated
Comment on lines +60 to +61
"help": "Ayuda",
"newWindow": "New Window"

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.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Translate the new Spanish locale strings.

menu.newWindow and the new experimental settings copy are still in English, so the Spanish build will surface mixed-language UI in the menu and settings screen.

♻️ Suggested translations
-    "newWindow": "New Window"
+    "newWindow": "Nueva ventana"
-          "efc5cd3ad7": "Multi-window",
-          "9403a2fffb": "Enable File > New Window for multiple monitor workflows. Requires restart.",
-          "73d191586e": "Adds File > New Window for multiple monitor workflows. Requires restart.",
-          "31d6d8d7b4": "Restart required",
-          "45513cd4aa": "Orca applies multi-window support at startup.",
-          "c709b5448c": "Restart",
-          "847886cf3e": "Smart New Tab menu",
-          "523b819a55": "Type in the New Tab menu to open a terminal, launch an agent, visit a URL, or open/create a file."
+          "efc5cd3ad7": "Multiventana",
+          "9403a2fffb": "Activa Archivo > Nueva ventana para flujos de trabajo con varios monitores. Requiere reiniciar.",
+          "73d191586e": "Añade Archivo > Nueva ventana para flujos de trabajo con varios monitores. Requiere reiniciar.",
+          "31d6d8d7b4": "Reinicio requerido",
+          "45513cd4aa": "Orca aplica el soporte multiventana al iniciar.",
+          "c709b5448c": "Reiniciar",
+          "847886cf3e": "Menú inteligente de nueva pestaña",
+          "523b819a55": "Escribe en el menú Nueva pestaña para abrir un terminal, iniciar un agente, visitar una URL o abrir/crear un archivo."

Also applies to: 4537-4544

Comment thread src/renderer/src/i18n/locales/ja.json Outdated
Comment on lines +60 to +61
"help": "ヘルプ",
"newWindow": "New Window"

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.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Translate the new Japanese locale copy.

menu.newWindow and the new experimental feature titles/descriptions are still in English, so the Japanese UI will show mixed-language text in Settings and File > New Window.

Also applies to: 4521-4529

Comment thread src/renderer/src/i18n/locales/ko.json Outdated
"window": "창",
"help": "도움말"
"help": "도움말",
"newWindow": "New Window"

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.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Translate menu.newWindow for Korean locale.

Line 61 uses English ("New Window") inside ko.json, so Korean users will see mixed-language menu text.

Comment on lines +4521 to 4530
"0e89a574ae": "오른쪽 하단에 떠 있는 애니메이션 애완동물.",
"efc5cd3ad7": "Multi-window",
"9403a2fffb": "Enable File > New Window for multiple monitor workflows. Requires restart.",
"73d191586e": "Adds File > New Window for multiple monitor workflows. Requires restart.",
"31d6d8d7b4": "Restart required",
"45513cd4aa": "Orca applies multi-window support at startup.",
"c709b5448c": "Restart",
"847886cf3e": "Smart New Tab menu",
"523b819a55": "Type in the New Tab menu to open a terminal, launch an agent, visit a URL, or open/create a file."
},

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.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Localize new Experimental settings strings in ko.json.

Lines 4522-4530 are still English (e.g., multi-window and smart new tab text), which breaks Korean-language settings UX.

Comment thread src/renderer/src/i18n/locales/zh.json Outdated
Comment on lines +60 to +61
"help": "帮助",
"newWindow": "New Window"

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.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Translate the new zh locale strings.

menu.newWindow and the new experimental multi-window / Smart New Tab copy are still English in zh.json, so Chinese users will see mixed-language UI. Please localize both copies together; the same strings also appear again in experimental.search.

Also applies to: 4521-4529, 6493-6495

brennanb2025 and others added 3 commits June 13, 2026 17:30
…ndow-monitor-support

# Conflicts:
#	src/main/ipc/pty.ts
#	src/main/ipc/repos.ts
#	src/main/runtime/orca-runtime.ts
#	src/main/window/createMainWindow.ts
#	src/renderer/src/components/Terminal.tsx

@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: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/main/ipc/repos.ts (1)

1-3: 🛠️ Refactor suggestion | 🟠 Major | 🏗️ Heavy lift

Remove the max-lines disable and split this module.

This file introduces a forbidden lint bypass. Please refactor into focused submodules (e.g., clone flows, project-host-setup IPC, sparse presets) instead of suppressing max-lines.

As per coding guidelines, "Never add a max-lines disable comment (eslint-disable max-lines, oxlint-disable max-lines, or line-specific variants). Split the file, extract focused modules, move fixtures/builders into named files, or otherwise reduce the counted lines instead."

Source: Coding guidelines


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: bdb9e7a3-fef4-4af8-8749-0c0f45b8394a

📥 Commits

Reviewing files that changed from the base of the PR and between d7b91e6 and 4d6563c.

📒 Files selected for processing (18)
  • src/main/index.ts
  • src/main/ipc/pty.test.ts
  • src/main/ipc/pty.ts
  • src/main/ipc/repos.ts
  • src/main/ipc/ssh.test.ts
  • src/main/ipc/ssh.ts
  • src/main/ipc/worktree-remote.ts
  • src/main/ipc/worktrees.ts
  • src/main/runtime/orca-runtime.test.ts
  • src/main/runtime/orca-runtime.ts
  • src/main/runtime/rpc/core.ts
  • src/main/runtime/rpc/dispatcher.ts
  • src/main/ssh/ssh-relay-session.ts
  • src/main/window/createMainWindow.ts
  • src/preload/api-types.ts
  • src/preload/index.ts
  • src/renderer/src/components/Terminal.tsx
  • src/renderer/src/components/browser-pane/BrowserPane.tsx
💤 Files with no reviewable changes (10)
  • src/preload/index.ts
  • src/main/runtime/rpc/core.ts
  • src/preload/api-types.ts
  • src/main/runtime/rpc/dispatcher.ts
  • src/renderer/src/components/browser-pane/BrowserPane.tsx
  • src/renderer/src/components/Terminal.tsx
  • src/main/ssh/ssh-relay-session.ts
  • src/main/window/createMainWindow.ts
  • src/main/runtime/orca-runtime.test.ts
  • src/main/runtime/orca-runtime.ts
🚧 Files skipped from review as they are similar to previous changes (4)
  • src/main/ipc/worktrees.ts
  • src/main/ipc/ssh.ts
  • src/main/index.ts
  • src/main/ipc/pty.test.ts

@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.

Caution

Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/main/ipc/repos.ts (1)

1-3: 🛠️ Refactor suggestion | 🟠 Major | 🏗️ Heavy lift

Remove the max-lines disable and split this module.

This file introduces a forbidden lint bypass. Please refactor into focused submodules (e.g., clone flows, project-host-setup IPC, sparse presets) instead of suppressing max-lines.

As per coding guidelines, "Never add a max-lines disable comment (eslint-disable max-lines, oxlint-disable max-lines, or line-specific variants). Split the file, extract focused modules, move fixtures/builders into named files, or otherwise reduce the counted lines instead."

Source: Coding guidelines


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: bdb9e7a3-fef4-4af8-8749-0c0f45b8394a

📥 Commits

Reviewing files that changed from the base of the PR and between d7b91e6 and 4d6563c.

📒 Files selected for processing (18)
  • src/main/index.ts
  • src/main/ipc/pty.test.ts
  • src/main/ipc/pty.ts
  • src/main/ipc/repos.ts
  • src/main/ipc/ssh.test.ts
  • src/main/ipc/ssh.ts
  • src/main/ipc/worktree-remote.ts
  • src/main/ipc/worktrees.ts
  • src/main/runtime/orca-runtime.test.ts
  • src/main/runtime/orca-runtime.ts
  • src/main/runtime/rpc/core.ts
  • src/main/runtime/rpc/dispatcher.ts
  • src/main/ssh/ssh-relay-session.ts
  • src/main/window/createMainWindow.ts
  • src/preload/api-types.ts
  • src/preload/index.ts
  • src/renderer/src/components/Terminal.tsx
  • src/renderer/src/components/browser-pane/BrowserPane.tsx
💤 Files with no reviewable changes (10)
  • src/preload/index.ts
  • src/main/runtime/rpc/core.ts
  • src/preload/api-types.ts
  • src/main/runtime/rpc/dispatcher.ts
  • src/renderer/src/components/browser-pane/BrowserPane.tsx
  • src/renderer/src/components/Terminal.tsx
  • src/main/ssh/ssh-relay-session.ts
  • src/main/window/createMainWindow.ts
  • src/main/runtime/orca-runtime.test.ts
  • src/main/runtime/orca-runtime.ts
🚧 Files skipped from review as they are similar to previous changes (4)
  • src/main/ipc/worktrees.ts
  • src/main/ipc/ssh.ts
  • src/main/index.ts
  • src/main/ipc/pty.test.ts
🛑 Comments failed to post (4)
src/main/ipc/pty.ts (1)

238-243: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Treat ownership-missing SSH PTY IDs as remote before falling back to local.

ptyOwnership.get() returns undefined after SSH ownership is cleared, so connectionId == null currently lets app-scoped SSH IDs pass as local PTYs. That defeats the new “disconnected SSH hosts read as idle” behavior and can still route inspection to localProvider.

Proposed fix
 function hasPtyProviderForInspection(ptyId: string): boolean {
   // Why: process inspection is background polling; disconnected SSH hosts should
   // read as idle instead of surfacing repeated IPC errors.
   const connectionId = ptyOwnership.get(ptyId)
-  return connectionId == null || sshProviders.has(connectionId)
+  if (connectionId !== undefined) {
+    return connectionId === null || sshProviders.has(connectionId)
+  }
+  const parsedSshId = parseAppSshPtyId(ptyId)
+  return parsedSshId ? sshProviders.has(parsedSshId.connectionId) : true
 }

Also applies to: 3065-3079

src/main/ipc/repos.ts (2)

325-333: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Remote clone progress is routed to mainWindow, not the caller’s window.

repos:cloneRemote ignores event and always passes mainWindow, so progress events can appear in the wrong window in multi-window mode. Use getTargetWindow(event) and pass that into cloneRemoteRepo.

Suggested fix
-async function cloneRemoteRepo(
-  store: Store,
-  mainWindow: BrowserWindow,
+async function cloneRemoteRepo(
+  store: Store,
+  targetWindow: BrowserWindow,
   args: {
@@
-        onProgress: (progress) => {
-          if (!mainWindow.isDestroyed()) {
-            mainWindow.webContents.send('repos:clone-progress', progress)
+        onProgress: (progress) => {
+          if (!targetWindow.isDestroyed()) {
+            targetWindow.webContents.send('repos:clone-progress', progress)
           }
         }
@@
-  ipcMain.handle(
+  ipcMain.handle(
     'repos:cloneRemote',
     async (
-      _event,
+      event,
       args: { connectionId: string; url: string; destination: string }
     ): Promise<Repo> => {
-      const repo = await cloneRemoteRepo(store, mainWindow, args)
+      const repo = await cloneRemoteRepo(store, getTargetWindow(event), args)
       notifyReposChanged(mainWindow)
       return repo
     }
   )

Also applies to: 392-395, 2221-2229


608-623: ⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

Remote clone abort state is single-slot and breaks with concurrent remote clones.

activeRemoteClone stores only one clone, while in-flight tracking allows multiple destinations. Starting a second remote clone overwrites the first clone’s abort handle, so repos:cloneAbort may abort only the latest one and leave others unabortable.

Use a keyed map for remote clone metadata (e.g., by connectionId + normalizedPath) and abort all active remote clones, or require an explicit clone key in repos:cloneAbort.

Also applies to: 377-413, 2030-2033

src/main/ipc/worktree-remote.ts (1)

658-681: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Preserve the review provider when formatting conflict messages.

The new hosted-review path can set lastExistingReviewNumber from a GitLab MR, but the final error always says PR #.... Track the provider with the number so GitLab conflicts are reported as MRs.

Proposed fix
 async function getSelectedHostedReviewForBranch(
   repo: Pick<Repo, 'path' | 'connectionId'>,
   branchName: string,
   args: SelectedReviewBranchInput
-): Promise<{ matchesSelected: boolean; number: number } | null> {
+): Promise<{ matchesSelected: boolean; provider: ForgeProviderId; number: number } | null> {
   const selectedReview = getSelectedReviewBranch(args)
   if (!selectedReview) {
     return null
   }
@@
   return {
     matchesSelected:
       review.provider === selectedReview.provider && review.number === selectedReview.number,
+    provider: review.provider,
     number: review.number
   }
 }
+
+function getReviewConflictKind(provider: ForgeProviderId): 'PR' | 'MR' {
+  return provider === 'gitlab' ? 'MR' : 'PR'
+}
@@
-  let lastExistingReviewNumber: number | null = null
+  let lastExistingReview: { provider: ForgeProviderId; number: number } | null = null
@@
-            lastExistingReviewNumber = lastExistingPR.number
+            lastExistingReview = { provider: 'github', number: lastExistingPR.number }
             break
@@
-            lastExistingReviewNumber = hostedReview.number
+            lastExistingReview = {
+              provider: hostedReview.provider,
+              number: hostedReview.number
+            }
             break
@@
-          lastExistingReviewNumber = lastExistingPR.number
+          lastExistingReview = { provider: 'github', number: lastExistingPR.number }
           break
@@
-    if (lastExistingReviewNumber !== null) {
+    if (lastExistingReview !== null) {
+      const reviewKind = getReviewConflictKind(lastExistingReview.provider)
       throw new Error(
-        `Branch "${branchName}" already has PR #${lastExistingReviewNumber}. Pick a different worktree name.`
+        `Branch "${branchName}" already has ${reviewKind} #${lastExistingReview.number}. Pick a different worktree name.`
       )
     }

Also applies to: 1773-1889

brennanb2025 and others added 4 commits June 22, 2026 21:05
…ndow-monitor-support

# Conflicts:
#	src/main/index.ts
#	src/main/ipc/browser.test.ts
#	src/main/ipc/pty.test.ts
#	src/main/ipc/pty.ts
#	src/main/ipc/repos.ts
#	src/main/ipc/ssh.ts
#	src/main/ipc/worktree-remote.ts
#	src/main/ipc/worktrees.ts
#	src/main/menu/register-app-menu.test.ts
#	src/main/menu/register-app-menu.ts
#	src/main/runtime/orca-runtime-browser.test.ts
#	src/main/runtime/orca-runtime-browser.ts
#	src/main/runtime/orca-runtime.ts
#	src/main/runtime/rpc/methods/terminal.ts
#	src/main/ssh/ssh-relay-session.ts
#	src/main/window/attach-main-window-services.test.ts
#	src/main/window/attach-main-window-services.ts
#	src/main/window/createMainWindow.ts
#	src/renderer/src/components/settings/CliRegistrationDialog.tsx
#	src/renderer/src/components/settings/CliSection.tsx
#	src/renderer/src/components/settings/ExperimentalPane.test.tsx
#	src/renderer/src/components/settings/ExperimentalPane.tsx
#	src/renderer/src/components/settings/experimental-search.ts
#	src/renderer/src/i18n/locales/es.json
#	src/renderer/src/i18n/locales/ja.json
#	src/renderer/src/i18n/locales/ko.json
#	src/renderer/src/i18n/locales/zh.json
brennanb2025 and others added 2 commits June 23, 2026 16:12
…ndow-monitor-support

# Conflicts:
#	package.json
#	src/main/ipc/worktree-remote.ts
#	src/main/window/attach-main-window-services.test.ts
#	src/main/window/attach-main-window-services.ts
#	src/relay/git-handler-status-ops.test.ts
#	src/relay/git-handler-status-ops.ts
#	src/relay/git-status-upstream-negative-cache.ts
#	src/renderer/src/components/terminal-pane/pty-connection.ts
#	src/renderer/src/i18n/locales/es.json
#	src/renderer/src/i18n/locales/ja.json
#	src/renderer/src/i18n/locales/ko.json
#	src/renderer/src/i18n/locales/zh.json
#	src/renderer/src/lib/new-workspace.test.ts
#	src/renderer/src/lib/new-workspace.ts

@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

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 0418783a-6d35-445b-9647-d12f43d5c78f

📥 Commits

Reviewing files that changed from the base of the PR and between 4d6563c and 01b3546.

📒 Files selected for processing (5)
  • config/scripts/check-terminal-perf-report-budgets.mjs
  • config/scripts/check-terminal-perf-report-budgets.test.mjs
  • config/scripts/run-terminal-scale-perf-e2e.mjs
  • config/scripts/run-terminal-scale-perf-report-gate.mjs
  • config/scripts/run-terminal-scale-perf-report-gate.test.mjs

Comment on lines +69 to +85
export function extractPlaywrightJsonReport(rawReport) {
let offset = 0
let jsonStart = -1
for (const line of rawReport.split('\n')) {
if (line.startsWith('{')) {
jsonStart = offset
break
}
offset += line.length + 1
}
if (jsonStart === -1) {
return rawReport
}
const jsonReport = rawReport.slice(jsonStart)
JSON.parse(jsonReport)
return jsonReport
}

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.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Guard JSON extraction failures so the gate script doesn't crash on failed runs.

Line 83 can throw, and because Line 114 calls it unguarded, the script can terminate before returning the scale command’s exit code. That turns an expected failed-gate result into an unhandled exception path.

Proposed fix
 export function extractPlaywrightJsonReport(rawReport) {
-  let offset = 0
-  let jsonStart = -1
-  for (const line of rawReport.split('\n')) {
-    if (line.startsWith('{')) {
-      jsonStart = offset
-      break
-    }
-    offset += line.length + 1
-  }
-  if (jsonStart === -1) {
-    return rawReport
-  }
-  const jsonReport = rawReport.slice(jsonStart)
-  JSON.parse(jsonReport)
-  return jsonReport
+  const jsonStart = rawReport.indexOf('{')
+  if (jsonStart === -1) return rawReport
+
+  const jsonReport = rawReport.slice(jsonStart)
+  try {
+    JSON.parse(jsonReport)
+    return jsonReport
+  } catch {
+    return rawReport
+  }
 }

Also applies to: 114-114

@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.

🧹 Nitpick comments (1)
src/main/providers/types.ts (1)

112-113: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Document the capability/method pairing with a short why-comment.

These two optional members encode a non-obvious contract; please add a 1–2 line comment clarifying that callers should only invoke setDataFlowPaused when the capability is supported.

Suggested edit
+  // Why: lossless pause is capability-gated; callers must check support before invoking.
+  // Keep this pair in sync across provider implementations.
   supportsLosslessDataFlowPause?: boolean
   setDataFlowPaused?: (id: string, paused: boolean) => boolean

As per coding guidelines: "When writing or modifying code driven by a design doc or non-obvious constraint, add a comment explaining why the code behaves the way it does."

Source: Coding guidelines


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: c7f63f0b-24b9-4a26-b7d2-b0f0cab7bd91

📥 Commits

Reviewing files that changed from the base of the PR and between 01b3546 and 2d3af6e.

📒 Files selected for processing (15)
  • package.json
  • src/main/ipc/worktree-remote.ts
  • src/main/ipc/worktrees.ts
  • src/main/providers/types.ts
  • src/main/runtime/orca-runtime.test.ts
  • src/main/runtime/orca-runtime.ts
  • src/main/window/attach-main-window-services.test.ts
  • src/main/window/attach-main-window-services.ts
  • src/preload/api-types.ts
  • src/preload/index.ts
  • src/renderer/src/components/Terminal.tsx
  • src/renderer/src/components/terminal-pane/pty-connection.test.ts
  • src/renderer/src/components/terminal-pane/pty-connection.ts
  • src/renderer/src/i18n/locales/en.json
  • src/shared/types.ts
💤 Files with no reviewable changes (4)
  • src/shared/types.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/components/terminal-pane/pty-connection.ts
  • src/renderer/src/components/terminal-pane/pty-connection.test.ts
✅ Files skipped from review due to trivial changes (1)
  • package.json
🚧 Files skipped from review as they are similar to previous changes (5)
  • src/main/ipc/worktrees.ts
  • src/renderer/src/components/Terminal.tsx
  • src/main/window/attach-main-window-services.ts
  • src/main/window/attach-main-window-services.test.ts
  • src/main/runtime/orca-runtime.ts

chess22 added a commit to chess22/orca that referenced this pull request Jul 11, 2026
syncMobileSessionTabs keyed mobileSessionTabsByWorktree/mobileSessionTabWindowIds
only by worktreeId, so when the same worktree was open in two windows the
last window to sync silently stole ownership and overwrote the other's
snapshot (flip-flopping on every heartbeat). Now a live owning window keeps
ownership until it closes; a second window's sync for the same worktree is
skipped rather than overwriting, and ownership becomes reclaimable once the
prior owner's window graph goes away (markGraphUnavailable/windowGraphStatuses).

Flagged by an external (codex) review of the multi-window branch (High #2).
Scoped to the reported collision rather than a full ownership-graph rebuild,
per upstream stablyai#5329's precedent of resolving mobile-session/PTY
ownership deterministically rather than last-writer-wins.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01TeeAEpaW2RewgvTnQ7wpa6
Refs #2
@nicolaschapados

Copy link
Copy Markdown

Any progress on merging this, @brennanb2025 , @AmethystLiang ? It'd do much to improve Orca's utility on multi-monitor set-ups! Many thanks in advance!

@evaleirasperc

Copy link
Copy Markdown

We've been running this PR daily on a fork for about a week (one window per monitor, each narrowed to a different project), and hit two issues in the terminal layer that I think are worth reporting. Both are reproducible with just this branch. Happy to open PRs against your branch for either — just say which, if any, you want.

1. Terminal input is rejected in every window except the first

isMainWindowPtyIpcEvent compares the sender against a single WebContents captured when the handlers were installed:

return (
  event.sender === mainWebContents &&
  !mainWindow.isDestroyed() &&
  ...
)

So typing in a second window silently does nothing. There's a second failure mode in the same place: reading .webContents off a destroyed BrowserWindow throws Object has been destroyed, and that throw happens at the call site before the guard can run, so closing a window turns every later keystroke into an uncaught main-process exception.

Fix we're running: resolve the sender through the main-window registry instead of an install-time reference, and check sender.isDestroyed() first so nothing dereferences a dead window. getMainWindowForWebContents(sender) returning null keeps foreign senders rejected, which is what the cross-window tests want.

The change also needs pty:write, pty:serializeBuffer and the resize/visibility handlers to drop their captured mainWindow argument (5 call sites), and the shared PTY suite harness has to register its fake window with the registry or ~83 tests fail on admission rather than on what they're asserting.

Commit: https://github.com/Perc-Innovation/Perc-Orca/commit/cd4e11f406

2. A terminal visible in two windows only ever delivers to one

rebuildOwnerWindowIndexes assigns PTY ownership first-come:

if (ptyId && !this.ptyOwnerWindowById.has(ptyId)) {
  this.ptyOwnerWindowById.set(ptyId, windowId)
}

Since it iterates windowGraphPublications in insertion order, whichever window published a leaf for that ptyId first keeps it for the life of the PTY, and getPtyRendererWindow sends pty:data only there. Open the same worktree in a second window and you get a pane that renders stale scrollback and never updates — with no indication that anything is wrong. It looks like a hung terminal.

Two things helped us, and they're independent of each other:

Say it out loud. A pane whose PTY belongs to another window should render an overlay saying so rather than dead scrollback. This alone turned the most confusing bug our users hit into a non-issue, and it needs no ownership changes.

Let the user take it. A "Bring here" action on that overlay transfers ownership to the current window, symmetric and reversible. The delicate part is the hand-off: in-flight ACK credit has to be repaid exactly once, pending writes dropped, and ACKs from the previous owner ignored, or the terminal stalls or double-counts. We also send the new owner a buffer-restore marker so it shows current state instead of a blank pane.

We layer a third rule on top (a window bound to a project owns that project's terminals) but that depends on a scoping concept that doesn't exist here, so I'd leave it out of any upstream proposal — the overlay and the explicit claim stand on their own.

Rebase

We also have this branch rebased onto main with the conflicts resolved (the shared/types, persistence and WorktreeList splits were the painful ones). It's at https://github.com/Perc-Innovation/Perc-Orca/tree/contrib/multi-window-rebase — though fair warning, main has moved ~95 commits since we did it, so it would need refreshing before it's useful to you. Offering in case it saves you the conflict archaeology; ignore if you're already on top of it.

@mtwichan

mtwichan commented Sep 1, 2026

Copy link
Copy Markdown

Any updates @brennanb2025 @AmethystLiang? Happy to help if I can! This is the only feature missing that would make this product my daily driver 👍

@Robert-Crivat

Copy link
Copy Markdown

+1 on landing this — the default-off flag plus File > New Window is exactly the right shape.

One data point in case it helps justify the experimental flag: on the shipped 1.4.188 (macOS) the only way to get a second Orca running today is a second userData profile, via the undocumented ORCA_USER_DATA_PATH:

ORCA_USER_DATA_PATH="$HOME/Library/Application Support/orca-2" \
  /Applications/Orca.app/Contents/MacOS/Orca &

That gives a separate single-instance lock, but also separate accounts, projects and agent history — so it does not cover the "two monitors, one profile" workflow this PR targets. The other lever in the packaged build, ORCA_BYPASS_SINGLE_INSTANCE_LOCK=1, skips the lock while sharing the same userData dir, and the bundled message marks it diagnostics-only.

Posted the same note on #6074 as an interim workaround. Happy to test this branch on macOS (Apple silicon, dual monitor) if that is useful — I saw @evaleirasperc already reported the per-window PTY sender-scoping issue above.

@nomicsadmin

Copy link
Copy Markdown

I've been running Orca as my daily ADE (1.4.200, macOS). +1.

The need is two unrelated projects visible at the same time: two monitors, or two Spaces. One Orca window per project, with its own agents, terminals, and browser.

Splits don't cover that. They cut the screen I'm already on. Switching worktrees swaps the whole pane tree, so the other project is gone. Cmd+N opens a new workspace, not a new window, and launching the app again just focuses the one that's already open.

I don't think this needs the full architecture. The MVP is File > New Window, same profile, one window per project. Dashboard pop-out and a second userData profile are not that.

Happy to test a flag. #5329 looks like the path.

@cloudcerebro

Copy link
Copy Markdown

We are eagerly waiting for this feature!

@alvistar

Copy link
Copy Markdown

+1 on landing this behind the experimental flag. One use case the PR doesn't seem to cover yet: per-window sidebar view state.

What I'd like is one window per project (or per group of projects), each showing only its own workspaces, e.g. window A filtered to project-x and grouped by status, window B showing everything grouped by project.

From the diff, the sidebar view settings (filterRepoIds, groupBy, sortBy, showActiveOnly, the hide-* toggles) aren't touched, so they still live in the single persisted ui state. With two windows open, changing the project filter in one would change it in the other too. That's fine for v1, but it would be good to keep the window-state model open to:

  1. Per-window view state: project filter, group-by and sort owned by the window, persisted with it, and restored on relaunch.
  2. A per-window accent colour, like VS Code's Peacock: a tinted border or title bar, defaulting to the repo colour when the window is filtered to a single project, so you can tell windows apart at a glance across monitors.
  3. Opening a scoped window from the CLI/menu, e.g. orca window open --project <repo>. This also covers the startup-script use case raised in [Feature]: Multiple windows #6074.

Happy to open separate issues for (2) and (3) if that's easier to track.

@alvistar

Copy link
Copy Markdown

Following up on my comment above: I opened #23559 for the part that doesn't need multi-window. It covers saved sidebar views (filter + group + sort) recalled from ⌘J or a shortcut, with a Peacock-style accent for the active view. If this PR lands, "accent of the active view" maps directly onto "accent of the window", so the two should compose rather than overlap. Per-window view state and orca window open --project remain open here.

@JaunGustin

Copy link
Copy Markdown

+1, pleaseee

@dariocaregnato

Copy link
Copy Markdown

+1! 🤩

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.

10 participants