Skip to content

feat(cli): open a browser tab in a split pane with tab create --split - #35665

Merged
AmoabaKelvin merged 4 commits into
mainfrom
feat/cli-tab-create-split
Oct 30, 2026
Merged

AmoabaKelvin merged 4 commits into
mainfrom
feat/cli-tab-create-split

Conversation

@AmoabaKelvin

@AmoabaKelvin AmoabaKelvin commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​203 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​203
Prod 14 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​144 $\color{#cf222e}{\Huge{\mathbf{−}}}$​48 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​96

Carries over #27370 by @kmizzi.

ELI5

An agent in an Orca terminal can now open a web page in a new pane beside itself, instead of as a hidden tab behind the terminal.

What Changed

Before: orca tab create --url <url> always added the page as another tab in an existing pane. To get it beside the terminal you had to drag the tab into a split yourself.

After: orca tab create --url <url> --split <right|left|down|up> opens a new pane next to the terminal that ran the command and loads the page there. Keyboard focus and the active pane stay on the terminal. Without --split nothing changes.

How it works (the first two commits are @kmizzi's, rebased onto main; the third is ours):

  • CLI (src/cli/handlers/browser-tab.ts): validates --split and sends split plus the caller's ORCA_TAB_ID as splitFromTabId on browser.tabCreate.
  • RPC params: two new optional fields.
  • Main (browser-tab-creation.ts): forwards them on the existing browser:requestTabCreate IPC. Headless serve and client-hosted pages reject --split with a clear error instead of quietly making a plain tab.
  • Renderer (browser-request-ipc-bridge.ts, browser-tab-split-placement.ts): picks the source pane (the group holding the caller's terminal tab, else the active pane, else the root group) and calls createBrowserTab with its existing split option, the one link routing and "open to the side" use.
  • SSH hosts (desktop-browser-bridge-executor.ts): a split from a host's CLI is refused, because a host can't choose the desktop's layout (its targetGroupId is already stripped for the same reason).
  • Workspace: when the CLI names no workspace (run outside its workspace's directory, or from a remote CLI), the renderer uses the workspace that holds the caller's tab before falling back to the active one.

Why

The UI already opens pages beside a pane (link routing, "open to the side"); the CLI just couldn't ask for it.

Changes from #27370:

  • The original created an empty split group and then created the tab in it, closing the pane again if that failed. In builds where main owns the layout, that new group doesn't exist in the window until main's frame lands, so the tab has nowhere to go. createBrowserTab({ split }) carries the split and the tab together to whichever side owns the layout, and the rollback goes away.
  • SSH hosts already can't choose a new tab's group or focus, so a split from one is refused rather than quietly turned into a plain tab.
  • With no workspace named, the original split in the active workspace and missed the caller's terminal; the caller's tab now picks the workspace. An empty --split= is rejected instead of opening a plain tab.
  • Rebased over about 2,900 commits on main. Main had added fallbackWorktreeId to the same IPC payload, and it has been added to the shared BrowserTabCreateRequest type.

Linked Issue

Fixes #27369

Visual Proof

From a hidden macOS dev build of this branch, each command run inside an Orca terminal. The page area is blank grey because a hidden window doesn't paint web pages; the store and the address bar show example.com loaded. The before shot is from #27370.

Before: orca tab create --url https://example.com After: orca tab create --url https://example.com --split right
(screenshot removed: contained real product data) (screenshot removed: contained real product data)

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

Manual, macOS dev build, run from inside Orca terminals and checked against the store:

  • --split right: the layout became a horizontal split with the terminal's pane first and the new browser pane second. The active pane and keyboard focus stayed on the terminal.
  • --split down in a single-pane workspace: a vertical split with the new pane below.
  • --split left while a different pane was active: the split still went beside the terminal that ran the command, and the active pane didn't change.
  • Plain tab create: the layout didn't change and the tab went into an existing pane, as before.
  • --split diagonal: rejected with --split must be right, left, down, or up.

Automated: src/cli/browser.test.ts covers the flag (sent with the caller's tab, left out without the flag, unknown or empty direction rejected). browser-request-ipc-bridge.split.test.ts checks that a split request goes beside the caller's terminal or falls back to the active pane, uses the caller's workspace when none is named, and that a plain create has no split. The SSH bridge test covers refusing split.

Ran pnpm tc, oxlint/oxfmt on changed files, verify:bundled-skill-guides, verify:rpc-params-catalog and pnpm check:changed. One unit test failed locally, in src/main/orcad/electron-serve-browser-process.test.ts, which this PR doesn't touch: its real-home write guard trips on this Mac. Not tested on Linux or Windows; the change has no paths, shortcuts or processes.

AI Disclosure

Review

Agent skill upstream boundary

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

Notes

  • Backward compatibility: both fields are optional. An older host drops them and makes a plain tab; an older CLI never sends them.
  • Remote: split placement happens in the desktop window that owns the layout. Headless serve and client-hosted placement refuse it; so do SSH hosts.
  • Mobile: unaffected; only the CLI flag sets split.
  • Folder workspaces: same path as worktrees; the source pane lookup is by workspace id.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@greptile-apps

greptile-apps Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] This PR appears safe to merge; no actionable issues were found.

Summary

Adds orca tab create --split <right|left|down|up> using the existing browser split path.

  • The CLI opens a browser page in a new pane beside its calling terminal.

PR author AmoabaKelvin explicitly states that stripping split placement from SSH requests is intentional because SSH hosts cannot choose the desktop layout.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  CLI["CLI: --split and ORCA_TAB_ID"] --> RPC["browser.tabCreate"]
  RPC --> Guard{"Desktop placement available?"}
  Guard -->|No| Error["Return an error"]
  Guard -->|Yes| IPC["browser:requestTabCreate"]
  IPC --> Source["Caller group → active group → root group"]
  Source --> Create["createBrowserTab with split"]
  Create --> Pane["New browser pane; terminal keeps focus"]
Loading

Reviews (1) · Last reviewed commit: "fix(browser): open the CLI split pane an..." · Reviewed by Greptile

@coderabbitai

coderabbitai Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Walkthrough

The CLI adds tab create --split with four supported directions. Split direction and optional caller-tab ID pass through the runtime request to the renderer. The renderer selects a group for the new pane and creates the tab without activating it. Requests that cannot use an authoritative desktop window return an invalid_argument error. Tests cover CLI validation, request forwarding, host parameter filtering, and renderer placement.

Priority: Normal

Severity of issue fixed: Medium

Merge Risk: Low · up to e045d

Most split requests work, but documented host limitations and explicit cross-worktree requests can produce rejected or incorrectly placed tabs.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: adding split-pane support to the CLI browser tab creation command.
Description check Passed The description is complete and follows the required template. It explains the user-visible behavior, implementation, rationale, linked issue, visual proof, testing, compatibility considerations, and …
Linked Issues check Passed Directly linked issue #27369 requires a orca tab create option that opens a browser tab in a new pane beside the terminal that ran the command, with keyboard focus kept in that terminal. The PR adds…
Out of Scope Changes check Passed Every changed file relates to #27369 or to its required support. The changes are: the CLI flag and its spec and tests; the new optional RPC fields; the main-process forwarding and rejection paths for …
Full details: Description check

Explanation

The description is complete and follows the required template. It explains the user-visible behavior, implementation, rationale, linked issue, visual proof, testing, compatibility considerations, and checklist status. It also documents the one unrelated local test failure and the platforms not tested.

Full details: Linked Issues check

Explanation

Directly linked issue #27369 requires a orca tab create option that opens a browser tab in a new pane beside the terminal that ran the command, with keyboard focus kept in that terminal. The PR adds --split &lt;right|left|down|up&gt; in src/cli/handlers/browser-tab.ts and the split option in src/cli/specs/browser-basic.ts. The CLI sends split and splitFromTabId (from ORCA_TAB_ID) through the new optional RPC fields in src/shared/rpc-contract/browser-tab-create-params.ts. Main forwards them on browser:requestTabCreate (browser-tab-creation.ts, browser-tab-renderer-create.ts) using the shared BrowserTabCreateRequest type. The renderer resolves the caller's pane in browser-tab-split-placement.ts: browserTabSplitTarget uses the caller's live group, then the active group, then the root group, and returns activate: false. The renderer bridge passes that target to createBrowserTab with the existing split option. I checked browser-tab-split-placement.ts at the reviewed head and it matches this behavior. Automated tests are reported in src/cli/browser.test.ts (flag forwarding, omission without the flag, invalid and empty direction rejection), browser-request-ipc-bridge.split.test.ts (caller-pane placement, active-pane fallback, caller workspace fallback, plain create), and the SSH executor test (refusal of split). The issue's coding requirements are met. Non-coding items in the PR text (manual checks, screenshots) are not assessed. The PR image captions in the objectives mention --split-right, but the code and the issue both use --split &lt;direction&gt;; this caption does not change the requirement.

Full details: Out of Scope Changes check

Explanation

Every changed file relates to #27369 or to its required support. The changes are: the CLI flag and its spec and tests; the new optional RPC fields; the main-process forwarding and rejection paths for headless serve, client-hosted pages, and SSH hosts; the renderer split-placement helpers and bridge; the shared BrowserTabSplitDirection and BrowserTabCreateRequest types, which replace duplicated inline IPC payload types in the preload API; and the bundled skill-guide documentation for the new flag. The fallbackWorktreeId field in the shared request type is already present on main, so carrying it in the shared type is a type-consolidation step needed by the same payload. The PR description reports a failing unrelated test (src/main/orcad/electron-serve-browser-process.test.ts). That file is not in the changed-file summary, so it is not a scope issue. This assessment relies on the whole-PR summary and the focused check of the placement helper. I did not re-read every changed hunk, so no unrelated change is demonstrated, and none is found.

Full details: Docstring Coverage

Explanation

Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 3 functions across 16 files. (1 skipped: 1 unsupported.)

Resolution

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

Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3


Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 376b57b3-6ce4-4f30-98dc-d0ca4a92a759
Commits

Reviewing files that changed from the base of the PR and between d334119 and 7786cc8.

Files selected for processing: 17
  • skill-guides/orca-cli/references/browser.md
  • src/cli/browser.test.ts
  • src/cli/bundled-skill-guides.ts
  • src/cli/handlers/browser-tab.ts
  • src/cli/specs/browser-basic.ts
  • src/main/browser/desktop-browser-bridge/desktop-browser-bridge-executor.test.ts
  • src/main/browser/desktop-browser-bridge/desktop-browser-bridge-executor.ts
  • src/main/runtime/browser/browser-tab-creation.ts
  • src/main/runtime/browser/browser-tab-renderer-create.ts
  • src/preload/api/ui-bridge-state-and-menu-commands.ts
  • src/preload/api/ui-command-event-api.ts
  • src/renderer/src/hooks/ipc-events/browser-request-ipc-bridge.split.test.ts
  • src/renderer/src/hooks/ipc-events/browser-request-ipc-bridge.ts
  • src/renderer/src/hooks/ipc-events/browser-tab-split-placement.ts
  • src/shared/browser-tab-create-request.ts
  • src/shared/browser-tab-split-direction.ts
  • src/shared/rpc-contract/browser-tab-create-params.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Comment thread src/cli/handlers/browser-tab.ts Resolved
@AmoabaKelvin
AmoabaKelvin force-pushed the feat/cli-tab-create-split branch from 39fa85c to ddfc4ec Compare October 30, 2026 04:04

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a5bea658-f46b-4bc1-9137-9ab481bcef55
Commits

Reviewing files that changed from the base of the PR and between 39fa85c and ddfc4ec.

Files selected for processing: 2
  • skill-guides/orca-cli/references/browser.md
  • src/cli/bundled-skill-guides.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.

- Without `--page`, a command goes to the worktree's current tab. That stays the agent's tab while it has had a command in the last 20 seconds or so, even after the user picks another (`tab current` reports it too), then moves to the user's pick.
- After `ORCA tab switch`, pass the new page's `browserPageId`.
- Browser commands default to the current worktree. `--page` reaches the page in any worktree unless you also pass `--worktree <selector>`. Use `--worktree all` only intentionally.
- `tab create --split <right|left|down|up>` opens the page in a new pane beside the calling terminal instead of as another tab; focus stays in the terminal.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor · Functional Correctness · Quick win

Document the unsupported split contexts.

tab create --split is rejected for headless serve, client-hosted pages, and SSH hosts. This rule presents the option as unconditional. Document the supported desktop context and these rejection cases. Regenerate src/cli/bundled-skill-guides.ts after updating this source guide.

kmizzi and others added 4 commits October 30, 2026 17:04
`orca tab create` could only add a tab to an existing pane, so an agent
had no way to put a page beside its terminal. `--split <right|left|down|up>`
creates a new pane next to the calling terminal (ORCA_TAB_ID), falling back
to the active pane, and opens the page there without taking focus.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01UNtbMA9iVj9T4rBUjn5u6W
The preload listener, its callback, the preload API contract and main's
sender each declared the payload separately, and the listener copy had
already drifted from the new split fields.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Creating an empty group and then filling it fails when main owns the
layout, because the window's group doesn't exist until main's frame
lands. createBrowserTab's split option carries both to whichever owner
draws them, so the rollback for a half-made pane goes away.

SSH hosts already cannot choose a new tab's group, so their CLI's split
is stripped like targetGroupId.
…can't happen

A CLI run outside its workspace's directory sends no workspace, so the
renderer fell back to the active one and missed the caller's terminal.
The caller's tab now picks the workspace when none was named.

An SSH host's split and an empty --split= both turned into a plain tab
reported as success; both are refused instead.
@AmoabaKelvin
AmoabaKelvin force-pushed the feat/cli-tab-create-split branch from ddfc4ec to e045dee Compare October 30, 2026 17:06

@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

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

⚠️ Outside diff range comments (1)

Minor · Do not send worktree with split requests. · browser-tab.ts:75-87

src/cli/handlers/browser-tab.ts:75-87
Minor · Functional Correctness · Quick win

Do not send worktree with split requests.

When --split and an explicit --worktree name different from the caller’s workspace are used, the CLI sends both worktree and splitFromTabId. The renderer gives worktree precedence, cannot find the caller there, and places the tab in that workspace’s active or root group instead of beside the calling terminal.

Suggested fix
     const result = await client.call<{ browserPageId: string }>(
       'browser.tabCreate',
       {
         url,
-        worktree,
         profileId,
-        ...(split ? { split, ...(callerTabId ? { splitFromTabId: callerTabId } : {}) } : {})
+        ...(split
+          ? { split, ...(callerTabId ? { splitFromTabId: callerTabId } : {}) }
+          : { worktree })
       },

Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9d087234-0555-4d7a-a7e9-f90eaef05ec8
Commits

Reviewing files that changed from the base of the PR and between ddfc4ec and e045dee.

Files selected for processing: 4
  • skill-guides/orca-cli/references/browser.md
  • src/cli/browser.test.ts
  • src/cli/bundled-skill-guides.ts
  • src/cli/specs/browser-basic.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.

@AmoabaKelvin
AmoabaKelvin merged commit 67d09d7 into main Oct 30, 2026
59 of 60 checks passed
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.

CLI: orca tab create cannot open a browser tab in a split pane

2 participants