Repository navigation
Add experimental multi-window support - #5329
brennanb2025 wants to merge 13 commits into
Conversation
Co-authored-by: Orca <[email protected]>
…ndow-monitor-support
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThis PR implements experimental multi-window support in the Electron main process. A new 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
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. Comment |
There was a problem hiding this comment.
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 liftRoute synthetic PTY title frames to the owning window.
pty:datais 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 winDon'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 liftRemove the
eslint-disable max-linesdirective and split this module instead.This change modifies a file-level
max-linesdisable, 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-linesdisable 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 liftRemove the
max-linessuppression and split this suite.Line [1] adds a prohibited
eslint-disable max-lineswaiver. 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-linesdisable 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 liftRemove the
max-linessuppression.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-linesdisable 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 winAuthorize serializer settle/clear against the declaring
WebContents.
declarePendingPaneSerializerrecordsownerWebContentsId, butpty:settlePaneSerializerandpty:clearPendingPaneSerializerignore the caller. Any other renderer that knows thepaneKeyand 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
📒 Files selected for processing (54)
src/main/browser/browser-manager.tssrc/main/codex-accounts/runtime-home-service.test.tssrc/main/codex-accounts/service.test.tssrc/main/index.tssrc/main/ipc/browser.test.tssrc/main/ipc/browser.tssrc/main/ipc/pty.test.tssrc/main/ipc/pty.tssrc/main/ipc/repos.tssrc/main/ipc/runtime.test.tssrc/main/ipc/runtime.tssrc/main/ipc/ssh.test.tssrc/main/ipc/ssh.tssrc/main/ipc/worktree-remote.tssrc/main/ipc/worktrees.tssrc/main/menu/menu-target-web-contents.tssrc/main/menu/register-app-menu-appearance.tssrc/main/menu/register-app-menu.test.tssrc/main/menu/register-app-menu.tssrc/main/providers/local-pty-provider.tssrc/main/runtime/orca-runtime-browser.test.tssrc/main/runtime/orca-runtime-browser.tssrc/main/runtime/orca-runtime.test.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/rpc/core.tssrc/main/runtime/rpc/dispatcher.tssrc/main/runtime/rpc/methods/terminal.tssrc/main/ssh/ssh-relay-session.tssrc/main/window/attach-main-window-services.test.tssrc/main/window/attach-main-window-services.tssrc/main/window/createMainWindow.test.tssrc/main/window/createMainWindow.tssrc/main/window/main-window-open-policy.test.tssrc/main/window/main-window-open-policy.tssrc/main/window/main-window-registry.test.tssrc/main/window/main-window-registry.tssrc/preload/api-types.tssrc/preload/index.tssrc/renderer/src/components/Terminal.tsxsrc/renderer/src/components/browser-pane/BrowserPane.tsxsrc/renderer/src/components/settings/ExperimentalMultiWindowSetting.tsxsrc/renderer/src/components/settings/ExperimentalPane.test.tsxsrc/renderer/src/components/settings/ExperimentalPane.tsxsrc/renderer/src/components/settings/experimental-search.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/i18n/locales/es.jsonsrc/renderer/src/i18n/locales/ja.jsonsrc/renderer/src/i18n/locales/ko.jsonsrc/renderer/src/i18n/locales/zh.jsonsrc/renderer/src/web/web-preload-api.tssrc/shared/constants.test.tssrc/shared/constants.tssrc/shared/telemetry-events.tssrc/shared/types.ts
👮 Files not reviewed due to content moderation or server errors (1)
- src/main/runtime/orca-runtime.ts
| function beginQuitConfirmationTransaction(event: Electron.Event): void { | ||
| if (!experimentalMultiWindowEnabledAtStartup) { | ||
| isQuitting = true | ||
| stopAppGlobalServicesForQuit() | ||
| return |
There was a problem hiding this comment.
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.
| onBeforeReload: ({ ignoreCache, webContentsId }) => { | ||
| if (mainWindow?.webContents.id === webContentsId) { | ||
| markExpectedRendererReload(webContentsId) | ||
| } | ||
| markExpectedRendererReload(webContentsId) | ||
| recordCrashBreadcrumb('manual_reload_requested', { ignoreCache }) |
There was a problem hiding this comment.
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'swebContentsIdinstead 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-L894src/main/index.ts#L1575-L1577
| 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') | ||
| }) |
There was a problem hiding this comment.
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.
| 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') | |
| } |
| const exit = pendingExit.get(id) | ||
| if (exit && !pendingData.has(id)) { | ||
| pendingExit.delete(id) | ||
| sendToPtyOwnerWindow(ownerWindow, 'pty:exit', exit) | ||
| } |
There was a problem hiding this comment.
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
| const candidateIds = | ||
| getMainWindows().length === 1 | ||
| ? undefined | ||
| : runtime?.resolvePtyIdsForOwnerWindow(mainWindow.id) | ||
| const killed = lp.killOrphanedPtys(lp.advanceGeneration() - 1, candidateIds) |
There was a problem hiding this comment.
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.
| "help": "Ayuda", | ||
| "newWindow": "New Window" |
There was a problem hiding this comment.
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
| "help": "ヘルプ", | ||
| "newWindow": "New Window" |
There was a problem hiding this comment.
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
| "window": "창", | ||
| "help": "도움말" | ||
| "help": "도움말", | ||
| "newWindow": "New Window" |
There was a problem hiding this comment.
Translate menu.newWindow for Korean locale.
Line 61 uses English ("New Window") inside ko.json, so Korean users will see mixed-language menu text.
| "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." | ||
| }, |
There was a problem hiding this comment.
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.
| "help": "帮助", | ||
| "newWindow": "New Window" |
There was a problem hiding this comment.
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
Co-authored-by: Orca <[email protected]>
…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
Co-authored-by: Orca <[email protected]>
There was a problem hiding this comment.
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 liftRemove the
max-linesdisable 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-linesdisable 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
📒 Files selected for processing (18)
src/main/index.tssrc/main/ipc/pty.test.tssrc/main/ipc/pty.tssrc/main/ipc/repos.tssrc/main/ipc/ssh.test.tssrc/main/ipc/ssh.tssrc/main/ipc/worktree-remote.tssrc/main/ipc/worktrees.tssrc/main/runtime/orca-runtime.test.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/rpc/core.tssrc/main/runtime/rpc/dispatcher.tssrc/main/ssh/ssh-relay-session.tssrc/main/window/createMainWindow.tssrc/preload/api-types.tssrc/preload/index.tssrc/renderer/src/components/Terminal.tsxsrc/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
There was a problem hiding this comment.
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 liftRemove the
max-linesdisable 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-linesdisable 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
📒 Files selected for processing (18)
src/main/index.tssrc/main/ipc/pty.test.tssrc/main/ipc/pty.tssrc/main/ipc/repos.tssrc/main/ipc/ssh.test.tssrc/main/ipc/ssh.tssrc/main/ipc/worktree-remote.tssrc/main/ipc/worktrees.tssrc/main/runtime/orca-runtime.test.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/rpc/core.tssrc/main/runtime/rpc/dispatcher.tssrc/main/ssh/ssh-relay-session.tssrc/main/window/createMainWindow.tssrc/preload/api-types.tssrc/preload/index.tssrc/renderer/src/components/Terminal.tsxsrc/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 winTreat ownership-missing SSH PTY IDs as remote before falling back to local.
ptyOwnership.get()returnsundefinedafter SSH ownership is cleared, soconnectionId == nullcurrently 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 tolocalProvider.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 winRemote clone progress is routed to
mainWindow, not the caller’s window.
repos:cloneRemoteignoreseventand always passesmainWindow, so progress events can appear in the wrong window in multi-window mode. UsegetTargetWindow(event)and pass that intocloneRemoteRepo.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 liftRemote clone abort state is single-slot and breaks with concurrent remote clones.
activeRemoteClonestores only one clone, while in-flight tracking allows multiple destinations. Starting a second remote clone overwrites the first clone’s abort handle, sorepos:cloneAbortmay 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 inrepos:cloneAbort.Also applies to: 377-413, 2030-2033
src/main/ipc/worktree-remote.ts (1)
658-681:
⚠️ Potential issue | 🟡 Minor | ⚡ Quick winPreserve the review provider when formatting conflict messages.
The new hosted-review path can set
lastExistingReviewNumberfrom a GitLab MR, but the final error always saysPR #.... 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
…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
…ndow-monitor-support
Co-authored-by: Orca <[email protected]>
Co-authored-by: Orca <[email protected]>
Co-authored-by: Orca <[email protected]>
…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
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 0418783a-6d35-445b-9647-d12f43d5c78f
📒 Files selected for processing (5)
config/scripts/check-terminal-perf-report-budgets.mjsconfig/scripts/check-terminal-perf-report-budgets.test.mjsconfig/scripts/run-terminal-scale-perf-e2e.mjsconfig/scripts/run-terminal-scale-perf-report-gate.mjsconfig/scripts/run-terminal-scale-perf-report-gate.test.mjs
| 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 | ||
| } |
There was a problem hiding this comment.
🩺 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
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/main/providers/types.ts (1)
112-113: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDocument 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
setDataFlowPausedwhen 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) => booleanAs 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
📒 Files selected for processing (15)
package.jsonsrc/main/ipc/worktree-remote.tssrc/main/ipc/worktrees.tssrc/main/providers/types.tssrc/main/runtime/orca-runtime.test.tssrc/main/runtime/orca-runtime.tssrc/main/window/attach-main-window-services.test.tssrc/main/window/attach-main-window-services.tssrc/preload/api-types.tssrc/preload/index.tssrc/renderer/src/components/Terminal.tsxsrc/renderer/src/components/terminal-pane/pty-connection.test.tssrc/renderer/src/components/terminal-pane/pty-connection.tssrc/renderer/src/i18n/locales/en.jsonsrc/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
Co-authored-by: Orca <[email protected]>
Co-authored-by: Orca <[email protected]>
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
|
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! |
|
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
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 Fix we're running: resolve the sender through the main-window registry instead of an install-time reference, and check The change also needs 2. A terminal visible in two windows only ever delivers to one
if (ptyId && !this.ptyOwnerWindowById.has(ptyId)) {
this.ptyOwnerWindowById.set(ptyId, windowId)
}Since it iterates 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. RebaseWe also have this branch rebased onto |
|
Any updates @brennanb2025 @AmethystLiang? Happy to help if I can! This is the only feature missing that would make this product my daily driver 👍 |
|
+1 on landing this — the default-off flag plus 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="$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, 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. |
|
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. |
|
We are eagerly waiting for this feature! |
|
+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 From the diff, the sidebar view settings (
Happy to open separate issues for (2) and (3) if that's easier to track. |
|
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 |
|
+1, pleaseee |
|
+1! 🤩 |
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
/tmp/orca-kelp-multi-window-readiness-design.mdCLEANfor 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 typecheckpnpm run lintgit diff --check origin/main...HEADpnpm build:relay/Users/thebr/orca/workspaces/orca/kelp, branchbrennanb2025/multi-window-monitor-support) with isolated user data:window.api.app.getIdentity()points at this branch/root.experimentalMultiWindowdefaultsfalsein a fresh profile.demo-projectand verified it appears visibly in the app.demo-projectprofile state.brennan-test-sshshape:docker infohung.demo-projectfrom a local bundle after GitHub clone requested credentials./work/demo-project.pwd,git status, createkelp-ssh-*.txt, observe it ingit status, remove it, and printORCA_REMOTE_OK:<tag>.getCwd→"", foreground →null,hasChildProcesses→false).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
verifyjob from the first PR run:repos:clonenow 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.pnpm exec vitest run --config config/vitest.config.ts src/main/ipc/repos-remote.test.ts— 69 passed.origin/mainagain 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 missingwebContents.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.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 typecheckpnpm run lintgit diff --checkFollow-up validation after max-lines CI failure
verifyfailure locally withpnpm exec oxlint --format github; it identifiedsrc/renderer/src/components/settings/CliSection.tsxas over the max-lines limit after the latestmainmerge.max-linesby extracting the concrete CLI registration dialog intosrc/renderer/src/components/settings/CliRegistrationDialog.tsx.pnpm exec oxlint --format githubpnpm 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 typecheckpnpm run lintgit diff --checkRemaining perf validation
8aa9055cb(verify, golden E2E mac/linux, and native-smoke ubuntu/windows all passed).npx electron-vite build --mode e2e, then the narrow perf row on a quiet machine/runner: