Repository navigation
Native chat: open files from tool rows through the terminal's file link menu - #26511
Conversation
…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.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (11)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review. 📝 WalkthroughWalkthroughNative 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 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)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
ed841ff2-abd2-4a19-be52-763c3f9ba6e3
📒 Files selected for processing (10)
src/renderer/src/components/native-chat/NativeChatDiffCard.tsxsrc/renderer/src/components/native-chat/NativeChatToolFileTarget.test.tsxsrc/renderer/src/components/native-chat/NativeChatToolFileTarget.tsxsrc/renderer/src/components/native-chat/NativeChatToolLine.tsxsrc/renderer/src/components/native-chat/NativeChatToolRunMemberList.tsxsrc/renderer/src/components/native-chat/native-chat-link-click-behavior.tssrc/renderer/src/components/native-chat/use-native-chat-file-link-click.test.tsxsrc/renderer/src/components/native-chat/use-native-chat-file-link-click.tssrc/renderer/src/components/native-chat/use-native-chat-link-actions.tssrc/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.
| 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> | ||
| ) |
There was a problem hiding this comment.
🎯 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
| 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> |
There was a problem hiding this comment.
🎯 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.tsxRepository: 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.tsxRepository: 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-chatRepository: 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.tsRepository: 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.
| 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> |
|
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.
Deferred P2, cause pr: native-chat-file-link.ts:161 exposes an inherited drive classifier: a real POSIX relative file named 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. |
…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]>
…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]>
…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]>
…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]>
…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]>
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
After: tool-row file actions
After: reply-link file actions
After: opened file with loaded 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.
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
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