Skip to content

fix(ui): link file references with line ranges, not version numbers - #139355

Merged
steipete merged 3 commits into
mainfrom
claude/team-file-link-refs
Sep 5, 2026
Merged

steipete merged 3 commits into
mainfrom
claude/team-file-link-refs

Conversation

@steipete

@steipete steipete commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

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 :line and :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.2 parsed as directory 1.1 plus file 1.2 with the numeric extension 2, so the transcript showed a document-icon file link with a 1.1/1.2 tooltip in the middle of prose about plugin versions.

Solution

ui/src/components/markdown-file-links.ts:

  • File extensions must start with a letter ([A-Za-z][A-Za-z0-9]{0,7}), so all-numeric "paths" like 1.1/1.2, 2026.9.2, or v1.2/3.4 never match.
  • The line-suffix grammar accepts :start-end next to :line and :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

  • Code references with line ranges become clickable workspace file links (file opens at the range start).
  • Version-like numeric paths are no longer turned into file links.
  • Tradeoff: files whose extension starts with a digit (for example .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

  • New tests in ui/src/components/markdown-links.test.ts fail 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).
  • Codex autoreview (local, P1): scoped-clean.
  • Production LOC: +4 −3 in the grammar module (one explanatory comment); no rendering or CSS changes, so the visual presentation of file links is unchanged. No before/after captures for this reason.

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.

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

clawsweeper Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: XS maintainer Maintainer-authored PR labels Sep 5, 2026
@steipete

steipete commented Sep 5, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper review

@clawsweeper

clawsweeper Bot commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 5, 2026
@clawsweeper

clawsweeper Bot commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 5, 2026, 5:39 PM ET / 21:39 UTC.

ClawSweeper review

What this changes

The 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
Reviewed head: aaae46a79e5fe16413eb1518353c61aaa1f1b4d3

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused parser repair with useful regression coverage and the previous blocker resolved.
Proof confidence 🌊 off-meta tidepool Not applicable: The maintainer-authored PR is exempt from the external-contributor gate; reported rendering tests exercise the changed grammar, but do not establish a live chat click opening the viewer at the range start.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The maintainer-authored PR is exempt from the external-contributor gate; reported rendering tests exercise the changed grammar, but do not establish a live chat click opening the viewer at the range start.
Evidence reviewed 8 items Pinned scope and prior finding: The complete host-provided merge-base-to-head patch contains only the file-link grammar, its rendering tests, and the authored-link caller. The current grammar rejects an alphanumeric continuation after a period, addressing the previous logs/app.log.1 partial-link finding. Base-only changes were excluded from review.
Current main still needs the repair: Fetched main still accepts numeric extensions and only :line or :line:column suffixes. It does not contain this PR's range handling or separate authored/scanned grammars.
Latest release comparison: The supplied latest release, v2026.9.2, contains the same older grammar, so the requested behavior is not already supplied by that release.
Findings None None.
Security None None.

How this fits together

The 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]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +9, Tests +35. Total +44 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 2 30 21 +9
Tests 1 35 0 +35
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 65 21 +44

Review metrics

Metric Value Why it matters
Production versus test growth Production net +9 lines; tests +35 lines The small production increase centralizes both grammars while preserving authored-link compatibility.

Mantis proof suggestion

Optional 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:

@openclaw-mantis verify Control UI chat file references ending in :26-35 open the workspace viewer at line 26, numeric version strings and logs/app.log.1 remain unlinked, and an explicitly authored assets/part.3mf link remains clickable; return redacted screenshots and interaction results.

Technical review

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

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The maintainer-authored PR is exempt from the external-contributor gate; reported rendering tests exercise the changed grammar, but do not establish a live chat click opening the viewer at the range start.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove merge-risk: 🚨 compatibility: Current PR review selected no merge-risk labels.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: This fixes bounded chat file-navigation errors without affecting core runtime availability.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The maintainer-authored PR is exempt from the external-contributor gate; reported rendering tests exercise the changed grammar, but do not establish a live chat click opening the viewer at the range start.

Evidence

What I checked:

  • Pinned scope and prior finding: The complete host-provided merge-base-to-head patch contains only the file-link grammar, its rendering tests, and the authored-link caller. The current grammar rejects an alphanumeric continuation after a period, addressing the previous logs/app.log.1 partial-link finding. Base-only changes were excluded from review. (ui/src/components/markdown-file-links.ts:14, aaae46a79e5f)
  • Current main still needs the repair: Fetched main still accepts numeric extensions and only :line or :line:column suffixes. It does not contain this PR's range handling or separate authored/scanned grammars. (ui/src/components/markdown-file-links.ts:4, 5c7a2e92b179)
  • Latest release comparison: The supplied latest release, v2026.9.2, contains the same older grammar, so the requested behavior is not already supplied by that release. (ui/src/components/markdown-file-links.ts:4, 3928bad9badf)
  • Behavioral regression coverage: Added rendering assertions cover the range's starting line, rejection of rotated-log prefixes while retaining sentence-ending punctuation, numeric version strings, and an explicitly authored .3mf link. Existing coverage includes Windows paths, line/column suffixes, disabled file links, URLs, and fenced code. Tests were inspected, not executed. (ui/src/components/markdown-links.test.ts:298, aaae46a79e5f)
  • Existing interaction and sanitization boundary: Chat clicks continue passing the parsed target to onOpenWorkspaceFile. Markdown rendering still applies DOMPurify after parsing; the patch does not add filesystem authority, alter authorization, or bypass sanitization. (ui/src/pages/chat/components/chat-thread.ts:135, aaae46a79e5f)
  • Area routing history: Current-main history lists Peter Steinberger for the file-link module split and subsequent accessible-rendering work. Nearby parser history lists Vincent Koc for sharing Markdown link boundaries. These support routing suggestions, not verified feature-introduction attribution. (ui/src/components/markdown-file-links.ts, 79f3474836be)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vincent Koc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-09-05T20:45:00.885Z sha 5b77f31 :: blocked before merge. :: none
  • reviewed 2026-09-05T21:01:23.436Z sha fdd9d5e :: blocked before merge. :: [P2] Reject numeric-suffix filenames without linking an earlier prefix

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

steipete commented Sep 5, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 5, 2026
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.
@steipete

steipete commented Sep 5, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 5, 2026
@steipete
steipete merged commit 16193bb into main Sep 5, 2026
233 of 235 checks passed
@steipete
steipete deleted the claude/team-file-link-refs branch September 5, 2026 22:49
@steipete

steipete commented Sep 5, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 6, 2026
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant