Repository navigation
fix(native-chat): underline only file links a click can act on - #22370
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. 📝 WalkthroughWalkthroughNative chat file-link routing and linkification now preserve literal path text and apply updated rules for bare filenames and line suffixes. File-open failures are reported as missing or unverifiable, while unresolved workspace paths use a separate toast. English messages and tests cover routing, link clicks, and failure classification. Priority: ➖ Normal Merge Risk: 🔵 Low · up to Chat file links now either open or clearly report why they could not, and the earlier workspace-search concerns no longer apply because that search was removed. One small gap remains: a bare filename in inline code, such as 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 28.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 25 functions across 18 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches 💡 2📝 Generate docstrings 💡
🛠️ Fix failing CI checks 💡
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: 3
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 1d56d113-42ca-46f4-bb55-656958425514
📒 Files selected for processing (15)
src/renderer/src/components/QuickOpen.tsxsrc/renderer/src/components/native-chat/native-chat-file-link-search.test.tssrc/renderer/src/components/native-chat/native-chat-file-link-search.tssrc/renderer/src/components/native-chat/native-chat-file-link.test.tssrc/renderer/src/components/native-chat/native-chat-file-link.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/quick-open-file-list.tssrc/renderer/src/components/quick-open-file-listing-request.tssrc/renderer/src/components/sidebar/comment-markdown-native-chat-file-links.tssrc/renderer/src/components/terminal-pane/terminal-file-open-routing.tssrc/renderer/src/components/terminal-pane/terminal-link-missing-file-open.test.tssrc/renderer/src/i18n/locales/en.jsonsrc/shared/native-chat-href-routing.test.tssrc/shared/native-chat-href-routing.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 4 remain after this review.
| ...(excludePaths.length > 0 ? { excludePaths } : {}) | ||
| } | ||
| ) | ||
| return listing.files |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Do not discard listing truncation before deciding that a match is unique.
Remote search is limited to 32 results. Local listing is also bounded. If a truncated result contains one exact suffix match, another exact match can exist outside the returned page. The current code opens the visible match as if it were unique.
Return the full QuickOpenFileListing. Open directly only when truncated is false and matches.length === 1.
| const state = useAppStore.getState() | ||
| if (state.activeWorktreeId !== context.worktreeId) { | ||
| // Why: Quick Open lists the active workspace. | ||
| activateAndRevealWorkspace(context.worktreeId) | ||
| } | ||
| useAppStore.getState().openModal('quick-open', { initialQuery: searchPath }) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
sed -n '1,180p' src/renderer/src/components/native-chat/native-chat-file-link-search.ts
sed -n '80,150p' src/renderer/src/components/native-chat/native-chat-file-link-search.test.ts
sed -n '1,100p' src/renderer/src/components/quick-open-file-listing-request.tsRepository: stablyai/orca
Length of output: 8364
🏁 Script executed:
#!/bin/bash
set -eu
printf '%s\n' '--- test outline and focused remainder ---'
ast-grep outline src/renderer/src/components/native-chat/native-chat-file-link-search.test.ts
sed -n '1,260p' src/renderer/src/components/native-chat/native-chat-file-link-search.test.ts
printf '%s\n' '--- focused references ---'
rg -n -C 3 'truncated|showFileLinkNotFoundToast|File not found|openFileLinkBySearch|requestQuickOpenFileListing' src/renderer/src/components src/sharedRepository: stablyai/orca
Length of output: 45463
🏁 Script executed:
#!/bin/bash
set -eu
printf '%s\n' '--- focused test file ---'
wc -l src/renderer/src/components/native-chat/native-chat-file-link-search.test.ts
cat -n src/renderer/src/components/native-chat/native-chat-file-link-search.test.ts
printf '%s\n' '--- focused source references ---'
rg -n -C 8 'QuickOpenFileListing|requestQuickOpenFileListing|truncated|listWorkspaceFiles|openFileLinkBySearch' \
src/renderer/src/components/native-chat/native-chat-file-link-search.ts \
src/renderer/src/components/quick-open-file-listing-request.tsRepository: stablyai/orca
Length of output: 18542
Show “File not found” only for a complete listing.
When requestQuickOpenFileListing succeeds with zero exact suffix matches and truncated is false, call showFileLinkNotFoundToast(searchPath). When the listing is truncated with zero visible matches, or when listing fails, keep Quick Open. Preserve truncated instead of returning only listing.files.
Suggested fix
-import { requestQuickOpenFileListing } from '`@/components/quick-open-file-listing-request`'
+import {
+ requestQuickOpenFileListing,
+ type QuickOpenFileListing
+} from '`@/components/quick-open-file-listing-request`'
...
-): Promise<string[]> {
+): Promise<QuickOpenFileListing> {
...
- return listing.files
+ return listing
}
...
- let matches: string[] = []
+ let listing: QuickOpenFileListing | null = null
try {
- matches = findFileLinkSearchMatches(await listWorkspaceFiles(context, searchPath), searchPath)
+ listing = await listWorkspaceFiles(context, searchPath)
} catch {
// Quick Open below reports its own listing error.
}
if (!args.isCurrent()) {
return
}
+ const matches = listing
+ ? findFileLinkSearchMatches(listing.files, searchPath)
+ : []
+ if (listing && !listing.truncated && matches.length === 0) {
+ showFileLinkNotFoundToast(searchPath)
+ return
+ }There was a problem hiding this comment.
ℹ️ Minor suggestions only.
Reviewed changes
Initial review of the full PR (670b26d, 15 files).
- Chat file-link search fallback — new
openFileLinkBySearchlists the workspace when an unrooted link misses at the root, opens a unique trailing-segment match (keeping line and column), and otherwise hands off to Quick Open prefilled with the link path, guarded by a superseded-click check. - Shared file opener —
openDetectedFilePathgains an opt-inonMissingPath(isCurrent)callback, fired only on astatmiss and suppressed when a later click supersedes it; terminal callers pass nothing. - Href routing —
routeNativeChatHrefnow treats wrapped/decoded hrefs as literal text (so#,?,%XXsurvive as filename characters) and addsBARE_FILE_LOCATION_PATTERNso bareREADME.md:5routes as a file;transformFileLinksresolves explicit-link URL syntax once. - Quick Open refactor — the listing request moves to
requestQuickOpenFileListing/usesRuntimeQuickOpenPathSearch, and Quick Open accepts aninitialQuerycarried throughopenModal.
Local run: pnpm test on the native-chat folder, the shared href-routing suite, and CommentMarkdown.link-click — 172 files / 1756 tests pass.
ℹ️ Nitpicks
findFileLinkSearchMatches(native-chat-file-link-search.ts:37-39) compares case-sensitively, while the SSH/runtime server ranking lowercases (quick-open-path-search.ts). A casing-only link likeReadme.mdforREADME.mdis returned by the server and then rejected, so it never direct-opens on a case-sensitive host — it degrades to Quick Open.- The multi-match handoff (
native-chat-file-link-search.ts:110) prefills Quick Open with the path but carries no line/column, sofoo.md:42loses its line whenever the name is ambiguous.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
| const WEB_SCHEME_PATTERN = /^(?:https?|mailto):/i | ||
| const SCHEME_PATTERN = /^[A-Za-z][A-Za-z0-9+.-]*:/ | ||
| // Why: `README.md:5` is a file location; the scheme pattern alone reads `README.md:` as a scheme. | ||
| const BARE_FILE_LOCATION_PATTERN = /^[^\s:/\\?#]+\.[\p{L}\p{N}_+-]+:\d+(?::\d+)?$/u |
There was a problem hiding this comment.
BARE_FILE_LOCATION_PATTERN also matches a dotted host with a port — example.com:8080, api.example.com:3000, 1.2.3.4:8080 — because [\p{L}\p{N}_+-]+ accepts any TLD. A scheme-less URL like [docs](example.com:8080), or `example.com:8080` in prose, now routes as a file: it resolves to /repo/example.com at line 8080 (or a "File not found" toast) across the renderer, mobile, and use-native-chat-link-actions. The test only pins the dotless localhost:3000, so nothing catches this class.
Technical details
# `BARE_FILE_LOCATION_PATTERN` over-matches host:port
## Affected sites
- `src/shared/native-chat-href-routing.ts:12` — the new pattern bypasses the `SCHEME_PATTERN` rejection at lines 108-114 for any dotted `host:digits`.
- `src/renderer/src/components/sidebar/comment-markdown-native-chat-file-links.ts:20-28` — inline code like `` `example.com:8080` `` now passes `isLinkifiableFile` (`hasAlphabeticExtension` matches `.com`) and is wrapped.
- `mobile/src/components/markdown-href-routing.ts:12-18` and `src/renderer/src/components/native-chat/use-native-chat-link-actions.ts:53-56` — both now see `kind === 'file'` where they previously saw `none`.
## Required outcome
- `README.md:5` / `App.tsx:12:3` keep routing as files, while a host-with-port shape (`example.com:8080`, `1.2.3.4:8080`) stays `none`.
## Suggested approach (optional)
- Require a path separator or a bounded file-extension set before the `:digits`, or reject a host:port shape explicitly. Add `example.com:8080 → none` next to the `localhost:3000` assertion at `src/shared/native-chat-href-routing.test.ts:103`.670b26d to
f0ff0ec
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 71f59c82-1e43-473a-86c5-1cdbd55b3424
📒 Files selected for processing (5)
src/renderer/src/components/native-chat/native-chat-file-link-search.test.tssrc/renderer/src/components/native-chat/native-chat-file-link-search.tssrc/renderer/src/components/quick-open-file-list.tssrc/renderer/src/components/quick-open-file-listing-request.tssrc/renderer/src/i18n/locales/en.json
🚧 Files skipped from review as they are similar to previous changes (1)
- src/renderer/src/i18n/locales/en.json
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
| { | ||
| query: basename(searchPath), | ||
| // Why: a large local workspace caps its listing; filtering by name keeps the match in it. | ||
| nameFilter: basename(searchPath), | ||
| ...(excludePaths.length > 0 ? { excludePaths } : {}) | ||
| } |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift
🔎 Supported by static analysis
🏁 Script executed:
sed -n '43,115p' src/renderer/src/components/native-chat/native-chat-file-link-search.ts
sed -n '1,100p' src/renderer/src/components/quick-open-file-listing-request.ts
sed -n '165,280p' src/renderer/src/components/quick-open-file-list.ts
rg -n 'cancelRuntimeFileList|requestToken|searchRuntimeFilePaths' src/renderer/src/runtime/runtime-file-search-client.ts src/renderer/src/runtime/runtime-file-client.tsRepository: stablyai/orca
Length of output: 10452
🏁 Script executed:
#!/bin/bash
printf '%s\n' '--- quick-open lifecycle ---'
sed -n '220,380p' src/renderer/src/components/quick-open-file-list.ts
printf '%s\n' '--- runtime file search client ---'
sed -n '1,235p' src/renderer/src/runtime/runtime-file-search-client.ts
printf '%s\n' '--- runtime file client and bindings ---'
sed -n '1,180p' src/renderer/src/runtime/runtime-file-client.ts
rg -n -g '*.ts' -g '*.tsx' 'listFiles|searchRuntimeFilePaths|cancelListFiles|requestToken|AbortSignal' src/renderer/src/runtime src/renderer/src | head -240Repository: stablyai/orca
Length of output: 38556
🏁 Script executed:
#!/bin/bash
printf '%s\n' '--- filesystem list/cancel bindings ---'
rg -n -g '*.ts' -g '*.tsx' -g '*.js' 'cancelListFiles|listFiles:|listFiles\(' src | head -260
printf '%s\n' '--- chat search callers and current-state wiring ---'
rg -n -g '*.ts' -g '*.tsx' 'openFileLinkBySearch|isCurrent:|isCurrent\(' src/renderer/src/components/native-chat src/renderer/src | head -220
printf '%s\n' '--- file-link search module context ---'
sed -n '1,145p' src/renderer/src/components/native-chat/native-chat-file-link-search.tsRepository: stablyai/orca
Length of output: 38336
🏁 Script executed:
#!/bin/bash
printf '%s\n' '--- native chat click lifecycle ---'
sed -n '1,125p' src/renderer/src/components/native-chat/use-native-chat-file-link-click.ts
printf '%s\n' '--- filesystem IPC listing and cancellation ---'
sed -n '180,275p' src/main/ipc/filesystem/filesystem-search-handlers.ts
sed -n '600,650p' src/main/ipc/filesystem.test.ts
printf '%s\n' '--- SSH provider token and cancellation ---'
sed -n '285,370p' src/main/providers/ssh-filesystem-provider.ts
sed -n '90,125p' src/main/providers/filesystem-provider-contract.ts
printf '%s\n' '--- terminal context binding ---'
rg -n 'function getTerminalFileContext|const getTerminalFileContext|getTerminalFileContext' src/renderer/src/components/terminal-pane src/renderer/src | head -30Repository: stablyai/orca
Length of output: 13798
🏁 Script executed:
#!/bin/bash
sed -n '1,190p' src/renderer/src/components/terminal-pane/terminal-file-open-routing.ts
sed -n '1,115p' src/renderer/src/components/native-chat/native-chat-file-link-search.test.tsRepository: stablyai/orca
Length of output: 11207
Cancel superseded chat listing requests.
When a missing-link search runs in an SSH workspace, openFileLinkBySearch starts listFiles without a request token or abort signal. isCurrent() runs only after the listing completes, so a later click does not stop the earlier scan. The SSH filesystem handler can abort these scans by request token, and the repository documents that abandoned scans can stack and starve interactive filesystem operations.
Give each chat search the same token and signal lifecycle as Quick Open. Cancel the previous search when a new link supersedes it, and pass the token and signal through requestQuickOpenFileListing. Environment-runtime requests already have a 15-second timeout, but they should also receive the abort signal.
There was a problem hiding this comment.
ℹ️ No new issues in the incremental changes.
Reviewed changes
Incremental review of the delta since the prior pullfrog review (670b26d → f0ff0ec).
- Added a local-only
nameFiltertorequestQuickOpenFileListingand passed the link's basename from the chat search fallback, so a capped local scan keeps the matching file. - Consolidated
useRuntimeFileListForWorktree's local and server-search branches ontorequestQuickOpenFileListing, dropping the duplicated listing/truncation code and the localdebounceRuntimeFilePathSearchhelper. - Rebased the branch onto current
main, absorbing #22369's name-filter-when-capped flow without changing the local listing branch's behavior.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
ℹ️ No critical issues — one minor observation inline.
Reviewed changes
Incremental review of the delta since the prior pullfrog review (f0ff0ec → 5937c8f).
- Honest failure verdicts —
openDetectedFilePathreplaces theonMissingPath(isCurrent)callback with an opt-inonOpenFailure(failure, signal), classifying the failed existence check asmissing(the host answered "no such file") orunverifiable(the host could not answer), and handing back an abort signal that fires once a later open supersedes this one. Terminal callers pass nothing and are unchanged. - Chat surfaces the verdict — the click hook searches only on
missing, shows a "Couldn't check …" toast onunverifiablewithout starting a search, and shows "Couldn't resolve … in this workspace" for a link it cannot turn into a path. - Cancellable search fallback —
openFileLinkBySearchtakes anAbortSignal, threads it throughrequestQuickOpenFileListing, and callscancelRuntimeFileListon abort so a superseded click stops the host-side scan, not just its result. - Toast module — the three link-failure toasts move into
native-chat-file-link-toasts.ts;toFileLinkSearchPathmoves intonative-chat-file-link.ts. - Quick Open seeding —
QuickOpenderivesinitialQueryfrom the modal data and re-seeds the input when a new query arrives while the palette is already open. - i18n —
components.native-chat.fileLinks.unverifiableand.unresolvedadded.
Local run: the six changed suites pass (41 tests), pnpm tc:web, and pnpm run verify:localization-coverage.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
| latestOpenFailureController = controller | ||
| // Why: loss of contact with the host is not evidence the file is gone. | ||
| deps.onOpenFailure( | ||
| { verdict: isMissingRuntimePathError(error) ? 'missing' : 'unverifiable', error }, |
There was a problem hiding this comment.
The new verdict trusts a message-substring helper: isMissingRuntimePathError returns missing for any error text containing not found / enoent / no such file. That is right for a real stat miss, but it also absorbs host errors that are not absence — an SSH relay without fs.stat answers Method not found: fs.stat (SshFilesystemProvider.stat forwards it verbatim, unlike lstat, which special-cases it), and Windows surfaces an unreachable WSL 9P route as ENOENT. In those corners the chat reports "File not found" and starts a workspace search against the host instead of the "Couldn't check …" this PR promises.
Technical details
# `missing` verdict can absorb non-absence host errors
## Affected sites
- `src/renderer/src/components/terminal-pane/terminal-file-open-routing.ts:190` — `isMissingRuntimePathError(error) ? 'missing' : 'unverifiable'` is the only gate for the new verdict.
- `src/renderer/src/runtime/runtime-file-metadata-client.ts:46-51` — substring match on the message, ignoring any structured `.code`.
- `src/main/providers/ssh-filesystem-provider.ts:226-228` — `stat` returns the relay's `method_not_found` error unchanged; `lstat` (lines 230-248) detects it, `stat` does not.
- `src/main/worktree-retirement-discovery.ts:87-90` — in-repo note that an unreachable WSL 9P route surfaces as `ENOENT` and must not be trusted.
## Required outcome
- A host that could not answer `stat` (relay capability mismatch, unreachable WSL distro) should reach `unverifiable`, so the chat offers "Couldn't check …" rather than claiming the file is missing and searching.
## Suggested approach (optional)
- Prefer a structured signal (`RuntimeRpcCallError.code`, `NodeJS.ErrnoException.code`) when present, falling back to the message heuristic only for the legacy wrapped-ENOENT shape.
- At minimum, keep `Method not found` / WSL-UNC-ENOENT shapes out of `missing`.
## Open questions for the human (optional)
- Is `fs.stat` guaranteed on every supported relay version, or can `method_not_found` reach this path in practice?A chat message could underline a bare file name such as `deck.md` that resolved nowhere, and clicking it did nothing, so it read as a broken link. - Inline code and quoted text become file links only when they name a path (contain a `/` or `\`), matching plain prose; a bare file name stays plain code. - Every file link click now answers: it opens, or says the file was not found, that the host could not be checked, or that the path could not be resolved. - Explicit links like [x](README.md:5) route as files, and linked text keeps `#`, `?` and `%XX` literally instead of re-parsing them as URL syntax.
5937c8f to
ddcd9d7
Compare
There was a problem hiding this comment.
ℹ️ No new issues in this delta — the rewrite simplifies the approach and the changed paths are covered by tests.
Reviewed changes
The PR was rewritten since the previous pullfrog review (5937c8f → ddcd9d7): the workspace-search fallback is gone, replaced by a stricter underline rule.
- Replaced the search fallback with a stricter underline rule —
isLinkifiableFilenow requires a path separator for inline code and quoted text, so a bare`deck.md`stays plain code whiledocs/deck.mdremains a link. - Deleted the search machinery (
native-chat-file-link-search.ts,quick-open-file-listing-request.ts) and reverted theQuickOpeninitialQueryseeding andquick-open-file-list.tsrefactor introduced by earlier commits. - Made every resolved link answer a click — the opt-in
onOpenFailure(failure)onopenDetectedFilePathdrives "File not found" (missing) and "Couldn't check …" (unverifiable), and a file-routed href that cannot resolve shows "Couldn't resolve … in this workspace". - Dropped the abort-signal plumbing from
onOpenFailurenow that no host-side scan needs cancelling; the stale-click guard is therequestIdcheck alone. transformFileLinksresolves explicit-link URL syntax once before wrapping, so#,?and%20survive and[x](README.md:5)reaches the file.
Local run: the four changed suites pass (43 tests) and pnpm tc:web is clean.
Two earlier review threads remain open on code this commit did not change — the host:port routing over-match (native-chat-href-routing.ts:12) and the message-substring missing verdict (terminal-file-open-routing.ts:185) — both still present. I left them open rather than re-raising them here.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 4cff2934-03d7-4078-8a4a-93dbdef0dcc4
📒 Files selected for processing (7)
src/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/sidebar/CommentMarkdown.link-click.test.tsxsrc/renderer/src/components/sidebar/comment-markdown-native-chat-file-links.tssrc/renderer/src/components/terminal-pane/terminal-file-open-routing.tssrc/renderer/src/components/terminal-pane/terminal-link-missing-file-open.test.tssrc/renderer/src/i18n/locales/en.json
🚧 Files skipped from review as they are similar to previous changes (1)
- src/renderer/src/i18n/locales/en.json
Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review.
| (hasRootedPrefix || | ||
| hasLineSuffix || | ||
| (requireSeparator ? hasPathExtension : hasAlphabeticExtension)) && | ||
| /[\\/]/.test(link.pathText) && |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
sed -n '1,60p' src/renderer/src/components/sidebar/comment-markdown-native-chat-file-links.ts
sed -n '60,75p' src/renderer/src/components/native-chat/use-native-chat-file-link-click.test.tsxRepository: stablyai/orca
Length of output: 3047
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- relevant symbols ---'
rg -n -C 4 "isLinkifiableFile|exactFileLink|transformFileLinks|routeNativeChatHref|useNativeChatFileLinkClick|workspace lookup|missing relative path|not found|toast" src/renderer/src src/shared --glob '*.{ts,tsx}'
printf '%s\n' '--- candidate file outlines ---'
ast-grep outline src/renderer/src/components/sidebar/comment-markdown-native-chat-file-links.ts
ast-grep outline src/renderer/src/components/native-chat/use-native-chat-file-link-click.test.tsx
printf '%s\n' '--- focused source ---'
sed -n '1,260p' src/renderer/src/components/sidebar/comment-markdown-native-chat-file-links.ts
sed -n '1,260p' src/renderer/src/components/native-chat/use-native-chat-file-link-click.test.tsx
printf '%s\n' '--- base to head summary and focused diff ---'
git diff --stat 641a7f36d98af01d9ebf53ceceae6a3fe0ba2b10 ddcd9d79826804d63665fddfc3c6145c7417ed65
git diff --unified=35 641a7f36d98af01d9ebf53ceceae6a3fe0ba2b10 ddcd9d79826804d63665fddfc3c6145c7417ed65 -- src/renderer/src/components/sidebar/comment-markdown-native-chat-file-links.ts src/renderer/src/components/native-chat/use-native-chat-file-link-click.test.tsx
printf '%s\n' '--- head commits ---'
git log --oneline --decorate -12 ddcd9d79826804d63665fddfc3c6145c7417ed65Repository: stablyai/orca
Length of output: 45468
🏁 Script executed:
set -o pipefail
rg -n -C 5 "isLinkifiableFile|exactFileLink|transformFileLinks|routeNativeChatHref|useNativeChatFileLinkClick|missing relative path|not found|toast" src/renderer/src src/shared --glob '*.{ts,tsx}'
printf '%s\n' '--- file ---'
sed -n '1,260p' src/renderer/src/components/sidebar/comment-markdown-native-chat-file-links.ts
printf '%s\n' '--- tests ---'
sed -n '1,280p' src/renderer/src/components/native-chat/use-native-chat-file-link-click.test.tsx
printf '%s\n' '--- diff ---'
git diff --unified=25 641a7f36d98af01d9ebf53ceceae6a3fe0ba2b10 ddcd9d79826804d63665fddfc3c6145c7417ed65 -- src/renderer/src/components/sidebar/comment-markdown-native-chat-file-links.ts src/renderer/src/components/native-chat/use-native-chat-file-link-click.test.tsx
printf '%s\n' '--- commits ---'
git log --oneline --decorate -12 ddcd9d79826804d63665fddfc3c6145c7417ed65Repository: stablyai/orca
Length of output: 45484
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- exact click hook and context ---'
sed -n '1,260p' src/renderer/src/components/native-chat/use-native-chat-file-link-click.ts
sed -n '1,220p' src/renderer/src/components/native-chat/native-chat-file-link.ts
printf '%s\n' '--- file-open routing declarations and implementation ---'
rg -n -C 8 "export .*openDetectedFilePath|function openDetectedFilePath|const openDetectedFilePath|openDetectedFilePath\\(" src/renderer/src/components/terminal-pane src/renderer/src --glob '*.{ts,tsx}' | head -n 220
sed -n '1,280p' src/renderer/src/components/terminal-pane/terminal-file-open-routing.ts
printf '%s\n' '--- href routing and location parsing ---'
sed -n '1,260p' src/shared/native-chat-href-routing.ts
sed -n '1,260p' src/shared/file-link-location.ts
printf '%s\n' '--- focused tests and head commit metadata ---'
rg -n -C 8 "bare|README|workspace|search|lookup|not found|unresolved|underline" src/renderer/src/components/sidebar src/renderer/src/components/native-chat src/shared --glob '*.{test.ts,test.tsx,ts,tsx}' | head -n 320
git show --no-ext-diff --format=fuller --stat ddcd9d79826804d63665fddfc3c6145c7417ed65
git show --no-ext-diff --format= -- src/renderer/src/components/sidebar/comment-markdown-native-chat-file-links.ts src/renderer/src/components/native-chat/use-native-chat-file-link-click.test.tsx ddcd9d79826804d63665fddfc3c6145c7417ed65 | head -n 260Repository: stablyai/orca
Length of output: 42818
🏁 Script executed:
set -o pipefail
sed -n '1,240p' src/renderer/src/components/native-chat/use-native-chat-file-link-click.ts
printf '%s\n' '--- routing files ---'
fd -t f 'terminal-file-open-routing|native-chat-file-link' src/renderer/src/components
for f in $(fd -t f 'terminal-file-open-routing|native-chat-file-link' src/renderer/src/components | head -n 8); do
printf '\n--- %s ---\n' "$f"
rg -n -C 6 "openDetectedFilePath|search|lookup|worktree|not.?found|unresolved" "$f"
doneRepository: stablyai/orca
Length of output: 27796
Allow bare inline-code filenames to use worktree-relative resolution.
The separator check also runs for inlineCodeFileLink, so README-dup.md remains code and never reaches the click handler. resolveNativeChatFileLink supports bare relative names and resolves them against the current worktree. Remove the separator requirement for inline code only. Keep it for prose.
Suggested fix
-function isLinkifiableFile(link: ParsedTerminalFileLink, isProse: boolean): boolean {
+function isLinkifiableFile(
+ link: ParsedTerminalFileLink,
+ isProse: boolean,
+ allowBareFilename = false
+): boolean {
...
- /[\\/]/.test(link.pathText) &&
+ (allowBareFilename || /[\\/]/.test(link.pathText)) &&
...
-function exactFileLink(value: string, allowSpacedRelative: boolean): ParsedTerminalFileLink | null {
+function exactFileLink(
+ value: string,
+ allowSpacedRelative: boolean,
+ allowBareFilename = false
+): ParsedTerminalFileLink | null {
...
- if (exactLink && isLinkifiableFile(exactLink, false)) {
+ if (exactLink && isLinkifiableFile(exactLink, false, allowBareFilename)) {
...
- return isLinkifiableFile(explicitLink, false) ? explicitLink : null
+ return isLinkifiableFile(explicitLink, false, allowBareFilename) ? explicitLink : null
...
- return exactFileLink(value, true) ? createFileLinkNode(value, node) : null
+ return exactFileLink(value, true, true) ? createFileLinkNode(value, node) : nullAdd a click test that expects README-dup.md to call openDetectedFilePath with the current worktree path.
…text still open Linkified prose, quoted text and inline code wrapped their display text, which the literal wrapped-href route no longer URL-parses, so file:///... resolved as a relative path under the worktree. Wrap pathText[:line[:col]] from the parsed link instead.
There was a problem hiding this comment.
ℹ️ No new issues in the incremental changes.
Reviewed changes
Incremental review of the delta since the prior pullfrog review (ddcd9d7 → 1b21bbd).
- Wrapped the parsed location instead of the display text —
createFileLinkNodenow takes theParsedTerminalFileLinkand builds the internal href fromformatFileLinkLocation(link), so afile:///...URI in inline code, quoted text or prose no longer lands in the literal wrapped href as a scheme (which routed it as a relative path under the worktree). - Added
formatFileLinkLocation— the inverse ofparseFileLinkLocationinsrc/shared/file-link-location.ts.transformFileLinksreuses it for explicit markdown links, replacing the inlinepathText[:line]join with no behavior change. - Added a regression test — opens
file:///repo/src/app.tsandfile:///repo/docs/release%20notes.md#L4from inline code and prose, asserting the decoded path and line; it fails against the pre-fix wrapping.
Local run: the three changed suites pass (40 tests) and pnpm tc:web is clean.
Two earlier review threads remain open on code this commit did not touch — the host:port routing over-match (src/shared/native-chat-href-routing.ts:12) and the message-substring missing verdict (terminal-file-open-routing.ts:185). I left them open rather than re-raising them here.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏




ELI5
The chat sometimes underlined a bare file name like
deck.mdas if it were a link, but clicking it did nothing, so it looked broken. Now the chat only underlines file references that name a path, and clicking any underlined file link always does something: it opens the file, or says why it can't.What Changed
This covers both chat views (structured, and the one backed by a terminal agent); they share one link handler.
Before:
`deck.md`were turned into links even with no folder in them. On click, the chat looked for the file only at the workspace root. If it wasn't there, the file opener caught the failed check and returned, so nothing happened. That's the reported bug: an underlined.mdname in a Claude chat that couldn't be opened, Cmd+click included.After:
/or\(relative, absolute,~/, or a Windows drive path). A bare`deck.md`stays plain code.onOpenFailurecallback, and only the chat passes one. It reports whether the file is verifiably missing or the host couldn't answer (a dropped SSH connection, a refused path). The chat then shows one of:~/xwhen the home folder can't be determinedTerminal links don't pass the callback, so their behavior is unchanged.
[x](README.md:5)used to be read as a web address with the schemeREADME.md:, so it did nothing. It now opens the file at that line.#,?or%20is kept literally instead of being cut at the#or decoded twice.Why
An underline promises that clicking does something. There were two ways to keep that promise for a bare name:
Where a path is named properly but the file isn't there, the click now says so instead of doing nothing.
Linked Issue
No GitHub issue. Reported internally as a P0: "unable to click open markdown files in Claude chat" (1.4.208-hourly). The raw text the agent wrote is still being confirmed with the reporter; this change removes the underline-without-click either way.
Visual Proof
Before, on
main: the bare name in inline code is underlined as a link, and clicking it (or the missing path) does nothing, with no message.After: the bare name is plain code; the relative path, line and column, missing path,
file://link and explicit link are underlined.Clicking the missing path shows "File not found".
Testing
Manual, macOS: tested in an isolated background dev build of this commit, using a Claude transcript attached to a terminal-backed chat and driven through the real UI.
[root notes](root.md:1)openedroot.md.Automated tests cover:
:line,#L7and%20;#in a linked path;Ablation: I reverted each source file to
mainand confirmed its tests fail.Checks passing locally:
pnpm lint(including the localization gates),pnpm tc,check:code-quality:changed, and the sidebar, native-chat, terminal-pane and shared suites.Not tested live: SSH and remote-runtime workspaces. The couldn't-check message is covered by unit tests.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Review
Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
`src/components/`) still does nothing when clicked. The shared opener returns without a message when the local OS can't open a remote folder. Fixing it changes that opener, which terminal links also use, so it's left for a follow-up.README.md:5markdown link on mobile now routes as a file instead of doing nothing; mobile's file opener already acceptspath:line.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)