Skip to content

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

Closed
kmizzi wants to merge 2 commits into
stablyai:mainfrom
kmizzi:feat/cli-browser-split
Closed

kmizzi wants to merge 2 commits into
stablyai:mainfrom
kmizzi:feat/cli-browser-split

Conversation

@kmizzi

@kmizzi kmizzi commented Oct 11, 2026

Copy link
Copy Markdown
Contributor

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. If you wanted the page beside your terminal, you had to drag the tab into a split yourself. The CLI had no way to do it.

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 stays in the terminal. Without --split, nothing changes, and the request payload is the same shape as before.

How it works:

  • 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 (browser-tab-create-params.ts): two new optional fields.
  • Main (runtime-browser-commands-browser-tab-create.ts): forwards them on the existing browser:requestTabCreate IPC. Hosts with no desktop window (headless serve, client-hosted pages) reject --split with a clear error instead of silently making a plain tab.
  • Renderer (browser-tab-split-placement.ts, browser-request-ipc-bridge.ts): resolves the source pane, either the group holding the caller's terminal tab or the active group if that tab is unknown. It calls the existing createEmptySplitGroup(..., { activate: false }) and creates the browser tab with targetGroupId set to the new group. If creating the tab throws, the empty pane is closed again.

Why

The building blocks already existed: createEmptySplitGroup and createBrowserTab({ targetGroupId }) are what "open preview to the side" uses in file-preview.ts. The CLI just could not reach them. This reuses that path instead of adding a new layout mechanism.

Alternatives considered:

  • A separate tab split command that moves an existing tab. That takes two calls and needs a page id round-trip. Creating the tab in the split covers the common case in one step.
  • Splitting from the active pane only. That puts the page wherever the user last clicked, which may not be the agent's terminal. Using ORCA_TAB_ID anchors it to the caller, with the active pane as the fallback.
  • Reusing an existing sibling pane, as file preview does. --split creates a new pane every time, which matches terminal split. Callers that want to reuse a pane can keep using a plain tab create.

Linked Issue

Fixes #27369

Visual Proof

The screenshots come from one isolated macOS dev session (ORCA_BACKGROUND_LAUNCH=1, separate user-data directory, driven over CDP). Each command was run from inside an Orca terminal. The page body is blank because the background window does not paint guest contents; the tab title "Example Domain" shows the page loaded.

Before: orca tab create --url https://example.com After: orca tab create --url https://example.com --split right
tab-create-before.png tab-create-split-after.png

Store state after the --split right run: the layout is split / horizontal with the terminal group first and the new browser group second, and activeGroupIdByWorktree still points at the terminal's group.

Testing

  • I manually tested these changes locally (macOS dev build, see above)
  • Automated tests added/updated

New tests:

  • src/cli/browser.test.ts: --split sends split and splitFromTabId; a plain create leaves both out; an unknown direction is rejected before any RPC.
  • browser-tab-create-schema.test.ts: the new fields are optional, all four directions parse, and a bad direction is rejected.
  • browser-tab-split-placement.test.ts: the split goes beside the caller's terminal, falls back to the active pane, then the root group, and never takes focus.
  • browser-request-ipc-bridge.split.test.ts: the end-to-end renderer handler places the tab in the new group, leaves the layout untouched without split, and removes the empty pane when creation fails.

Ran: pnpm tc (pass), oxlint and oxfmt on changed files (clean), verify:rpc-params-catalog, verify:bundled-skill-guides, and 42 related test files / 322 tests (pass), including the existing browser tab-create runtime, publication, client-hosted and folder-workspace suites.

Not tested on Linux, Windows or SSH-backed workspaces. The change is platform-neutral (no paths, shortcuts or processes) and runs only in the renderer that owns the window.

AI Disclosure

Written with Claude Code (Claude Opus 5.5). I reviewed the change and the manual test above.

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 strips them and makes a plain tab, which is a safe downgrade. An older CLI never sends them.
  • SSH / paired runtimes: the split is applied by the desktop renderer that owns the window. Client-hosted placement and headless serve reject --split explicitly.
  • Mobile: unaffected. split is only set by the CLI flag.
  • Unrelated, found while testing: on current main, pnpm dev crashes the workbench in the renderer with growing-byte-buffer.js does not provide an export named 'GrowingByteBuffer'. src/shared/quick-open-listing-limits.ts (via quick-open-file-list.ts) imports @orca/process-host/growing-byte-buffer, and the renderer resolves it to the CommonJS dist build. This looks like a regression from Extract subprocess handling into @orca/process-host #26963. For the screenshots I worked around it locally by adding the orca-source resolve condition to the renderer config. That change is not part of this PR.

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). Typecheck and related tests pass locally; the full lint/test/build is left to CI.

🤖 Generated with Claude Code

https://claude.ai/code/session_01UNtbMA9iVj9T4rBUjn5u6W

@coderabbitai

coderabbitai Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Important

Review skipped

We couldn't safely recover the incremental review. No full review was started, and the last reviewed checkpoint was preserved. Retry later, or explicitly request a full review by commenting @coderabbitai full review.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4850304c-1d0b-4b90-949a-b478b71aad5f
📥 Commits

Reviewing files that changed from the base of the PR and between 6408afd963b359f636495c1c036e399455002a2e and 328cd2c65facdd8de2e632c718d28ee4728ab77d.

📒 Files selected for processing (4)
  • src/main/runtime/runtime-browser-commands-list-logical-browser-tabs.ts
  • src/preload/api/ui-bridge-state-and-menu-commands.ts
  • src/preload/api/ui-command-event-api.ts
  • src/shared/browser-tab-create-request.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/runtime/runtime-browser-commands-list-logical-browser-tabs.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.

📝 Walkthrough

The CLI now accepts tab create --split with the directions right, left, down, or up. It passes the split direction and optional caller tab ID through the runtime to the renderer. The renderer creates an inactive split group and targets the new browser tab to it. If tab creation fails, the renderer closes the empty split group. The change also adds validation, tests, and CLI documentation.

Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 328cd

No actionable split-tab issue is identified in the supplied changes; this review does not block merging after normal checks.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 15 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: adding split-pane browser tab creation through the CLI.
Description check Passed The description follows the required template and covers the user impact, implementation, rationale, linked issue, visual proof, testing, compatibility considerations, AI disclosure, and checklist. It…
Linked Issues check Passed Issue #27369 requires a CLI split option that opens the browser beside the calling terminal and keeps terminal focus. The reviewed PR adds validation for all four directions, sends the caller tab ID, …
Out of Scope Changes check Passed The changed files support issue #27369. The shared BrowserTabCreateRequest type removes duplicate IPC payload declarations and prevents contract drift. The added documentation and tests describe or …
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

🔇 Additional comments (15)
src/shared/browser-tab-split-direction.ts (1)

1-6: LGTM!

src/shared/rpc-contract/browser-tab-create-params.ts (1)

5-5: LGTM!

Also applies to: 18-22

src/cli/specs/browser-basic.ts (1)

200-202: LGTM!

src/cli/handlers/browser-tab.ts (1)

15-15: LGTM!

Also applies to: 73-76, 78-88

src/cli/browser.test.ts (1)

186-229: LGTM!

skill-guides/orca-cli/references/browser.md (1)

39-39: LGTM!

Also applies to: 54-54

src/main/runtime/runtime-browser-commands-browser-tab-create.ts (1)

5-5: LGTM!

Also applies to: 34-35, 57-66, 156-157

src/main/runtime/runtime-browser-commands-list-logical-browser-tabs.ts (1)

5-5: LGTM!

Also applies to: 108-109, 144-145

src/preload/api/ui-command-event-api.ts (1)

100-101: LGTM!

src/main/runtime/rpc/methods/browser-tab-create-schema.test.ts (1)

4-4: LGTM!

Also applies to: 40-53

src/renderer/src/hooks/ipc-events/browser-tab-split-placement.ts (1)

14-33: LGTM!

src/renderer/src/hooks/ipc-events/browser-tab-split-placement.test.ts (1)

4-50: LGTM!

src/renderer/src/hooks/ipc-events/browser-request-ipc-bridge.ts (1)

10-10: LGTM!

Also applies to: 58-78

src/renderer/src/hooks/ipc-events/browser-request-ipc-bridge.split.test.ts (1)

1-124: LGTM!

src/preload/api/ui-bridge-state-and-menu-commands.ts (1)

157-158: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

⚠️ Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.

The listener's data type omits the new split fields.

The callback type now has split and splitFromTabId. The inner listener data type (Lines 163-171) does not. The call callback(data) still compiles because the fields are optional. The runtime values pass through. But the two types now disagree. This is the duplicated-IPC-type problem from the retrieved learning. Extract one shared payload type and use it in both places, and in ui-command-event-api.ts.

Source: Learnings


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 43f4c268-fee4-41f0-b44f-c627b2a27677
📥 Commits

Reviewing files that changed from the base of the PR and between 666d990 and 6408afd963b359f636495c1c036e399455002a2e.

📒 Files selected for processing (15)
  • skill-guides/orca-cli/references/browser.md
  • src/cli/browser.test.ts
  • src/cli/handlers/browser-tab.ts
  • src/cli/specs/browser-basic.ts
  • src/main/runtime/rpc/methods/browser-tab-create-schema.test.ts
  • src/main/runtime/runtime-browser-commands-browser-tab-create.ts
  • src/main/runtime/runtime-browser-commands-list-logical-browser-tabs.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.test.ts
  • src/renderer/src/hooks/ipc-events/browser-tab-split-placement.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.

@kmizzi

kmizzi commented Oct 11, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the CodeRabbit note on the duplicated IPC payload type in 328cd2c: BrowserTabCreateRequest (src/shared/browser-tab-create-request.ts) is now the single type used by the preload listener, its callback, the PreloadApi contract and main's sender. Typecheck, lint and the 42 related test files still pass.

I left the docstring-coverage warning alone on purpose. The repo's AGENTS.md asks for short comments only where something is not obvious, and the touched functions follow the surrounding code.

@kmizzi

kmizzi commented Oct 11, 2026

Copy link
Copy Markdown
Contributor Author

Could a maintainer approve the CI workflows for this PR when you have a moment? They're waiting for approval because it comes from a fork. The branch merges cleanly with main, and the CodeRabbit feedback is addressed. Thanks.

@kmizzi
kmizzi force-pushed the feat/cli-browser-split branch from 328cd2c to 8db17cd Compare October 14, 2026 16:37
kmizzi and others added 2 commits October 16, 2026 20:55
`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]>
@AmoabaKelvin

Copy link
Copy Markdown
Collaborator

Thanks @kmizzi, this is a great addition. Your branch was ~2,900 commits behind main and conflicted, so I carried it over in #35665 with your two commits rebased as-is. On top: the renderer now uses createBrowserTab's split option so the pane and the tab are created together (the empty-group-then-fill step breaks when main owns the layout), and SSH hosts get split stripped like targetGroupId. I'll leave this open until that one merges.

@nwparker

nwparker commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Closing this PR because your commits were rebased and merged via #35665, which also closed #27369 as completed. Thank you for the contribution!

@nwparker nwparker closed this Dec 1, 2026
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

3 participants