Repository navigation
Gate paired web creation actions by provider - #13909
Conversation
661fd32 to
8c70f04
Compare
455a7fb to
cf28324
Compare
|
Too many files changed for review (589 files, 100 file limit). |
cf28324 to
393ed8d
Compare
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📥 CommitsReviewing files that changed from the base of the PR and between 393ed8d and 5f408af750be6b47dace06aec6eb91cf04f7b196. 📒 Files selected for processing (15)
🚧 Files skipped from review as they are similar to previous changes (5)
📝 WalkthroughWalkthroughThe change adds centralized client-creation policy resolution for browsers and mobile emulators. Browser creation, duplication, runtime routing, and local materialization now enforce policy and report asynchronous errors. Tab menus, shortcuts, Cmd-J actions, floating workspaces, and feature actions hide or reject unsupported operations. Settings search and shortcut visibility now reflect client capabilities. Tests cover policy resolution, runtime capabilities, failure handling, menu behavior, and paired web clients. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 2📝 Generate docstrings 💡
🛠️ Fix failing CI checks 💡
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: 3
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/components/Terminal.tsx (1)
2085-2101: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winEvaluate mobile-emulator availability against the correct worktree when the floating panel is focused.
The browser shortcut handler (Line 2069) switches to
FLOATING_TERMINAL_WORKTREE_IDwhenfloatingWorkspaceFocusedis true. The simulator handler always usesactiveWorktreeId, even when the floating workspace is focused.If the floating workspace is focused and the active worktree's
mobile-emulatorpolicy happens to be disabled, the code shows a toast withsimulatorAvailability.reasonand returns, even though the real reason nothing happens is that the floating workspace does not support the mobile emulator at all. This shows the user a misleading error message.🐛 Proposed fix
if (!e.repeat && mobileEmulatorEnabled && matchShortcut('tab.newSimulator')) { e.preventDefault() notifyTerminalCapture('tab.newSimulator') + if (floatingWorkspaceFocused) { + return + } const simulatorAvailability = getClientCreationActionPolicy( useAppStore.getState(), activeWorktreeId )['mobile-emulator'] if (simulatorAvailability.state !== 'enabled') { toast.error(simulatorAvailability.reason) return } - if (!floatingWorkspaceFocused) { - handleNewSimulatorTab() - } + handleNewSimulatorTab() return }
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 5ef75470-bed3-4aed-b5cb-fdf120649203
📒 Files selected for processing (42)
src/renderer/src/components/Terminal.tsxsrc/renderer/src/components/WorktreeJumpPalette.tsxsrc/renderer/src/components/cmd-j/quick-action-context.test.tssrc/renderer/src/components/cmd-j/quick-action-context.tssrc/renderer/src/components/cmd-j/quick-actions.tssrc/renderer/src/components/feature-wall/FeatureWallBrowserAction.tsxsrc/renderer/src/components/floating-terminal/FloatingTerminalPanel.tsxsrc/renderer/src/components/right-sidebar/PortsPanel.test.tsxsrc/renderer/src/components/settings/FloatingWorkspacePane.tsxsrc/renderer/src/components/settings/ShortcutsPane.tsxsrc/renderer/src/components/settings/floating-workspace-search.tssrc/renderer/src/components/settings/shortcut-row-visibility.test.tssrc/renderer/src/components/settings/shortcut-row-visibility.tssrc/renderer/src/components/tab-bar/BrowserTab.tsxsrc/renderer/src/components/tab-bar/TabBar.context-menu.test.tssrc/renderer/src/components/tab-bar/TabBar.tsxsrc/renderer/src/components/tab-bar/tab-bar-item-surface.tsxsrc/renderer/src/components/tab-bar/tab-bar-static-create-menu.tsxsrc/renderer/src/components/tab-bar/tab-bar-surface.tsxsrc/renderer/src/components/tab-bar/tab-create-menu-options.test.tssrc/renderer/src/components/tab-bar/use-tab-bar-create-menu-controller.tssrc/renderer/src/components/tab-bar/use-tab-bar-runtime-model.tssrc/renderer/src/components/tab-group/useTabGroupWorkspaceModel.tssrc/renderer/src/hooks/useIpcEvents.tssrc/renderer/src/hooks/useSettingsNavigationMetadata.test.tssrc/renderer/src/hooks/useSettingsNavigationMetadata.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/lib/client-creation-action-policy.test.tssrc/renderer/src/lib/client-creation-action-policy.tssrc/renderer/src/lib/floating-workspace-tab-creation.tssrc/renderer/src/lib/open-mobile-emulator-tab.test.tssrc/renderer/src/lib/open-mobile-emulator-tab.tssrc/renderer/src/lib/workspace-browser-tab-open.test.tssrc/renderer/src/lib/workspace-browser-tab-open.tssrc/renderer/src/lib/workspace-port-actions.tssrc/renderer/src/runtime/web-runtime-session.test.tssrc/renderer/src/runtime/web-runtime-session.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/protocol-version.tstests/e2e/multi-client-navigation-isolation.spec.ts
| onDuplicate={ | ||
| runtime.managedBrowserCreationEnabled | ||
| ? () => onDuplicateBrowserTab?.(item.id) | ||
| : undefined | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Hide Duplicate Tab when no callback exists.
Line 154 creates onDuplicate even when onDuplicateBrowserTab is undefined. BrowserTab then renders “Duplicate Tab”, but selecting it does nothing. Require both policy availability and the callback.
Proposed fix
onDuplicate={
- runtime.managedBrowserCreationEnabled
- ? () => onDuplicateBrowserTab?.(item.id)
+ runtime.managedBrowserCreationEnabled && onDuplicateBrowserTab
+ ? () => onDuplicateBrowserTab(item.id)
: undefined
}📝 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.
| onDuplicate={ | |
| runtime.managedBrowserCreationEnabled | |
| ? () => onDuplicateBrowserTab?.(item.id) | |
| : undefined | |
| } | |
| onDuplicate={ | |
| runtime.managedBrowserCreationEnabled && onDuplicateBrowserTab | |
| ? () => onDuplicateBrowserTab(item.id) | |
| : undefined | |
| } |
| if (browserAvailability.provider === 'paired-runtime' && runtimeEnvironmentId) { | ||
| void createWebRuntimeSessionBrowserTab({ | ||
| worktreeId: activeWorktreeId, | ||
| environmentId: runtimeEnvironmentId, | ||
| url: defaultUrl | ||
| }) | ||
| }).catch(showClientCreationActionError) | ||
| return | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Check the resolved value of createWebRuntimeSessionBrowserTab before returning.
Both handleNewBrowserTab (Line 1630) and handleDuplicateBrowserTab (Line 1673) call createWebRuntimeSessionBrowserTab(...).catch(showClientCreationActionError) and then return without checking whether the call resolved to false.
createWebRuntimeSessionBrowserTab returns false (not a rejection) when the environment is missing or the web-runtime session is not currently active. In that case, no browser tab is created and no error reaches showClientCreationActionError, so the user sees no feedback at all.
The sibling implementation in src/renderer/src/components/tab-group/useTabGroupWorkspaceModel.ts (duplicateBrowserTab) handles this correctly:
const created = await createWebRuntimeSessionBrowserTab({...})
if (created) {
return
}
throw new Error('The paired runtime could not duplicate the managed browser tab.')Apply the same pattern here so a false resolution surfaces a toast instead of failing silently.
🐛 Proposed fix for both call sites
if (browserAvailability.provider === 'paired-runtime' && runtimeEnvironmentId) {
- void createWebRuntimeSessionBrowserTab({
+ void (async () => {
+ const created = await createWebRuntimeSessionBrowserTab({
worktreeId: activeWorktreeId,
environmentId: runtimeEnvironmentId,
url: defaultUrl
- }).catch(showClientCreationActionError)
+ })
+ if (!created) {
+ throw new Error('The paired runtime could not create the browser tab.')
+ }
+ })().catch(showClientCreationActionError)
return
} if (
browserAvailability.provider === 'paired-runtime' &&
runtimeEnvironmentId &&
browserWorkspaceHasRemoteOwner(state, source.id, runtimeEnvironmentId)
) {
- void createWebRuntimeSessionBrowserTab({
+ void (async () => {
+ const created = await createWebRuntimeSessionBrowserTab({
worktreeId: activeWorktreeId,
environmentId: runtimeEnvironmentId,
url: source.url,
profileId: source.sessionProfileId
- }).catch(showClientCreationActionError)
+ })
+ if (!created) {
+ throw new Error('The paired runtime could not duplicate the browser tab.')
+ }
+ })().catch(showClientCreationActionError)
return
}Also applies to: 1668-1680
5f408af to
a9333a9
Compare
a9333a9 to
00be443
Compare
(cherry picked from commit ebe5125)
(cherry picked from commit ebe5125)
The oversized-UI-surfaces split was cut from a stale branch and reverted merged work. getClientCreationActionPolicy entered Terminal.tsx in #13909 and left in the split, taking six call sites with it, so every action-time creation gate in the terminal and floating surfaces was gone. Restores those and the other behavior the split dropped, each ported from the pre-split reference: - Cmd/Ctrl+S dispatched a bare Event with no detail, so the only listener always bailed on detail?.fileId and the chord never saved. Its resolver had been left orphaned, imported by nothing but its own test. - Terminal and floating create actions lost their availability gates, their toasts, and their catch handlers; one path throws on unavailable, so it was a silent unhandled rejection. - Both outermost workbench wrappers lost the browser guest paint retention branch, and the census entry covering them was deleted in the same commit. - The Space Analyzer header counted omitted items the list no longer rendered, and a worktree whose items were all omitted showed the empty state. - The terminal root lost its tab topology projection, so every tab-title update re-rendered it. - The titlebar tab bar stopped being passed clientHostedBrowserRows, leaving client-hosted pages uncloseable before a worktree has a layout. - Parking diagnostics lost their exempt-route counts and crash breadcrumb. - A suppressed inherited-terminal frame began buying a freshness scan the pre-split early return skipped. Adds regression tests for each, all verified to fail against the pre-fix code. Restores three deleted assertions whose invariants are still live, and replaces a concatenated source-boundary fixture with per-module pinning so a symbol is again asserted against the module that must own it. Deletes three orphaned trees the splits stranded: a duplicate ResourceUsage surface, cmd-j-match-relevance, and an agent-session claim-key module whose logic the record store already owns. Makes two non-recursive test walkers recursive, one of which silently skipped every nested CLI handler group.
The oversized-UI-surfaces split was cut from a stale branch and reverted merged work. getClientCreationActionPolicy entered Terminal.tsx in stablyai#13909 and left in the split, taking six call sites with it, so every action-time creation gate in the terminal and floating surfaces was gone. Restores those and the other behavior the split dropped, each ported from the pre-split reference: - Cmd/Ctrl+S dispatched a bare Event with no detail, so the only listener always bailed on detail?.fileId and the chord never saved. Its resolver had been left orphaned, imported by nothing but its own test. - Terminal and floating create actions lost their availability gates, their toasts, and their catch handlers; one path throws on unavailable, so it was a silent unhandled rejection. - Both outermost workbench wrappers lost the browser guest paint retention branch, and the census entry covering them was deleted in the same commit. - The Space Analyzer header counted omitted items the list no longer rendered, and a worktree whose items were all omitted showed the empty state. - The terminal root lost its tab topology projection, so every tab-title update re-rendered it. - The titlebar tab bar stopped being passed clientHostedBrowserRows, leaving client-hosted pages uncloseable before a worktree has a layout. - Parking diagnostics lost their exempt-route counts and crash breadcrumb. - A suppressed inherited-terminal frame began buying a freshness scan the pre-split early return skipped. Adds regression tests for each, all verified to fail against the pre-fix code. Restores three deleted assertions whose invariants are still live, and replaces a concatenated source-boundary fixture with per-module pinning so a symbol is again asserted against the module that must own it. Deletes three orphaned trees the splits stranded: a duplicate ResourceUsage surface, cmd-j-match-relevance, and an agent-session claim-key module whose logic the record store already owns. Makes two non-recursive test walkers recursive, one of which silently skipped every nested CLI handler group. Mirror-Of: 8fef582
The oversized-UI-surfaces split was cut from a stale branch and reverted merged work. getClientCreationActionPolicy entered Terminal.tsx in stablyai#13909 and left in the split, taking six call sites with it, so every action-time creation gate in the terminal and floating surfaces was gone. Restores those and the other behavior the split dropped, each ported from the pre-split reference: - Cmd/Ctrl+S dispatched a bare Event with no detail, so the only listener always bailed on detail?.fileId and the chord never saved. Its resolver had been left orphaned, imported by nothing but its own test. - Terminal and floating create actions lost their availability gates, their toasts, and their catch handlers; one path throws on unavailable, so it was a silent unhandled rejection. - Both outermost workbench wrappers lost the browser guest paint retention branch, and the census entry covering them was deleted in the same commit. - The Space Analyzer header counted omitted items the list no longer rendered, and a worktree whose items were all omitted showed the empty state. - The terminal root lost its tab topology projection, so every tab-title update re-rendered it. - The titlebar tab bar stopped being passed clientHostedBrowserRows, leaving client-hosted pages uncloseable before a worktree has a layout. - Parking diagnostics lost their exempt-route counts and crash breadcrumb. - A suppressed inherited-terminal frame began buying a freshness scan the pre-split early return skipped. Adds regression tests for each, all verified to fail against the pre-fix code. Restores three deleted assertions whose invariants are still live, and replaces a concatenated source-boundary fixture with per-module pinning so a symbol is again asserted against the module that must own it. Deletes three orphaned trees the splits stranded: a duplicate ResourceUsage surface, cmd-j-match-relevance, and an agent-session claim-key module whose logic the record store already owns. Makes two non-recursive test walkers recursive, one of which silently skipped every nested CLI handler group.
Summary
+menu, searchable create results, tab context menus, Cmd/Ctrl+J, keyboard and Electron-menu creation, floating-workspace actions and empty states, onboarding, settings links, URL creation, Browser duplication, and workspace-port materialization.window.open, normal-tab, or local managed-browser fallback.Provider behavior:
Screenshots
Paired web connected to a host advertising
browser.screencast.v1: Terminal, managed Browser, and Markdown are available; Mobile Emulator is omitted.Testing
mainatfc7c2a1cd5pnpm typecheckpnpm lint(native/type-aware quality, reliability, max-lines, skill manifests, and localization gates)pnpm test:e2e:multi-client-navigation: 3 rendered Electron/CDP journeys passedgit diff --checkA mistakenly broad local Vitest invocation was stopped after an unrelated updater test failed; the intended 12-file invocation then passed all 208 tests. This does not affect the focused result above.
Internal Review Report
Two review-until-clean rounds were completed against the full diff. Round one fixed remaining Shortcut Settings advertising, browser-profile provider selection, remote Browser link routing, commit and SSH/port Browser routing, exact screencast preflight, and clear error handling for direct duplication/reopen paths. Round two and the post-rebase audit found no P0, P1, or P2 issue in scope.
The review traced each advertised action to its exact provider and checked direct-call guards, host/workspace ownership, stale or absent runtime status, remote Browser materialization, failed remote creation, and duplicate UI entry points. It verified that
OrcaRuntime.getStatus()advertisesbrowser.screencast.v1only with an authoritative Electron renderer orOffscreenBrowserBackend; serve installs the latter only after a real display is confirmed. The Node 24 dogfood image has no Xvfb, while browser-enabled headless environments legitimately advertise both screencast and headless capabilities.Cross-platform review covered macOS, Linux, and Windows. No new modifier behavior, shortcut labels, paths, shell commands, native modules, or Electron platform assumptions were introduced. SSH, folder workspaces, runtime-owned worktrees, and local desktop execution remain distinct in provider resolution.
Security and Compatibility Audit
No dependency, lockfile, binary, install-hook, download, updater, auth, secret, command-execution, path-mutation, or new IPC surface changes. The policy only consumes an existing optional runtime-status capability and adds fail-closed renderer guards. No new stream opcode or unnegotiated wire payload was added. Unsupported web clients cannot escape to
window.openor another unmanaged browser surface. No mobile handshake/schema surface or persisted state changed.Notes
main.browser.screencast.v1is intentionally conservative for mixed client/server versions.browser.headless.v1alone does not enable the action.