Skip to content

Open file links beside their source tab's group - #30399

Merged
AmethystLiang merged 4 commits into
mainfrom
open-files-in-tab-next-to-it
Oct 18, 2026
Merged

AmethystLiang merged 4 commits into
mainfrom
open-files-in-tab-next-to-it

Conversation

@AmethystLiang

@AmethystLiang AmethystLiang commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 13 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1140 $\color{#cf222e}{\Huge{\mathbf{−}}}$​113 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1027
Prod 26 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​639 $\color{#cf222e}{\Huge{\mathbf{−}}}$​153 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​486

Problem

When you click a file link in a terminal or agent chat, Orca opened the file in whichever editor group was active. That often was not the pane next to the chat or terminal you clicked from, so the file landed somewhere you were not looking.

Solution

File links now open in the group next to the tab that printed them. If that tab has no suitable neighbor, the file opens in its own group. A new "Open in this group" row in the link menu pins the file to the clicked tab's own group. If that group is gone or the link resolves to something that cannot open there (a browser page, a folder, or a file on another workspace), Orca shows an error toast and does not open anything else.

ELI5

You click a file name in a terminal or chat. Orca now opens that file in the panel beside where you clicked, not in some random panel.

What Changed

  • Terminal and agent-chat file links carry their source tab id into the open path.
  • At click time, the source tab and its group are captured, so focus changes during path resolution do not move the file.
  • Automatic placement ranks neighboring groups: a neighbor that already has the file, then any group with it, then a neighbor showing an editor, then any neighbor, then the source group.
  • "Open in this group" appears only when the source group has company (more than one group). It refuses rather than falling back if the target is unusable.
  • Empty split panes are no longer removed during tab reconciliation, so a fresh empty neighbor survives until a file is opened into it. Only groups emptied by stale-tab cleanup are still collapsed.
  • New strings are added to all locale files.

Why

The source tab is captured when you click, so the file opens where you expect even if the path takes a moment to resolve. Refusing an explicit request beats silently opening it somewhere else. Automatic placement uses the existing layout tree rather than a new layout model.

Linked Issue

If you do not have one and are an outside contributors, your PR wiil be ignored. Refs is not sufficient. Link an actual issue

Fixes # (TODO: no issue linked)

Visual Proof

TODO: add BEFORE/AFTER video or screenshots of link opening beside the source group.

Testing

  • Unit tests added for placement ranking, link-intent capture, explicit-group refusal, reveal scoping, and empty-group reconciliation.

  • TODO: manual test notes and platforms tested (not confirmed in this PR).

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

AI Disclosure

TODO: confirm whether AI tooling was used.

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

Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance.

TODO: reviewer to confirm the SSH and runtime host paths (the resolved execution host is now computed before the sibling-workspace check), Windows/WSL path mapping, and the mobile and remote wire surfaces are unaffected.

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)

Clicking a file link in a terminal or agent chat now opens the file in an editor next to that tab, not in whichever group happens to have focus. A new "Open in this group" row pins the file to the source group when that group has neighbors.

- Capture the source tab at click time, so focus changes during path resolution don't redirect the file.
- Rank candidate groups by adjacency: a neighbor already showing the file, then a neighbor showing an editor, then any neighbor, then the source group.
- "Open in this group" never falls back to a browser, system app, or other group. If the group is gone or the target is not an editor, it shows a toast and does nothing.
- Line reveals target the exact view that was opened, and are dropped if that view closes before the editor applies them.
Reconciliation removed every empty group, so an empty split pane the user had made beside a tab was collapsed on the next pass. A file link opened from that tab then landed in the source group instead of the empty pane. Reconciliation now removes only groups that stale-tab cleanup emptied, and keeps panes that were already empty. Tests cover terminal and agent-session sources in both worktree and folder workspaces.
@coderabbitai

coderabbitai Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

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: 2becbbd2-5f74-4ec7-851c-d157c9cfa608
📥 Commits

Reviewing files that changed from the base of the PR and between c907ea2 and e939ee2.

📒 Files selected for processing: 2
  • src/renderer/src/components/terminal-pane/terminal-file-open-routing.ts
  • src/renderer/src/components/terminal-pane/terminal-link-client-local-file.test.ts
🚧 Files skipped from review as they are similar to previous changes: 1
  • src/renderer/src/components/terminal-pane/terminal-file-open-routing.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

File links now carry their source tab ID from native-chat and terminal contexts. The editor resolves automatic placement from the workspace layout and supports explicit opening in the source tab group. Terminal routing refuses explicit requests that cannot retain the requested scope and displays a translated error. Line reveals target the opened view and are guarded against stale requests or changed views.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to e939e

Desktop terminal and chat links retain source-tab context, and automatic placement follows the source tab’s current group. No concrete material regression is established, so the change appears ready for normal checks.

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, user-facing behavior, implementation, and automated tests. However, required information remains incomplete: no linked issue is provided, required visual proof is… Add the linked issue, attach before-and-after screenshots or video, document manual testing and tested platforms, complete the AI disclosure, resolve the SSH/runtime, Windows/WSL, mobile, and remote-surface review notes, and update the chec…
Docstring Coverage Warning Docstring coverage is 32.76% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 58 functions across 33 files. 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: opening file links beside the source tab's group.
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, user-facing behavior, implementation, and automated tests. However, required information remains incomplete: no linked issue is provided, required visual proof is still a TODO, manual testing and supported platforms are not confirmed, AI disclosure is unresolved, and the review checklist is incomplete.

Resolution

Add the linked issue, attach before-and-after screenshots or video, document manual testing and tested platforms, complete the AI disclosure, resolve the SSH/runtime, Windows/WSL, mobile, and remote-surface review notes, and update the checklist after verification.

  • Fix all pre-merge checks with AI
✨ 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: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a547f6af-ff5f-4eec-985f-01868552dc8f
📥 Commits

Reviewing files that changed from the base of the PR and between 3af9c22 and c907ea2.

📒 Files selected for processing: 38
  • src/renderer/src/components/native-chat/native-chat-file-link.test.ts
  • src/renderer/src/components/native-chat/native-chat-file-link.ts
  • src/renderer/src/components/native-chat/native-chat-link-target-actions.ts
  • src/renderer/src/components/native-chat/native-chat-owner-selectors.test.tsx
  • src/renderer/src/components/terminal-pane/floating-file-link-selection.test.ts
  • src/renderer/src/components/terminal-pane/terminal-file-link-actions.test.ts
  • src/renderer/src/components/terminal-pane/terminal-file-link-actions.ts
  • src/renderer/src/components/terminal-pane/terminal-file-link-editor-open.ts
  • src/renderer/src/components/terminal-pane/terminal-file-link-hit-testing.ts
  • src/renderer/src/components/terminal-pane/terminal-file-open-in-group-toast.ts
  • src/renderer/src/components/terminal-pane/terminal-file-open-routing.ts
  • src/renderer/src/components/terminal-pane/terminal-link-click-fallback.test.ts
  • src/renderer/src/components/terminal-pane/terminal-link-file-open-routing.test.ts
  • src/renderer/src/components/terminal-pane/terminal-link-handlers-test-fixtures.ts
  • src/renderer/src/components/terminal-pane/terminal-link-handlers-test-harness.ts
  • src/renderer/src/components/terminal-pane/terminal-link-handlers.ts
  • src/renderer/src/components/terminal-pane/terminal-link-open-beside-source.test.ts
  • src/renderer/src/components/terminal-pane/terminal-link-osc-file-targets.test.ts
  • src/renderer/src/components/terminal-pane/terminal-link-wsl-path-mapping.test.ts
  • src/renderer/src/components/terminal-pane/terminal-osc-link-routing.ts
  • src/renderer/src/components/terminal-pane/terminal-pane-mount-preparation.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/fr.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/store/slices/editor-open-link-placement.test.ts
  • src/renderer/src/store/slices/editor/actions/open-file-action.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
  • src/renderer/src/store/slices/editor/tabs/editor-tab-content-type.ts
  • src/renderer/src/store/slices/editor/types/editor-files-slice.ts
  • src/renderer/src/store/slices/editor/types/editor-open-link-intent.ts
  • src/renderer/src/store/slices/tabs/tabs-reconciliation-empty-groups.test.ts
  • src/renderer/src/store/slices/tabs/tabs-reconciliation.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.

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