Skip to content

Reuse existing tab groups for link opens - #36915

Merged
AmethystLiang merged 2 commits into
mainfrom
AmethystLiang/no-further-splitting-tab-if-already-two
Nov 1, 2026
Merged

AmethystLiang merged 2 commits into
mainfrom
AmethystLiang/no-further-splitting-tab-if-already-two

Conversation

@AmethystLiang

@AmethystLiang AmethystLiang commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 12 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​150 $\color{#cf222e}{\Huge{\mathbf{−}}}$​97 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​53
Prod 7 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​94 $\color{#cf222e}{\Huge{\mathbf{−}}}$​32 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​62

Problem

Opening a link from a pane could keep adding new splits even when another tab group was already available, making layouts crowded.

Solution

Reuse an existing neighboring group for link opens whenever possible. Only create a split when a single occupied group needs a separate destination, preserving the source pane and avoiding extra groups.

ELI5

Links now use an empty or nearby existing column before making another column.

What Changed

Updated browser, HTTP, file-preview, terminal, runtime, and editor link placement to reuse adjacent tab groups. Added split handling for editor file links only when the source is the only occupied group.

Why

This keeps multi-pane layouts stable while still preserving the source tab when a separate destination is needed.

Linked Issue

Fixes # TODO

Visual Proof

TODO: Attach before/after proof for this behavior change.

Testing

Updated focused automated tests covering browser, HTTP, file-preview, terminal, runtime, and editor link placement.

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

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

Considered security, cross-platform support, remote SSH, mobile, backwards compatibility, and performance; placement logic reuses existing tab groups and preserves lone-group splitting behavior.

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)

@coderabbitai

coderabbitai Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent 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: 71bf536e-c31e-42fb-9b44-a7876719206a
Commits

Reviewing files that changed from the base of the PR and between 410b7b9 and 28daa99.

Files selected for processing: 1
  • src/renderer/src/components/native-chat/NativeChatInlineVisual.link-placement.test.tsx

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

Walkthrough

Link opening now reuses another live group when one is available. When the source group is the only live group and is occupied, placement can create a side split. Browser and editor paths use these placement rules. Tests cover source-group actions, group reuse, split creation, and resulting tab and layout state.

Merge Risk: Minimal · up to 28daa

The reviewed test change aligns with the intended tab-group reuse behavior, with no actionable merge-blocking risk identified.

Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Description check Warning The description explains the problem, solution, user-facing behavior, affected areas, and automated test updates. However, it leaves required information incomplete: the linked issue is still TODO, vi… Replace Fixes # TODO with the actual linked issue. Attach before-and-after screenshots or video, or provide N/A with a valid reason if applicable. Report manual testing results and the status of pnpm lint, pnpm typecheck, `pnpm test…
Docstring Coverage Warning Docstring coverage is 55.56% 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: 3 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: reusing existing tab groups when opening links.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description explains the problem, solution, user-facing behavior, affected areas, and automated test updates. However, it leaves required information incomplete: the linked issue is still TODO, visual proof is still TODO for a UI behavior change, and validation status for manual testing and the required commands is not provided.

Resolution

Replace Fixes # TODO with the actual linked issue. Attach before-and-after screenshots or video, or provide N/A with a valid reason if applicable. Report manual testing results and the status of pnpm lint, pnpm typecheck, pnpm test, and pnpm build, including whether CI will cover them.

Full details: Docstring Coverage

Explanation

Docstring coverage is 55.56% 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 9 functions across 19 files.

Resolution

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

Finishing Touches
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

@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.

Nitpick comments: 1
src/renderer/src/store/slices/editor-open-link-placement.test.ts: 1

384-408: Trivial · Maintainability & Code Quality · Quick win

Assert the layout created by the lone-source editor-link open.

The test does not detect removal of the layoutByWorktree update. No other inspected openFileForLink test covers this new-split path. Assert the source and destination leaves after the first link opens.

Suggested fix
     expect(store.getState().groupsByWorktree['wt-1']).toHaveLength(2)
+    expect(store.getState().layoutByWorktree['wt-1']).toMatchObject({
+      type: 'split',
+      direction: 'horizontal',
+      first: { type: 'leaf', groupId: a },
+      second: { type: 'leaf', groupId: opened?.groupId }
+    })
     expect(store.getState().groupsByWorktree['wt-1']!.find((g) => g.id === a)?.activeTabId).toBe(
       'source'
     )

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: 81d0f745-39d3-4f4c-a3ad-f3e8571957b5
Commits

Reviewing files that changed from the base of the PR and between b10a6fe and 410b7b9.

Files selected for processing: 18
  • src/renderer/src/components/terminal-pane/terminal-file-link-actions.test.ts
  • src/renderer/src/lib/adjacent-link-open-group.ts
  • src/renderer/src/lib/browser-link-destination.test.ts
  • src/renderer/src/lib/browser-link-destination.ts
  • src/renderer/src/lib/browser-link-open-layout-owner.test.ts
  • src/renderer/src/lib/browser-link-open.test.ts
  • src/renderer/src/lib/file-preview-link-open.test.ts
  • src/renderer/src/lib/http-link-browser-placement.test.ts
  • src/renderer/src/lib/http-link-browser-placement.ts
  • src/renderer/src/lib/http-link-routing-store.test.ts
  • src/renderer/src/lib/http-link-source-placement.test.ts
  • src/renderer/src/lib/link-open-intent.ts
  • src/renderer/src/runtime/web-runtime-browser-link-open.test.ts
  • src/renderer/src/store/slices/editor-open-link-placement.test.ts
  • src/renderer/src/store/slices/editor/actions/open-file-apply.ts
  • src/renderer/src/store/slices/editor/tabs/editor-open-adjacent-group.test.ts
  • src/renderer/src/store/slices/editor/tabs/editor-open-adjacent-group.ts
  • src/renderer/src/store/slices/editor/tabs/editor-open-target-group.ts

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

@AmethystLiang
AmethystLiang merged commit b4c93ba into main Nov 1, 2026
42 checks passed
DoozyX added a commit to DoozyX/orca that referenced this pull request Nov 1, 2026
Takes upstream's orchestration wholesale: schema v46, no leases, no fork v44-v49
migrations, no typed-wait/takeover/preserved-gate behavior. Keeps the fork's
review-metrics CLI, Claude project-group config-dir binding, input size prop and
codex-independent launch. Upstream's reuse-tab-group link opening (stablyai#36915) replaces
the fork's fix; the fork sidebar inline agent disclosures are dropped.

Existing orchestration.db files need PRAGMA user_version = 43 before first launch so
upstream's guarded v44-v46 steps add their columns.
audichuang added a commit to audichuang/orca that referenced this pull request Nov 2, 2026
…apply.ts

Upstream stablyai#36915 grew open-file-apply.ts to 299 lines and the fork's git
owner lines pushed it to 302, past max-lines. The fork's code is already a
helper, so the new split-group block moves to open-file-link-split.ts.
audichuang added a commit to audichuang/orca that referenced this pull request Nov 3, 2026
…apply.ts

Upstream stablyai#36915 grew open-file-apply.ts to 299 lines and the fork's git
owner lines pushed it to 302, past max-lines. The fork's code is already a
helper, so the new split-group block moves to open-file-link-split.ts.
audichuang added a commit to audichuang/orca that referenced this pull request Nov 4, 2026
…apply.ts

Upstream stablyai#36915 grew open-file-apply.ts to 299 lines and the fork's git
owner lines pushed it to 302, past max-lines. The fork's code is already a
helper, so the new split-group block moves to open-file-link-split.ts.
audichuang added a commit to audichuang/orca that referenced this pull request Nov 5, 2026
…apply.ts

Upstream stablyai#36915 grew open-file-apply.ts to 299 lines and the fork's git
owner lines pushed it to 302, past max-lines. The fork's code is already a
helper, so the new split-group block moves to open-file-link-split.ts.
audichuang added a commit to audichuang/orca that referenced this pull request Nov 5, 2026
…apply.ts

Upstream stablyai#36915 grew open-file-apply.ts to 299 lines and the fork's git
owner lines pushed it to 302, past max-lines. The fork's code is already a
helper, so the new split-group block moves to open-file-link-split.ts.
audichuang added a commit to audichuang/orca that referenced this pull request Nov 6, 2026
…apply.ts

Upstream stablyai#36915 grew open-file-apply.ts to 299 lines and the fork's git
owner lines pushed it to 302, past max-lines. The fork's code is already a
helper, so the new split-group block moves to open-file-link-split.ts.
audichuang added a commit to audichuang/orca that referenced this pull request Nov 7, 2026
…apply.ts

Upstream stablyai#36915 grew open-file-apply.ts to 299 lines and the fork's git
owner lines pushed it to 302, past max-lines. The fork's code is already a
helper, so the new split-group block moves to open-file-link-split.ts.
audichuang added a commit to audichuang/orca that referenced this pull request Nov 8, 2026
…apply.ts

Upstream stablyai#36915 grew open-file-apply.ts to 299 lines and the fork's git
owner lines pushed it to 302, past max-lines. The fork's code is already a
helper, so the new split-group block moves to open-file-link-split.ts.
audichuang added a commit to audichuang/orca that referenced this pull request Nov 8, 2026
…apply.ts

Upstream stablyai#36915 grew open-file-apply.ts to 299 lines and the fork's git
owner lines pushed it to 302, past max-lines. The fork's code is already a
helper, so the new split-group block moves to open-file-link-split.ts.
audichuang added a commit to audichuang/orca that referenced this pull request Nov 10, 2026
…apply.ts

Upstream stablyai#36915 grew open-file-apply.ts to 299 lines and the fork's git
owner lines pushed it to 302, past max-lines. The fork's code is already a
helper, so the new split-group block moves to open-file-link-split.ts.
audichuang added a commit to audichuang/orca that referenced this pull request Nov 10, 2026
…apply.ts

Upstream stablyai#36915 grew open-file-apply.ts to 299 lines and the fork's git
owner lines pushed it to 302, past max-lines. The fork's code is already a
helper, so the new split-group block moves to open-file-link-split.ts.
audichuang added a commit to audichuang/orca that referenced this pull request Nov 12, 2026
…apply.ts

Upstream stablyai#36915 grew open-file-apply.ts to 299 lines and the fork's git
owner lines pushed it to 302, past max-lines. The fork's code is already a
helper, so the new split-group block moves to open-file-link-split.ts.
audichuang added a commit to audichuang/orca that referenced this pull request Nov 13, 2026
…apply.ts

Upstream stablyai#36915 grew open-file-apply.ts to 299 lines and the fork's git
owner lines pushed it to 302, past max-lines. The fork's code is already a
helper, so the new split-group block moves to open-file-link-split.ts.
audichuang added a commit to audichuang/orca that referenced this pull request Nov 14, 2026
…apply.ts

Upstream stablyai#36915 grew open-file-apply.ts to 299 lines and the fork's git
owner lines pushed it to 302, past max-lines. The fork's code is already a
helper, so the new split-group block moves to open-file-link-split.ts.
audichuang added a commit to audichuang/orca that referenced this pull request Nov 16, 2026
…apply.ts

Upstream stablyai#36915 grew open-file-apply.ts to 299 lines and the fork's git
owner lines pushed it to 302, past max-lines. The fork's code is already a
helper, so the new split-group block moves to open-file-link-split.ts.
audichuang added a commit to audichuang/orca that referenced this pull request Nov 18, 2026
…apply.ts

Upstream stablyai#36915 grew open-file-apply.ts to 299 lines and the fork's git
owner lines pushed it to 302, past max-lines. The fork's code is already a
helper, so the new split-group block moves to open-file-link-split.ts.
audichuang added a commit to audichuang/orca that referenced this pull request Nov 18, 2026
…apply.ts

Upstream stablyai#36915 grew open-file-apply.ts to 299 lines and the fork's git
owner lines pushed it to 302, past max-lines. The fork's code is already a
helper, so the new split-group block moves to open-file-link-split.ts.
audichuang added a commit to audichuang/orca that referenced this pull request Nov 19, 2026
…apply.ts

Upstream stablyai#36915 grew open-file-apply.ts to 299 lines and the fork's git
owner lines pushed it to 302, past max-lines. The fork's code is already a
helper, so the new split-group block moves to open-file-link-split.ts.
audichuang added a commit to audichuang/orca that referenced this pull request Nov 20, 2026
…apply.ts

Upstream stablyai#36915 grew open-file-apply.ts to 299 lines and the fork's git
owner lines pushed it to 302, past max-lines. The fork's code is already a
helper, so the new split-group block moves to open-file-link-split.ts.
audichuang added a commit to audichuang/orca that referenced this pull request Nov 20, 2026
…apply.ts

Upstream stablyai#36915 grew open-file-apply.ts to 299 lines and the fork's git
owner lines pushed it to 302, past max-lines. The fork's code is already a
helper, so the new split-group block moves to open-file-link-split.ts.
audichuang added a commit to audichuang/orca that referenced this pull request Nov 20, 2026
…apply.ts

Upstream stablyai#36915 grew open-file-apply.ts to 299 lines and the fork's git
owner lines pushed it to 302, past max-lines. The fork's code is already a
helper, so the new split-group block moves to open-file-link-split.ts.
audichuang added a commit to audichuang/orca that referenced this pull request Nov 21, 2026
…apply.ts

Upstream stablyai#36915 grew open-file-apply.ts to 299 lines and the fork's git
owner lines pushed it to 302, past max-lines. The fork's code is already a
helper, so the new split-group block moves to open-file-link-split.ts.
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.

1 participant