Skip to content

Native chat: open files from tool rows through the terminal's file link menu - #26511

Merged
brennanb2025 merged 2 commits into
mainfrom
brennanb2025/native-chat-open-file
Oct 8, 2026
Merged

brennanb2025 merged 2 commits into
mainfrom
brennanb2025/native-chat-open-file

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

Native chat shows which files an agent reads or edits, but the tool filenames were plain text. Now those filenames and file links in replies open the same file menu as terminal links.

What Changed

Read, Write, Edit, MultiEdit and patch/edit cards link their filenames. A plain click uses the terminal setting: show file actions, open directly, or do nothing. The menu offers Open file, the local default app or remote Download & open, and local Reveal. Platform Cmd/Ctrl opens in Orca; Shift opens the default app. The filename action does not expand the surrounding row. Deleted cards stay unlinked, renamed cards use the new path, and Grep/Glob stay unlinked.

Terminal and chat build the menu from one shared function and retain the existing host-routed open/download operations. Review fixes preserve keyboard modifiers, distinguish literal tool filenames from reply path:line locations, resolve parent-relative paths correctly, and honor do-nothing before unresolved-path feedback.

Why

Users need to inspect the files an agent names. Reusing the existing terminal menu keeps the available actions and settings consistent across both surfaces. Opening a diff instead would duplicate the edit cards’ existing inline expansion; linking search folders would imply a file target the tool did not identify.

Linked Issue

Requested directly by a maintainer; no separate issue.

Visual Proof

Hidden Electron on M4Air, genuine rebuilt main before and final dc59cc after. All frames are uncropped; menus were captured after their animations settled. Both tool and reply Open file actions were followed by visible fixture contents in the editor.

Before: Read filename is plain text

Before: plain Read filename

After: tool-row file actions

After: tool-row file menu

After: reply-link file actions

After: reply file menu

After: opened file with loaded contents

Opened file contents

Testing

355 desktop tests and five actual mobile routing tests passed; scoped web typecheck and all 22 static checks passed. Fresh readiness added 299 passing focused checks. Mobile routing used an isolated harness; no Expo build or full mobile typecheck is claimed. M4Air hidden real-chat checks passed tool/reply menus, both Open file actions with loaded editor contents, keyboard activation without expansion, click preferences and exact file targets. The initial browser identity CI failure passed on the single rerun of unchanged dc59cc (rerun job); final CI is green: 21 successful checks and 16 conditional skips, including aggregate verification. All ten desktop shards, static analysis/typecheck, relay integration, both packaging jobs, and mobile verification/bundle passed.

Main baseline b1cd858 reproduces the two lone-surrogate shutdown-layout failures. The windowing and remote snapshot suites passed their one main baseline run; their earlier reported flakes remain unclassified.

  • I manually tested these changes locally
  • Automated tests added/updated

Review

Three fresh reviewers examined the whole PR, including an independent architecture sketch, interaction/path reproductions and performance/host routing. Four P2 findings were fixed at dc59cc7: keyboard modifier loss, literal filenames parsed as reply positions, parent-relative path joining, and unresolved feedback under do-nothing. A fresh final reviewer completed all eight readiness sections without counsel and found no P0/P1 or new fix regression. One P2 is explicitly deferred: a POSIX relative filename like a:12 is mistaken for a Windows drive path; ./a:12 or an absolute path works. Changing shared drive classification at this stage would expand platform risk while Windows app QA is unavailable.

Agent skill upstream boundary

  • Not applicable; no upstream skill source copied.

Notes

No persisted state or remote protocol changes. The shared markdown route also has a mobile consumer; existing mobile behavior must remain covered by its route tests. SSH is partially verified: a live Linux target proved host-specific tool/reply menus, reply remote editor contents and missing-file feedback using exact candidate modules, but that run shared another checkout’s renderer. The final isolated native-pane attempt did not complete and is explicitly unverified. Windows/WSL app validation, OS default-app/Reveal execution, and a full mobile build remain unverified.

Author: @BrennanKB5

Checklist

  • This PR is small and focused
  • Problem, before/after, mechanism and alternatives explained
  • Before/after visual evidence attached
  • Final correctness, security and performance review complete
  • Cross-platform, SSH/remote and compatibility impact considered; app QA limits stated
  • Final validation complete within the stated, accepted limits

…over

Tool rows that name a file (Read, Write, Edit, edit cards) now link the
file name. Chat file links, in tool rows and in reply text, show the same
popover the terminal shows for file paths, built from one shared function.
@coderabbitai

coderabbitai Bot commented Oct 8, 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: 0ec2a761-0e6b-47db-8bab-3537c58f0c66
📥 Commits

Reviewing files that changed from the base of the PR and between 05509be and dc59cc7.

📒 Files selected for processing (11)
  • mobile/src/components/markdown-href-routing.test.ts
  • src/renderer/src/components/native-chat/NativeChatToolFileTarget.test.tsx
  • src/renderer/src/components/native-chat/NativeChatToolFileTarget.tsx
  • 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/use-native-chat-file-link-click.test.tsx
  • src/renderer/src/components/native-chat/use-native-chat-file-link-click.ts
  • src/renderer/src/lib/terminal-path-normalization.test.ts
  • src/renderer/src/lib/terminal-path-normalization.ts
  • src/shared/native-chat-href-routing.test.ts
  • src/shared/native-chat-href-routing.ts

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


📝 Walkthrough

Walkthrough

Native chat file targets support optional link handling in tool rows and diff cards. File-link clicks use configured behavior to open files directly, request file actions, or do nothing. The native chat link-actions hook supplies the action request callback. Deleted-file targets do not receive a link handler. Literal file hrefs preserve paths without interpreting location suffixes, and file paths resolve against the worktree.

Priority: ⬇️ Low

Merge Risk: 🟡 Moderate · up to dc59c

Some keyboard and screen-reader users may be unable to access file links in tool rows and diff cards. Move the link outside the toggle button before merging.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 52.63% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 19 functions across 17 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title clearly and concisely describes the primary change: opening files from native-chat tool rows through the terminal file-link menu.
Description check ✅ Passed The description covers the required sections, user-facing behavior, implementation approach, rationale, visual proof, testing, review status, compatibility considerations, and checklist. It states tha…
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
  • Autopilot · 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: 2


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ed841ff2-abd2-4a19-be52-763c3f9ba6e3
📥 Commits

Reviewing files that changed from the base of the PR and between b1cd858 and 05509be.

📒 Files selected for processing (10)
  • src/renderer/src/components/native-chat/NativeChatDiffCard.tsx
  • src/renderer/src/components/native-chat/NativeChatToolFileTarget.test.tsx
  • src/renderer/src/components/native-chat/NativeChatToolFileTarget.tsx
  • src/renderer/src/components/native-chat/NativeChatToolLine.tsx
  • src/renderer/src/components/native-chat/NativeChatToolRunMemberList.tsx
  • src/renderer/src/components/native-chat/native-chat-link-click-behavior.ts
  • src/renderer/src/components/native-chat/use-native-chat-file-link-click.test.tsx
  • src/renderer/src/components/native-chat/use-native-chat-file-link-click.ts
  • src/renderer/src/components/native-chat/use-native-chat-link-actions.ts
  • src/renderer/src/components/terminal-pane/terminal-file-link-actions.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.

Comment on lines +28 to +53
return (
<span
role="link"
tabIndex={0}
className={cn(
className,
'cursor-pointer rounded-sm underline-offset-2 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring'
)}
title={path}
aria-label={path}
onClick={(event) => {
// The row around this is its expand button; opening the file must not also toggle it.
event.stopPropagation()
onLinkClick(event, createNativeChatFileHref(path))
}}
onKeyDown={(event) => {
if (event.key === 'Enter' || event.key === ' ') {
event.preventDefault()
event.stopPropagation()
event.currentTarget.click()
}
}}
>
{label}
</span>
)

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.

🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

The role="link" span sits inside a <button>. This nests interactive content.

Both NativeChatToolLine and NativeChatDiffCard render this target inside the row's <button>. Interactive content inside a button is invalid. Screen readers flatten a button's children, so many of them do not expose the inner link. The tests pass only because happy-dom does not enforce this rule. Keyboard users get two tab stops, and the inner one can be unreachable in some assistive technologies. Move the link out of the button. Render the row as a flex container with a sibling toggle button, or put the file target after the button. The copy button in NativeChatDiffCard already uses this layout.

Based on learnings: "do not nest interactive elements (e.g., a button inside an anchor/link, or a link inside a button)."

Source: Learnings

Comment on lines +38 to +52
onClick={(event) => {
// The row around this is its expand button; opening the file must not also toggle it.
event.stopPropagation()
onLinkClick(event, createNativeChatFileHref(path))
}}
onKeyDown={(event) => {
if (event.key === 'Enter' || event.key === ' ') {
event.preventDefault()
event.stopPropagation()
event.currentTarget.click()
}
}}
>
{label}
</span>

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

sed -n '50,75p' src/renderer/src/components/sidebar/comment-markdown-element-renderers.tsx
sed -n '250,280p' src/renderer/src/components/sidebar/comment-markdown-element-renderers.tsx
sed -n '28,55p' src/renderer/src/components/native-chat/NativeChatToolFileTarget.tsx

Repository: stablyai/orca

Length of output: 3178


🏁 Script executed:

rg -n -F --glob '*.tsx' --glob '*.ts' -- 'createDocumentCommentMarkdownComponents' src/renderer/src
rg -n -F --glob '*.tsx' --glob '*.ts' -- 'useNativeChatFileLinkClick' src/renderer/src
sed -n '1,105p' src/renderer/src/components/native-chat/use-native-chat-file-link-click.ts
sed -n '35,72p' src/renderer/src/components/sidebar/comment-markdown-element-renderers.tsx
sed -n '1,75p' src/renderer/src/components/native-chat/NativeChatToolFileTarget.tsx

Repository: stablyai/orca

Length of output: 10793


🏁 Script executed:

rg -n -F --glob '*.tsx' --glob '*.ts' -- 'CommentMarkdown' src/renderer/src/components/native-chat src/renderer/src/components
rg -n -i --glob '*.tsx' --glob '*.ts' -- 'auxclick|middle.?click|button === 1|button !== 1|terminalUrlMiddleClickBehavior' src/renderer/src/components/native-chat src/renderer/src/components/sidebar
rg -n -F --glob '*.tsx' --glob '*.ts' -- 'useNativeChatLinkActions' src/renderer/src/components/native-chat

Repository: stablyai/orca

Length of output: 38782


🏁 Script executed:

sed -n '60,100p' src/renderer/src/components/native-chat/NativeChatToolAnnotations.tsx
sed -n '160,215p' src/renderer/src/components/native-chat/NativeChatToolRun.identity.test.tsx
sed -n '140,180p' src/renderer/src/components/native-chat/NativeChatToolLine.tsx
sed -n '190,220p' src/renderer/src/components/native-chat/NativeChatDiffCard.tsx
sed -n '1,90p' src/renderer/src/components/native-chat/use-native-chat-link-actions.ts

Repository: stablyai/orca

Length of output: 10707


Forward button-1 auxclick events from file targets.

NativeChatToolFileTarget handles only click events. A middle-click therefore does not call onLinkClick, so the file cannot open. Existing native-chat links forward button-1 auxclick events.

Suggested fix
--- "a/src/renderer/src/components/native-chat/NativeChatToolFileTarget.tsx"
+++ "b/src/renderer/src/components/native-chat/NativeChatToolFileTarget.tsx"
@@ -35,12 +35,17 @@
       )}
       title={path}
       aria-label={path}
       onClick={(event) => {
         // The row around this is its expand button; opening the file must not also toggle it.
         event.stopPropagation()
         onLinkClick(event, createNativeChatFileHref(path))
       }}
+      onAuxClick={(event) => {
+        if (event.button !== 1) return
+        event.stopPropagation()
+        onLinkClick(event, createNativeChatFileHref(path))
+      }}
       onKeyDown={(event) => {
         if (event.key === 'Enter' || event.key === ' ') {
           event.preventDefault()
           event.stopPropagation()
📝 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.

Suggested change
onClick={(event) => {
// The row around this is its expand button; opening the file must not also toggle it.
event.stopPropagation()
onLinkClick(event, createNativeChatFileHref(path))
}}
onKeyDown={(event) => {
if (event.key === 'Enter' || event.key === ' ') {
event.preventDefault()
event.stopPropagation()
event.currentTarget.click()
}
}}
>
{label}
</span>
onClick={(event) => {
// The row around this is its expand button; opening the file must not also toggle it.
event.stopPropagation()
onLinkClick(event, createNativeChatFileHref(path))
}}
onAuxClick={(event) => {
if (event.button !== 1) return
event.stopPropagation()
onLinkClick(event, createNativeChatFileHref(path))
}}
onKeyDown={(event) => {
if (event.key === 'Enter' || event.key === ' ') {
event.preventDefault()
event.stopPropagation()
event.currentTarget.click()
}
}}
>
{label}
</span>

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Native chat showed filenames in file-tool rows and edit cards as plain text, so users could not open the files an agent named. This PR makes those filenames clickable and sends both tool and reply file links through the existing terminal file menu. Plain clicks honor the actions/open/do-nothing preference; Cmd/Ctrl and Shift retain direct opening, and filename activation leaves the surrounding row’s expansion alone. Terminal and chat share one menu builder and the existing host-aware file operations.

Adversarial review, an independent architecture sketch, and final readiness review found four P2 issues that are fixed in dc59cc73ab6. All have cause pr, including inherited resolver defects newly exposed by tool links; no fix-loop regression or P0/P1 was proven. Locations below identify the originally reviewed code.

Fixed P2 Location Reproduced failure and fix
Keyboard modifiers NativeChatToolFileTarget.tsx:47 Enter/Space lost modifier intent; activation now preserves it.
Literal filenames NativeChatToolFileTarget.tsx:41 /repo/report:12 and names with surrounding spaces changed targets; tool filenames now bypass reply-position parsing.
Parent-relative paths terminal-path-normalization.ts:132 /repo plus ../sibling incorrectly became /repo/sibling; joining now resolves the parent before normalization.
Do-nothing feedback use-native-chat-file-link-click.ts:33 An unresolved path still showed an error under do-nothing; that preference is checked first.

Deferred P2, cause pr: native-chat-file-link.ts:161 exposes an inherited drive classifier: a real POSIX relative file named a:12 resolves to A:/12 and is reported missing. ./a:12 or an absolute path works. This rare-name issue is explicitly deferred; changing shared drive handling needs Windows validation.

Verified: 355 focused desktop tests, five actual mobile routing tests in an isolated harness, scoped web typecheck, 22 pre-push static gates, and 299 fresh readiness checks. M4Air hidden Electron exercised real tool/reply menus, both Open file actions with loaded editor contents, keyboard/disclosure and click preferences; personally inspected before/after proof is in the PR body. Final CI has 21 successful checks and 16 conditional skips, with no failed/pending checks; the PR is mergeable. The initial browser identity failure passed on the single rerun of the unchanged commit; its underlying cause was not established.

SSH is partially verified: live Linux SSH proved host-specific menus, reply remote editor contents, missing-file feedback/no local fallback and exact candidate modules. That run shared another checkout’s renderer; the final isolated real native-chat pane attempt did not complete. Windows/WSL app QA, actual OS default-app/Reveal execution, a full mobile build and adverse-network behavior remain unverified. The two earlier lone-surrogate test failures reproduce on pinned main; windowing and remote-snapshot flakes remain unclassified. No main merge or PR merge was performed.

@brennanb2025
brennanb2025 merged commit 3e27e62 into main Oct 8, 2026
63 of 65 checks passed
Old-G added a commit to Old-G/orca-plus that referenced this pull request Oct 22, 2026
…he file

Upstream (stablyai#26511) gave chat file links the terminal's popover, so a plain
click on a path in a reply, a tool row or an edit card offered Open / Open
with default app / Reveal instead of opening the file, and only Cmd/Ctrl
opened it. In chat that click opened the file before, and the owner wants it
back. Chat file links now open on a plain click; Shift still opens the
default app, and a link-click setting of "none" still keeps them inert.
Terminal links and web links keep the popover.

Custom-Feature: chat-file-links
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Old-G added a commit to Old-G/orca-plus that referenced this pull request Oct 25, 2026
…he file

Upstream (stablyai#26511) gave chat file links the terminal's popover, so a plain
click on a path in a reply, a tool row or an edit card offered Open / Open
with default app / Reveal instead of opening the file, and only Cmd/Ctrl
opened it. In chat that click opened the file before, and the owner wants it
back. Chat file links now open on a plain click; Shift still opens the
default app, and a link-click setting of "none" still keeps them inert.
Terminal links and web links keep the popover.

Custom-Feature: chat-file-links
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Old-G added a commit to Old-G/orca-plus that referenced this pull request Nov 13, 2026
…he file

Upstream (stablyai#26511) gave chat file links the terminal's popover, so a plain
click on a path in a reply, a tool row or an edit card offered Open / Open
with default app / Reveal instead of opening the file, and only Cmd/Ctrl
opened it. In chat that click opened the file before, and the owner wants it
back. Chat file links now open on a plain click; Shift still opens the
default app, and a link-click setting of "none" still keeps them inert.
Terminal links and web links keep the popover.

Custom-Feature: chat-file-links
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Old-G added a commit to Old-G/orca-plus that referenced this pull request Nov 18, 2026
…he file

Upstream (stablyai#26511) gave chat file links the terminal's popover, so a plain
click on a path in a reply, a tool row or an edit card offered Open / Open
with default app / Reveal instead of opening the file, and only Cmd/Ctrl
opened it. In chat that click opened the file before, and the owner wants it
back. Chat file links now open on a plain click; Shift still opens the
default app, and a link-click setting of "none" still keeps them inert.
Terminal links and web links keep the popover.

Custom-Feature: chat-file-links
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Old-G added a commit to Old-G/orca-plus that referenced this pull request Nov 22, 2026
…he file

Upstream (stablyai#26511) gave chat file links the terminal's popover, so a plain
click on a path in a reply, a tool row or an edit card offered Open / Open
with default app / Reveal instead of opening the file, and only Cmd/Ctrl
opened it. In chat that click opened the file before, and the owner wants it
back. Chat file links now open on a plain click; Shift still opens the
default app, and a link-click setting of "none" still keeps them inert.
Terminal links and web links keep the popover.

Custom-Feature: chat-file-links
Co-Authored-By: Claude Opus 5.5 <[email protected]>
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