Repository navigation
feat(browser): choose where desktop browser tabs render - #10046
GoodFarming wants to merge 14 commits into
Conversation
|
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:
📝 WalkthroughWalkthroughAdds a 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/renderer/src/store/slices/browser.ts (1)
1927-1955: 🚀 Performance & Scalability | 🟠 Major | ⚡ Quick win
fetchDetectedBrowserscache short-circuit no longer applies to its only caller.The "already loaded" guard now only fires when
hostId === undefined.BrowserImportHintButton.tsxwas changed to always callfetchDetectedBrowsers(LOCAL_EXECUTION_HOST_ID)explicitly (previously called with no args), so this guard never triggers for that call site anymore — every popover open re-runswindow.api.browser.sessionDetectBrowsers(), defeating the one-shot-probe intent documented by the adjacent "Why" comment inBrowserImportHintButton.tsx("Only probe them when the user opens the import hint").🐛 Proposed fix: track the host the cached result belongs to
detectedBrowsers: [], detectedBrowsersLoaded: false, + detectedBrowsersLoadedHostId: null, fetchDetectedBrowsers: async (hostId) => { const requestedHostId = getRequestedBrowserHostId(get(), hostId) const runtimeTarget = getBrowserRuntimeTarget(requestedHostId) if (runtimeTarget) { ... return } - if (hostId === undefined && get().detectedBrowsersLoaded) { + if (get().detectedBrowsersLoaded && get().detectedBrowsersLoadedHostId === requestedHostId) { return } try { const browsers = (await window.api.browser.sessionDetectBrowsers()) as DetectedBrowserProfileSource[] - set({ detectedBrowsers: browsers, detectedBrowsersLoaded: true }) + set({ detectedBrowsers: browsers, detectedBrowsersLoaded: true, detectedBrowsersLoadedHostId: requestedHostId }) } catch { - set({ detectedBrowsersLoaded: true }) + set({ detectedBrowsersLoaded: true, detectedBrowsersLoadedHostId: requestedHostId }) } },(requires adding
detectedBrowsersLoadedHostIdtoBrowserSlice.)
🧹 Nitpick comments (1)
src/renderer/src/components/tab-bar/tab-create-entry-action.ts (1)
155-180: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueCollapse the duplicated
createBrowserTabfallback.The runtime-failure fallback (Lines 167-172) and the
elsebranch (Lines 174-179) are identical, so the branch can flatten to "try runtime when active, then always create a local tab."♻️ Proposed dedup
if (runtimeSessionActive) { const created = await operations.createWebRuntimeSessionBrowserTab({ worktreeId, environmentId: activeRuntimeEnvironmentId, url: classification.url, targetGroupId: groupId }) if (created) { return } - // Why: headless remote runtimes cannot host browser panes yet; a URL open - // should still give the user a usable client-local browser tab. - operations.createBrowserTab(worktreeId, classification.url, { - activate: true, - browserRuntimeEnvironmentId: null, - targetGroupId: groupId, - title: classification.url - }) - } else { - operations.createBrowserTab(worktreeId, classification.url, { - activate: true, - browserRuntimeEnvironmentId: null, - targetGroupId: groupId, - title: classification.url - }) } + // Why: headless remote runtimes cannot host browser panes yet; a URL open + // should still give the user a usable client-local browser tab. + operations.createBrowserTab(worktreeId, classification.url, { + activate: true, + browserRuntimeEnvironmentId: null, + targetGroupId: groupId, + title: classification.url + }) return
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 82520416-a50b-4a0c-843e-f29ca53491c9
📥 Commits
Reviewing files that changed from the base of the PR and between 6d55c7f and 414d88c39db73b661fb9ef0e4025451702da0a96.
📒 Files selected for processing (24)
src/renderer/src/components/Terminal.tsxsrc/renderer/src/components/browser-pane/BrowserImportHintButton.tsxsrc/renderer/src/components/browser-pane/BrowserPane.tsxsrc/renderer/src/components/settings/BrowserLinkRoutingSetting.tsxsrc/renderer/src/components/settings/BrowserPane.tsxsrc/renderer/src/components/settings/BrowserSessionCookiesSection.tsxsrc/renderer/src/components/settings/browser-search.tssrc/renderer/src/components/tab-bar/tab-create-entry-action.test.tssrc/renderer/src/components/tab-bar/tab-create-entry-action.tssrc/renderer/src/hooks/useIpcEvents.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/lib/http-link-routing.test.tssrc/renderer/src/lib/http-link-routing.tssrc/renderer/src/store/slices/browser.test.tssrc/renderer/src/store/slices/browser.tssrc/renderer/src/store/slices/cmd-j-create-actions.test.tssrc/shared/constants.tssrc/shared/types.tstests/e2e/browser-tab-host.spec.tstests/e2e/helpers/paired-electron-client.ts
414d88c to
839526d
Compare
|
@coderabbitai review Re-review context for rebased head
|
|
The Comment image shows a dark-themed browser tab strip with two tabs titled “FOR-2698: Coherent setup rates and s…”. Both tabs have blue globe icons; the left tab is active and includes a close button.
✅ Action performedReview finished.
|
839526d to
f0fee57
Compare
f0fee57 to
d875e99
Compare
Greptile SummaryThis PR introduces a user-configurable "Browser tab host" setting (
Confidence Score: 4/5The change is well-scoped and correctly threads the new host policy through all major browser entry points without touching agent routing, the screencast transport, or network configuration. The core host-resolution logic and per-host keyed state are solid. One behavioral gap exists: when the user has chosen Workspace runtime but the active worktree has no runtime environment ID, openNewBrowserTabInActiveWorkspace silently creates a local tab, while the typed-URL path surfaces an explicit error for the same condition. Files Needing Attention: src/renderer/src/store/slices/browser.ts — specifically the openNewBrowserTabInActiveWorkspace fallback path when runtimeEnvironmentId resolves to null under a workspace-host preference.
|
| Filename | Overview |
|---|---|
| src/renderer/src/lib/browser-tab-host.ts | New module introducing resolveBrowserTabHost and isBrowserTabHostLockedToWorkspace; logic is simple and correct, web-client lock checked via __ORCA_WEB_CLIENT__ global. |
| src/renderer/src/store/slices/browser.ts | Core browser slice updated with per-host keyed state for profiles, import state, and detected browsers; openNewBrowserTabInActiveWorkspace now consults the browserTabHost setting. Silent local fallback when workspace host is set but no runtime environment ID is found creates an inconsistency with the typed-URL path. |
| src/renderer/src/lib/http-link-routing.ts | Link routing now delegates to resolveBrowserTabHost for the host policy; browserRuntimeEnvironmentId: null explicitly set on locally-created tabs; logic is well-guarded. |
| src/renderer/src/components/settings/BrowserLinkRoutingSetting.tsx | Refactored to show both the Link Routing toggle and the new Browser tab host selector; web-client locking correctly disables the selector; i18n keys follow project conventions. |
| src/renderer/src/components/Terminal.tsx | Keyboard new-tab handler simplified to always delegate to openNewBrowserTabInActiveWorkspace; old inline runtime-detection fallback removed, policy now in the store action. |
| src/renderer/src/components/tab-bar/tab-create-entry-action.ts | Typed-URL path now uses resolved browserTabHost setting; workspace-unavailable path throws an error and never falls back to local, matching stated fail-closed contract. |
| src/renderer/src/components/browser-pane/BrowserToolbarMenu.tsx | Profile, detected-browser, and import state reads scoped to LOCAL_EXECUTION_HOST_ID; lazy fetchBrowserSessionProfiles call triggered when profiles are undefined; fallback constants prevent null-reference errors. |
| src/renderer/src/components/browser-pane/BrowserImportHintButton.tsx | All browser import operations consistently scoped to LOCAL_EXECUTION_HOST_ID; detectedBrowsersLoaded read from detectedBrowsersLoadedByHostId with strict equality. |
| src/renderer/src/lib/browser-tab-host.test.ts | Covers desktop-default, explicit workspace selection, and web-client lock; tests are concise and correctly clean up the global flag. |
| src/renderer/src/components/settings/BrowserLinkRoutingSetting.test.tsx | New test file covering desktop (selectable) and web-client (locked/disabled) rendering paths for the Browser tab host selector. |
Sequence Diagram
sequenceDiagram
participant User
participant TerminalIPC as Terminal / IPC
participant openNewBrowserTab as openNewBrowserTabInActiveWorkspace
participant tabEntryAction as openTabEntryWithOperations
participant httpLinkRouting as openHttpLink
participant LocalBrowser as Local Browser Tab
participant WorkspaceBrowser as Workspace Runtime Browser
Note over User,WorkspaceBrowser: New Tab (Cmd+T)
User->>TerminalIPC: press Cmd+T
TerminalIPC->>openNewBrowserTab: openNewBrowserTabInActiveWorkspace(groupId?)
alt "host=local OR no runtimeEnvironmentId"
openNewBrowserTab->>LocalBrowser: createBrowserTab(browserRuntimeEnvironmentId null)
else "host=workspace AND runtimeEnvironmentId present"
openNewBrowserTab->>WorkspaceBrowser: createWebRuntimeSessionBrowserTab()
end
Note over User,WorkspaceBrowser: Typed URL
User->>tabEntryAction: openTabBarEntry(url)
alt "host=local"
tabEntryAction->>LocalBrowser: createBrowserTab(browserRuntimeEnvironmentId null)
else "host=workspace AND runtime active"
tabEntryAction->>WorkspaceBrowser: createWebRuntimeSessionBrowserTab()
else "host=workspace AND runtime unavailable"
tabEntryAction-->>User: throw WORKSPACE_RUNTIME_BROWSER_UNAVAILABLE_MESSAGE
end
Note over User,WorkspaceBrowser: Link click
User->>httpLinkRouting: openHttpLink(url)
alt "host=local"
httpLinkRouting->>LocalBrowser: createBrowserTab(browserRuntimeEnvironmentId null)
else "host=workspace AND runtime"
httpLinkRouting->>WorkspaceBrowser: openRuntimeBrowserLink()
else ssh or unknown
httpLinkRouting->>User: openUrl(system browser)
end
Comments Outside Diff (1)
-
src/renderer/src/store/slices/browser.ts, line 726-766 (link)Silent local fallback when workspace host has no runtime
When
browserTabHostis'workspace'butgetRuntimeEnvironmentIdForWorktreereturnsnull(e.g., no runtime is configured for the worktree),runtimeEnvironmentIdisnull, theif (runtimeEnvironmentId)block is skipped, and a local tab is created silently viacreateBrowserTab. In contrast, the typed-URL path inopenTabEntryWithOperationsthrowsWORKSPACE_RUNTIME_BROWSER_UNAVAILABLE_MESSAGEin exactly this case. A user who has set "Workspace runtime" and presses Cmd+T would silently receive a local tab, while typing a URL in the address bar would show an explicit error — two different outcomes from the same user preference.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Reviews (1): Last reviewed commit: "fix(browser): preserve explicit host own..." | Re-trigger Greptile
|
It's possible that we already have something implemented. Any reviewer for this PR should chat with AI to first understand what kind of design is the best |
|
Thanks Amethyst, I have been patching in my fix for now, as otherwise I
have issues with really low quality browser experience in workspaces with
remote hosts.
But then I need to continue compensating by hosting tests servers on
tailscale dns.
There is likely something smoother and smarter than what I've implemented -
ill make sure to connect these all to issues in future so the need/solution
connection is clearer for agents.
…On Mon, 3 Aug 2026, 4:25 pm Jinjing, ***@***.***> wrote:
*AmethystLiang* left a comment (stablyai/orca#10046)
<#10046 (comment)>
It's possible that we already have something implemented. Any reviewer for
this PR should chat with AI to first understand what kind of design is the
best
—
Reply to this email directly, view it on GitHub
<#10046?email_source=notifications&email_token=AIIEZ5PDJC5YSM3BX35Y6QT5IAV4ZA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMJWGMYDGMJQGI22M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KYZTPN52GK4S7MNWGSY3L#issuecomment-5163031025>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AIIEZ5P3XRGDS4XDPEB43BD5IAV4ZAVCNFSNUABGKJSXA33TNF2G64TZHMYTCOBTHA4DQMZUGI5US43TOVSTWNBZGU2DONZZGY4DNILWAI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
d875e99 to
52e696a
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
|
@AmethystLiang Thanks — I have now recut this on current main ( A more optimistic implementation might introduce the ability to select-host per tab - such as remote-hosted browser for viewing |
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (2)
src/renderer/src/lib/http-link-routing.ts (1)
197-209: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick winLog the swallowed error before falling back.
The bare
catchdiscards import failures and unexpected exceptions.createWebRuntimeSessionBrowserTablogs its own RPC failures, but a failed dynamic import of@/runtime/web-runtime-sessionproduces no diagnostic. Users then see the system browser open with no explanation in the logs.Keep the fallback and add one warning line.
♻️ Proposed change to keep the failure observable
- } catch { + } catch (error) { // Why: runtime capability can disappear mid-open; preserve the system-browser escape hatch. + console.warn( + '[http-link-routing] runtime browser tab failed; using system browser:', + error instanceof Error ? error.message : String(error) + ) }tests/e2e/browser-tab-host.spec.ts (1)
118-138: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse trusted Playwright input for the select interaction.
setBrowserTabHostToLocalThroughUiclaims to exercise the visible selector, butdispatchEvent(new KeyboardEvent(...))inpage.evaluatesends untrusted events rather than real keyboard input.await browserHostSelect.press('Enter')andawait localOption.press('Enter')drive the same Radix handlers with trusted Playwright input. Add a one-line reason if synthetic dispatch is required, such as portal focus blocking.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: a0b3dc86-1e10-4ebf-b23d-b2960965db00
📒 Files selected for processing (33)
src/renderer/src/components/Terminal.tsxsrc/renderer/src/components/browser-pane/BrowserImportHintButton.tsxsrc/renderer/src/components/browser-pane/BrowserPane.tsxsrc/renderer/src/components/browser-pane/BrowserToolbarMenu.tsxsrc/renderer/src/components/editor/MarkdownPreview.link-routing.interaction.test.tsxsrc/renderer/src/components/settings/BrowserLinkRoutingSetting.test.tsxsrc/renderer/src/components/settings/BrowserLinkRoutingSetting.tsxsrc/renderer/src/components/settings/BrowserPane.tsxsrc/renderer/src/components/settings/BrowserSessionCookiesSection.tsxsrc/renderer/src/components/settings/browser-search.test.tssrc/renderer/src/components/settings/browser-search.tssrc/renderer/src/components/tab-bar/tab-create-entry-action.test.tssrc/renderer/src/components/tab-bar/tab-create-entry-action.tssrc/renderer/src/components/tab-bar/tab-create-entry-browser-open.tssrc/renderer/src/components/terminal-pane/terminal-link-handlers.test.tssrc/renderer/src/hooks/useIpcEvents.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/lib/browser-tab-host.test.tssrc/renderer/src/lib/browser-tab-host.tssrc/renderer/src/lib/http-link-routing.test.tssrc/renderer/src/lib/http-link-routing.tssrc/renderer/src/store/slices/browser.test.tssrc/renderer/src/store/slices/browser.tssrc/renderer/src/store/slices/cmd-j-create-actions.test.tssrc/shared/constants.tssrc/shared/types.tstests/e2e/browser-tab-host.spec.tstests/e2e/helpers/paired-electron-client.tstests/e2e/nested-runtime-ssh-lifecycle.spec.ts
🚧 Files skipped from review as they are similar to previous changes (9)
- src/shared/types.ts
- src/renderer/src/components/settings/BrowserSessionCookiesSection.tsx
- src/renderer/src/components/settings/BrowserLinkRoutingSetting.tsx
- src/renderer/src/components/Terminal.tsx
- tests/e2e/helpers/paired-electron-client.ts
- src/renderer/src/components/settings/browser-search.ts
- src/renderer/src/components/settings/BrowserPane.tsx
- src/renderer/src/hooks/useIpcEvents.ts
- src/shared/constants.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 Plus
Run ID: 2f7e73d7-3b6b-4ee1-9a93-856d9e1d451c
📒 Files selected for processing (7)
src/renderer/src/components/terminal-pane/terminal-runtime-host-link-routing.test.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/lib/http-link-modifier-routing.test.tssrc/renderer/src/lib/http-link-routing.tssrc/renderer/src/store/slices/browser.test.tssrc/renderer/src/store/slices/browser.tstests/e2e/browser-tab-host.spec.ts
🚧 Files skipped from review as they are similar to previous changes (3)
- tests/e2e/browser-tab-host.spec.ts
- src/renderer/src/store/slices/browser.test.ts
- src/renderer/src/store/slices/browser.ts
In plain English
Interactive browser tabs opened from Orca Desktop render on that computer by default. Workspace-runtime browsing remains an explicit choice for remote/headless workflows.
Summary
Explicit workspace-runtime selection remains authoritative and fails closed; Orca does not silently substitute local execution when explicit remote creation fails.
Screenshots
The body retains the related paired-session screenshot from #9758 as problem context:
The setting and default were manually accepted on Linux in the equivalent feature build. An after screenshot is still needed before final review; no private live workspace was captured.
Testing
Exact published head:
867cf8dfe1976155b920657e9ddb0573ea74d95eon basef71373953baa1d384b75bbdf4845fda17a847da5.http-link-modifier-routingtests and full web TypeScript project on Doom/Node 24browserRuntimeEnvironmentId: nullwhile preserving terminal tabs and active worktree96355a2e7apassed lint, all three TypeScript projects, 3,563 focused desktop tests, and 55 mobile testse13fa51f38102e1c3bf972e206e68fd323927406; its AppImage passed Ubuntu 20.04 glibc compatibility for 18 native binaries, packaged daemon entry, bundled plugin resources, and live desktop acceptanceAI Review Report
The review covered every browser-creation boundary, explicit-host profile caching, desktop/paired-web capability differences, runtime/SSH ownership, Shift inversion, failure semantics, and client-local navigation. The final reviewer finding exposed a test that could pass through fallback; the test and production guard were corrected together.
Security Audit
No new command execution, filesystem access, authentication, secret handling, dependency, or privileged IPC is added. Remote RPC is attempted only for an eligible explicit runtime or a client that cannot host a desktop-local browser. URL classification remains unchanged.
Notes
f0fee57e6conflict/base caveat.