Repository navigation
fix(ui): link file references with line ranges, not version numbers - #139355
Conversation
Assistant replies reference code as `path/file.ts:26-35`; the file-link grammar only accepted `:line` and `:line:col`, so range references stayed plain text while dotted version strings like `1.1/1.2` matched as a directory plus a numeric-extension file and rendered as workspace file links. Extensions now start with a letter and the suffix grammar accepts `:start-end`, targeting the first line.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
@clawsweeper review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Codex review: needs maintainer review before merge. Reviewed September 5, 2026, 5:39 PM ET / 21:39 UTC. ClawSweeper reviewWhat this changesThe Control UI recognizes file references with line ranges, avoids automatically linking numeric version strings, and preserves explicitly authored links with digit-leading extensions. Merge readiness✅ Ready for maintainer review This PR remains useful: current main and the latest release retain the reported parsing defects. The latest revision resolves the prior partial-filename finding, and no blocking correctness defect was identified. Priority: P2 Review scores
Verification
How this fits togetherThe Control UI turns assistant Markdown into chat content. Recognized file references carry a path and optional line number to the existing workspace file viewer when clicked. flowchart LR
A[Assistant Markdown] --> B[Chat Markdown parser]
B --> C{Authored link or detected reference}
C --> D[Validate file path and line suffix]
D --> E[Sanitized file link]
E --> F[User clicks reference]
F --> G[Workspace file viewer]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +9, Tests +35. Total +44 across 3 files. View PR surface stats
Review metrics
Mantis proof suggestionOptional chat interaction evidence would confirm that range links reach the viewer and rejected numeric references stay plain text. A maintainer can ask Mantis to capture proof by posting this exact PR comment: Technical reviewBest possible solution: Keep one grammar builder with conservative automatic detection and permissive authored links, preserving the existing file-viewer interaction. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main accepts 1.1/1.2 as a file path and rejects an inline-code path ending in :26-35. No runtime reproduction was executed during this read-only review. Is this the best way to solve the issue? Yes. Repairing the shared parser fixes all relevant detection routes, and the authored-link grammar preserves intentional digit-leading file references. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 5c7a2e92b179. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
Scanned prose and code spans keep the letter-led extension rule so version strings never linkify, while explicitly authored Markdown links keep the previous permissive grammar. One builder now produces both grammars.
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
With letter-led extensions, the scanner could stop early inside a longer token such as logs/app.log.1 and link logs/app.log instead. A lookahead now rejects any match followed by an alphanumeric continuation, optionally after a dot, while a sentence-ending period still links.
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Merged via squash.
|
…penclaw#139355) * fix(ui): link file references with line ranges, not version numbers Assistant replies reference code as `path/file.ts:26-35`; the file-link grammar only accepted `:line` and `:line:col`, so range references stayed plain text while dotted version strings like `1.1/1.2` matched as a directory plus a numeric-extension file and rendered as workspace file links. Extensions now start with a letter and the suffix grammar accepts `:start-end`, targeting the first line. * fix(ui): keep authored file links with digit-led extensions Scanned prose and code spans keep the letter-led extension rule so version strings never linkify, while explicitly authored Markdown links keep the previous permissive grammar. One builder now produces both grammars. * fix(ui): never link a shorter prefix of a numeric-suffix filename With letter-led extensions, the scanner could stop early inside a longer token such as logs/app.log.1 and link logs/app.log instead. A lookahead now rejects any match followed by an alphanumeric continuation, optionally after a dot, while a sentence-ending period still links.
Problem
Assistant replies in the Control UI reference code as
src/commands/auth-choice-options.static.ts:26-35(path plus a line range). The file-link grammar only accepted:lineand:line:col, so those references stayed plain inline code instead of opening the file in the sidebar.At the same time, dotted version strings were linkified:
1.1/1.2parsed as directory1.1plus file1.2with the numeric extension2, so the transcript showed a document-icon file link with a1.1/1.2tooltip in the middle of prose about plugin versions.Solution
ui/src/components/markdown-file-links.ts:[A-Za-z][A-Za-z0-9]{0,7}), so all-numeric "paths" like1.1/1.2,2026.9.2, orv1.2/3.4never match.:start-endnext to:lineand:line:col; the first number is the target line, so a range reference opens the file at its first line.Both the text scanner and the inline-code / explicit-link paths share these constants, so the fix applies to all three detection routes.
Impact
.3mf) are no longer auto-linked; none are in the conservative bare-filename allowlist, and multi-segment paths to them were never a realistic reference form in chat.Evidence
ui/src/components/markdown-links.test.tsfail on the previous grammar (range suffix not linked, version numbers linked) and pass with the fix.node scripts/run-vitest.mjs ui/src/components/markdown ui/src/styles/chat-file-link-presentation.browser.test.ts ui/src/app/browser-link-routing.test.ts: 4 files, 134 tests passed.node scripts/check-changed.mjs: passed (lint, format, typecheck, knip lanes).Release-note: Control UI links code references with line ranges (
file.ts:26-35) to the file and no longer turns dotted version numbers into file links.