Skip to content

fix(terminal): link bare file:line locations followed by a colon - #52634

Merged
nwparker merged 1 commit into
stablyai:mainfrom
hsusul:fix/terminal-bare-link-trailing-colon
Nov 29, 2026
Merged

nwparker merged 1 commit into
stablyai:mainfrom
hsusul:fix/terminal-bare-link-trailing-colon

Conversation

@hsusul

@hsusul hsusul commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

When a compiler or test runner reports a failure, it prints the file and line with a colon after it, like main_test.go:15: expected 1, got 2. You should be able to click that to jump to the line. Orca's terminal did not link these, because it treated the last colon as part of the file name, so the name never matched a file. Now Orca drops that trailing colon, the same way it already drops a trailing period or comma, and the link works.

What Changed

Before: a bare location followed by a colon (main_test.go:15:, test_x.py:6:, foo.c:10:5:, Makefile:12:) stayed plain text. Locations with a path separator (./foo.c:10:5:) already linked.
After: these locations link to the file and line, and to the column when there is one.

Mechanism: the bare-filename token regex keeps : on purpose so the suffix parser can read :line:col. The colon that ends the location stayed in the token because TRAILING_TRIM_CHARS in src/shared/terminal/links/terminal-file-link-detection-ranges.ts did not include :. parseExplicitFileLinkTarget needs the token to end in :\d+, so it failed, and looksLikeFilename then rejected the whole token. The fix adds : to TRAILING_TRIM_CHARS, so trimTerminalPathBoundaryPunctuation strips it together with ,, ; and ..

A related improvement: spaced-path segments like name.ts:12: now link at line 12. Before, they produced a path ending in : that could never resolve.

Why

These are the most common failure lines people see in a terminal. The fix is at the source: the trailing-punctuation trim already handles the same boundary for ,;.. Adding one character there is simpler than writing a separate pattern for each tool's output.

Linked Issue

Fixes #52622

Visual Proof

No screenshots: Electron was not launched for this change. The links are the text ranges below, which the terminal link provider underlines on hover. Output of extractTerminalFileLinks on main and on this branch (text | path | line | col | range):

Input Before After
main_test.go:15: expected 1, got 2 no link main_test.go:15 → main_test.go, line 15
test_x.py:6: AssertionError no link test_x.py:6 → line 6
foo.c:10:5: error: expected ; no link foo.c:10:5 → line 10, col 5
Makefile:12: *** missing separator. Stop. no link Makefile:12 → line 12
note: in file included from bar.h:5: no link bar.h:5 → line 5
(foo.ts:10:) no link foo.ts:10 → line 10

These inputs give the same result on both: foo:, C:, C:\, C:\x.ts:10: err, http:, https://host:, mailto:, ::1, fe80::1:, [::1]:8080, 12:30:, ./foo.c:10:5: err, file:///, Error: something.

Testing

  • New case in src/shared/terminal/links/terminal-links.test.ts that covers go test, gcc and make lines. It fails on main (expected [] to deeply equal [{ pathText: 'main_test.go', ... }]) and passes with the fix.

  • vitest run --config config/vitest.config.ts on src/shared/terminal/links, src/shared/native-chat, src/shared/file-links and src/renderer/src/components/terminal-pane/links: 23 files, 145 tests passed.

  • A 42-input probe compared main with this branch. Every change is listed above or is a word ending in : (for example package.json:), which is now a candidate just like the same word without the colon already was.

  • Static gates on the touched files are clean: oxlint, oxfmt, anti-slop, code-quality native plugins, ast-grep, and the changed-code quality gate.

  • Tested on macOS at unit level. The change is string handling with no platform-specific branches.

  • 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

Performance

None, because this adds one entry to a Set that the trim loop already checks. Detection runs on hover (xterm provideLinks) and during native-chat linkify, not on the terminal output stream. Measured mean per call for extractTerminalFileLinkReadings, main → branch:

  • plain 93-char line: 4.72 µs → 4.35 µs
  • go/gcc/make line: 3.18 µs → 3.34 µs (it now returns the links)
  • 2000 fN.c:N: tokens: 494 µs → 571 µs
  • adversarial input, 200 KB of colons: 242 µs → 1.03 ms

All cases are linear and far below 16 ms. The change adds no I/O, polling or caches, and its cost does not grow with the number of tabs or panes.

Risk

Level: Low

A bare word that ends in :, like README: or config.yaml:, now becomes a link candidate. It is only underlined when the file exists, because terminal file links are confirmed with an existence check first. Filenames that really end in : lose the colon. Windows does not allow such names, and they are very rare elsewhere. No settings, saved data or IPC change, and local, SSH and WSL terminals behave the same. A plain revert backs this out.

Review

Native chat calls the same extractTerminalFileLinkReadings. Prose links there still need a path separator, and the native-chat suites pass. No new input reaches the file opener: the target is the same path and line the detector already produced for file:line without the colon.

Original fix by @hsusul in #52634.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

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

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 · This PR appears safe to merge.RetriggerView in GreptileConfidence Score: 5/5

[Low impact] This PR appears safe to merge.

Summary

Makes bare file locations followed by a colon clickable by trimming the final colon before parsing.

  • Terminal error locations ending in a colon can now become file links.

Reviews (3) · Last reviewed commit: "fix(terminal): link bare file locations ..." · Reviewed by Greptile

@coderabbitai

coderabbitai Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Walkthrough

Terminal file-link parsing now trims a trailing colon from location text. Tests cover Go-style file and line locations, C-style file, line, and column locations, and a Makefile diagnostic.

Severity of issue fixed: Low

Merge Risk: Low · up to ffdff

Terminal output such as main_test.go:15: will now link to the file and line. A file whose real name ends in a colon is very rare, but it would no longer resolve literally. The risk is small and mergeable with awareness.

Pre-merge checks: Passed 4

Check name Status Explanation
Linked Issues check Passed [#52622] requires bare file locations followed by a colon (for example main_test.go:15: expected 1, got 2, foo.c:10:5: error, Makefile:12: ***) to produce links. The whole-PR diff adds : to `T…
Out of Scope Changes check Passed The whole-PR diff changes one line in terminal-file-link-detection-ranges.ts, adding : to the trailing trim set. The test file adds coverage for the same objective. The change does not add unrelat…
Title check Passed The title names the main change: bare file:line locations followed by a colon (for example main_test.go:15:) now become terminal file links. The changeset adds ':' to TRAILING_TRIM_CHARS and adds test…
Description check Passed The description follows the repository template closely. It has ELI5, What Changed (before/after and mechanism), Why, a linked issue (Fixes #52622), Visual Proof (a substitute table of extractor outpu…
Full details: Linked Issues check

Explanation

[#52622] requires bare file locations followed by a colon (for example main_test.go:15: expected 1, got 2, foo.c:10:5: error, Makefile:12: ***) to produce links. The whole-PR diff adds : to TRAILING_TRIM_CHARS in src/shared/terminal/links/terminal-file-link-detection-ranges.ts. The trim step runs on bare-filename tokens before parseExplicitFileLinkTarget, so the trailing colon no longer blocks parsing. The PR summary reports a new test in src/shared/terminal/links/terminal-links.test.ts covering go test, gcc and make lines. That test fails on main and passes with the change. I did not run the test suite. The code path is consistent with the reported behavior.

Full details: Out of Scope Changes check

Explanation

The whole-PR diff changes one line in terminal-file-link-detection-ranges.ts, adding : to the trailing trim set. The test file adds coverage for the same objective. The change does not add unrelated behavior. A side effect is that tokens such as foo.c: with no line number now trim to foo.c and may link. This follows directly from the same trim rule and is not a separate unrelated change. The PR description also names the risk for filenames that end in :. The description and the linked issue cover this behavior.

Full details: Title check

Explanation

The title names the main change: bare file:line locations followed by a colon (for example main_test.go:15:) now become terminal file links. The changeset adds ':' to TRAILING_TRIM_CHARS and adds tests for those locations, so the title matches the change. The 'fix(terminal)' prefix follows a conventional-commit style and is specific enough for a teammate scanning history.

Full details: Description check

Explanation

The description follows the repository template closely. It has ELI5, What Changed (before/after and mechanism), Why, a linked issue (Fixes #52622), Visual Proof (a substitute table of extractor output, with no screenshots and a reason given), Testing with specific test and gate results, a Performance line with measurements, a Risk section with level and revert plan, Review, the skill-boundary checkbox, and the checklist. The AI Disclosure section is left as the template comment, which is acceptable for an internal contributor. The Performance section starts with 'None, because' and gives a reason, as the template asks.

  • 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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Review info

Run configuration

  • 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: 793748a5-89df-4dba-bf6d-a85f04680916
Commits

Reviewing files that changed from the base of the PR and between a55699c and ffdffe3.

Files selected for processing: 2

  • src/shared/terminal/links/terminal-file-link-detection-ranges.ts
  • src/shared/terminal/links/terminal-links.test.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.


const LEADING_TRIM_CHARS = new Set(['(', '[', '{', '"', "'"])
const TRAILING_TRIM_CHARS = new Set([')', ']', '}', '"', "'", ',', ';', '.'])
const TRAILING_TRIM_CHARS = new Set([')', ']', '}', '"', "'", ',', ';', '.', ':'])

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 · Functional Correctness · Quick win

Preserve literal paths that end in a colon.

On a POSIX host, src/a: can be a valid filename. The local-path branch now passes src/a to the location parser instead, so the link cannot open src/a: and can open a different file if src/a exists. Preserve a literal candidate for host resolution alongside the trimmed diagnostic candidate.

Bare locations such as `main_test.go:15:`, `foo.c:10:5:` and
`Makefile:12:` kept the trailing colon in the token, so the explicit
location parser failed and the filename check rejected the token.
Trim a trailing `:` with the other trailing punctuation.

Fixes stablyai#52622
@nwparker
nwparker force-pushed the fix/terminal-bare-link-trailing-colon branch from ffdffe3 to bd7466d Compare November 29, 2026 21:43
@nwparker nwparker changed the title fix(terminal): link bare file locations followed by a colon fix(terminal): link bare file:line locations followed by a colon Nov 29, 2026
@nwparker
nwparker merged commit 1669f4f into stablyai:main Nov 29, 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]: Terminal does not link bare file:line: locations from go test, pytest, gcc and make

2 participants