Skip to content

fix(native-chat): open Dockerfile:2-style links to extensionless files - #52741

Merged
nwparker merged 1 commit into
stablyai:mainfrom
SeungWoonSong:fix/native-chat-extensionless-file-location-links
Nov 30, 2026
Merged

nwparker merged 1 commit into
stablyai:mainfrom
SeungWoonSong:fix/native-chat-extensionless-file-location-links

Conversation

@SeungWoonSong

@SeungWoonSong SeungWoonSong commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

When an agent's chat message links to a spot in a file with no extension, like Dockerfile:2 or Makefile:10:3, clicking the link now opens that file at that line. Before, Orca mistook the link for a web address like mailto: and did nothing.

What Changed

  • Before: routeNativeChatHref('Dockerfile:2') returned { kind: 'none' }. Dockerfile: matches the URL-scheme pattern. The only bare-file exception, BARE_FILE_LOCATION_PATTERN, needs an extension (README.md:5). Desktop and mobile chat both rendered the link with nowhere to go.
  • After: the shared href router also treats <known extensionless filename>:<line>[:<col>] as a file location. It parses the value with the existing parseFileLinkLocation and checks the filename against the list the terminal link detector already uses (Makefile, Dockerfile, README, LICENSE, ...). That list now lives in src/shared/file-links/extensionless-filenames.ts, so terminal and chat share one source.
  • Values that don't match the scheme pattern skip the new check entirely (SCHEME_PATTERN is tested first), so ordinary relative paths pay nothing extra.
  • Unchanged: localhost:3000, vscode:extension/x, https:/mailto:, lowercase dockerfile:2, Dockerfile:x, Dockerfile:2#L5, Makefile:10:3:4, and Dockerfile: all route exactly as before.

Why

The root cause is the router's scheme check. It had a file-location exception for names with an extension but none for well-known extensionless names. Fixing it in the shared router fixes desktop and mobile Markdown in one place. The alternative was rewriting destinations separately in each Markdown parser, which needed two parser changes and a second code path. The exact filename list plus numeric line validation keeps host/port text and custom schemes away from file routing.

Linked Issue

Fixes #52740

Visual Proof

N/A for screenshots: no UI changes, only where an existing chat link goes when clicked. The behavior proof is a router probe run against main and this branch. It covers the desktop bracket, autolink and reference Markdown paths, POSIX and Windows path resolution, the terminal detector and the mobile router:

Input main this PR
Dockerfile:2 none file /repo/Dockerfile line 2
Makefile:10:3 none file /repo/Makefile line 10 col 3
README:1, Gemfile:1, Procfile:1, NOTICE:3:1 none file at that line (and column)
README.md:5, ./Dockerfile:2, src/Dockerfile:2 file file (unchanged)
localhost:3000, vscode:extension/x none none (unchanged)
https://x.dev, mailto:[email protected] web web (unchanged)
dockerfile:2, Dockerfile:x, Dockerfile:2#L5, Makefile:10:3:4, Dockerfile:-1 none none (unchanged)

Testing

  • I manually tested these changes locally

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

  • Every added test fails without this change and avoids the test anti-patterns

  • I reproduced the bug on main with the router probe above (Dockerfile:2 → { kind: 'none' }), then checked the same inputs on this branch.

  • New regression test native-chat-href-routing.test.ts checks that Dockerfile:2 routes as a file and localhost:3000 does not. It fails on main and passes here.

  • Targeted vitest on src/shared/native-chat/file-access/, src/shared/terminal/links/ and src/shared/file-links/ passed (48 tests). Neighboring Markdown/link suites also passed (84 tests).

  • Anti-slop oxlint, code-quality oxlint, ast-grep, the changed-code quality gate and oxfmt are clean on the touched files.

  • Platforms: macOS (unit and probe). The probe also resolves Windows-style C:/repo roots. The change is pure string routing in src/shared, so it doesn't depend on platform or SSH.

Performance

None that matters. The router only runs when a chat link renders or is clicked, which is not a hot path. Microbenchmarks, old vs new per call: https 20.3 vs 20.6 ns, relative path 164 vs 171 ns, README.md:5 158 vs 157 ns, localhost:3000 62 vs 88 ns, vscode: 56 vs 77 ns. Newly routed Dockerfile:2 costs 205 ns. The worst adversarial input, a long Dockerfile: tail, takes about 0.1 ms per call, well under one frame. There is no new I/O, subprocess, polling or per-item fan-out.

Risk

Level: Low

The riskiest part is a scheme-like href being read as a file. Only exact, case-sensitive names from the existing terminal list with a numeric line qualify, and the host still validates file access as before. Older paired phones and SSH hosts are unaffected because nothing changes on the wire. To back it out, a plain revert works. There is no saved data or settings.

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

Original fix by @SeungWoonSong in #52741. During review we moved the fix from the two Markdown parsers into the shared href router and reused parseFileLinkLocation. The extracted shared filename list and the terminal refactor are from the original patch, and authorship is kept on the commit.

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)
  • I stated the risk: what could break, for whom, and how to back it out
  • 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)

@greptile-apps

greptile-apps Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Confidence Score: 5/5 · The PR appears safe to merge, with a non-blocking change to autolink behavior that should be narrowed to match its stated scope.RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge, with a non-blocking change to autolink behavior that should be narrowed to match its stated scope.

Findings

  1. P2 Autolinks now open workspace files ▶

Summary

Adds support for extensionless file locations such as Dockerfile:2 through the shared href router.

  • Native chat links open known extensionless files at their cited lines.

Reviews (3) · Last reviewed commit: "fix(native-chat): open extensionless fil..." · Reviewed by Greptile

@coderabbitai

coderabbitai Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Walkthrough

The changes add a shared check for known extensionless filenames and use it in terminal bare-file detection. Native chat routing now allows recognized extensionless filenames with line locations, such as Dockerfile:2, to continue through file-path handling. A test covers Dockerfile:2 and localhost:3000.

Severity of issue fixed: Medium

Merge Risk: Low · up to b7a2f

Links to files like Dockerfile with a line number now open at the requested line in native chat. The change also turns bare autolinks such as <Dockerfile:2> into file links, which the PR says should not happen. The effect is narrow and the fallback is safe, so this is mergeable with the follow-up noted.

Pre-merge checks: Passed 3 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Linked Issues check Inconclusive Issue #52740 requires that [Dockerfile](Dockerfile:2) open Dockerfile at line 2 on desktop Linux, and that the mobile Markdown pipeline resolve the bare destination to a file target. At the reviewed… Show that the desktop and mobile Markdown link paths pass Dockerfile:2 destinations to routeNativeChatHref, and that the resulting file route opens line 2. Show the code that parses the line from pathText when line is null, or set t…
Passed Passed checks: 3 passed

Check name Status Explanation
Out of Scope Changes check Passed All changed files connect to the file-link objective of #52740. extensionless-filenames.ts adds the shared filename list. terminal-bare-file-link-detection.ts replaces its local set with the same …
Title check Passed The title names the main change: native-chat links to extensionless files such as Dockerfile:2 now open the file. It matches the raw summary, which shows the router now routes known extensionless file…
Description check Passed The description follows the template and fills every required section: ELI5, What Changed, Why, Linked Issue (Fixes #52740), Visual Proof (N/A with reason and a router probe table), Testing, Performan…
Full details: Out of Scope Changes check

Explanation

All changed files connect to the file-link objective of #52740. extensionless-filenames.ts adds the shared filename list. terminal-bare-file-link-detection.ts replaces its local set with the same twelve names, so terminal behavior does not change. native-chat-href-routing.ts adds the known-filename, parsed-line exception that the issue needs. The router test covers the new case and localhost:3000. The router change applies to all callers, not only Markdown links. The PR description says the shared router contract is unchanged. That statement does not match the head diff. This mismatch is a description issue, not an unrelated change.

Full details: Title check

Explanation

The title names the main change: native-chat links to extensionless files such as Dockerfile:2 now open the file. It matches the raw summary, which shows the router now routes known extensionless filenames with line locations to file routing, and the added test for Dockerfile:2. The title is specific and concise.

Full details: Description check

Explanation

The description follows the template and fills every required section: ELI5, What Changed, Why, Linked Issue (Fixes #52740), Visual Proof (N/A with reason and a router probe table), Testing, Performance ("None, because" with measurements), Risk (Level: Low, with a revert path), Agent skill boundary, Notes, and Checklist. The Linked Issue section is complete. The AI Disclosure section is empty, which the template allows for internal members. The Review section is empty. The template's Review heading is unfilled but is not a required field.

Full details: Linked Issues check

Explanation

Issue #52740 requires that [Dockerfile](Dockerfile:2) open Dockerfile at line 2 on desktop Linux, and that the mobile Markdown pipeline resolve the bare destination to a file target. At the reviewed head, the whole-PR diff (merge base 0050f4a to head b7a2fc5) changes only these files: extensionless-filenames.ts (new), native-chat-href-routing.ts, terminal-bare-file-link-detection.ts, and the router test. The Markdown destination files and mobile-markdown-tree.ts named in the previous assessment and the PR description are not in this diff. Desktop evidence: routeNativeChatHref('Dockerfile:2') no longer returns none. The new check admits the destination as a file, and the router test expects { kind: 'file', pathText: 'Dockerfile:2', line: null }. The router does not set line 2. Whether the file-open path parses the line from pathText is not shown in the diff. Mobile evidence: no mobile file changed. It is unknown whether the mobile Markdown pipeline calls routeNativeChatHref. Also, the router has no link-versus-autolink input, so the PR description's claim that autolinks stay on the scheme path is not established at the router level. The previous PASS relied on code that is no longer in this PR.

Resolution

Show that the desktop and mobile Markdown link paths pass Dockerfile:2 destinations to routeNativeChatHref, and that the resulting file route opens line 2. Show the code that parses the line from pathText when line is null, or set the line in the route result. Provide the mobile pipeline evidence for [Dockerfile](Dockerfile:2), or the mobile change that handles it. Provide a regression test for the rendered link target or the open-at-line behavior.

  • 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

Chat links such as `Dockerfile:2` or `Makefile:10:3` matched the URL
scheme pattern, and the bare file-location exception required an
extension, so the shared href router dropped them. The router now also
treats a known extensionless filename followed by a numeric line
(validated by parseFileLinkLocation) as a file location, and the
terminal and chat share one extensionless-filename list. Host/port text
such as `localhost:3000` and custom schemes still route as before.

Fixes stablyai#52740

Co-authored-by: Neil <[email protected]>
@nwparker
nwparker force-pushed the fix/native-chat-extensionless-file-location-links branch from 0f39f0b to b7a2fc5 Compare November 30, 2026 01:13
@nwparker nwparker changed the title fix(native-chat): open extensionless file location links fix(native-chat): open Dockerfile:2-style links to extensionless files Nov 30, 2026
!isWindowsAbsolutePathLike(trimmed) &&
!BARE_FILE_LOCATION_PATTERN.test(trimmed) &&
SCHEME_PATTERN.test(trimmed)
!isBareExtensionlessFileLocation(trimmed)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Autolinks now open workspace files

routeNativeChatHref now treats Dockerfile:2 as a file everywhere, including CommonMark autolinks such as <Dockerfile:2>. Desktop rewrites every matching link destination, and mobile sends every link href to this router without checking how it was written. Clicking the autolink therefore opens a workspace file instead of keeping the previous scheme behavior.

This is a non-blocking change beyond the PR’s explicit-link-only scope. Move the exception to the Markdown parsers, where authored destinations can be distinguished from autolinks.

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

Minor comments: 1

src/shared/native-chat/file-access/native-chat-href-routing.ts: 1

134-134: Minor · Functional Correctness · Poor tradeoff

Keep bare extensionless locations out of the shared router's direct result.

routeNativeChatHref('Dockerfile:2') now returns a file route. Before this guard, the same input returned none. The PR states that the shared router keeps its existing contract, so this direct change conflicts with that statement.

The change also reaches autolinks on desktop. rewriteFileDestinations calls fileRewrite(node.url) for every link node. A CommonMark autolink such as <Dockerfile:2> produces a link node with Dockerfile:2 as its URL. The router now admits that URL, so the autolink becomes a file link. The PR states that bare extensionless autolinks stay on the scheme-handling path.

The fix needs more than removing the guard. Explicit links such as [Dockerfile](Dockerfile:2) depend on the same router result to become file links. Restrict the bare-location rule to explicit Markdown link destinations. Keep <Dockerfile:2> and bare Dockerfile:2 on the scheme path. The author must choose how the boundary tells autolinks from explicit destinations.

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: 8389aa61-8578-4cc9-bd11-a16050cd8e9f
Commits

Reviewing files that changed from the base of the PR and between 0f39f0b and b7a2fc5.

Files selected for processing: 2

  • src/shared/native-chat/file-access/native-chat-href-routing.test.ts
  • src/shared/native-chat/file-access/native-chat-href-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.

@nwparker
nwparker merged commit 3adac76 into stablyai:main Nov 30, 2026
58 of 59 checks passed
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.

[Bug]: Native chat links to Dockerfile:2 do not open the file

2 participants