fix(web): stop linking kernel pseudo-filesystem paths in chat markdown - #5380
fix(web): stop linking kernel pseudo-filesystem paths in chat markdown#5380DAlperin wants to merge 1 commit into
Conversation
Inline code like `/dev/kvm` rendered as a clickable file chip labeled "kvm", because /dev, /proc, /sys, /run, and /boot sat on the POSIX root allowlist that marks an absolute path as a filesystem path. Their entries are device nodes, kernel state, and boot images rather than files worth opening in an editor, so drop those roots. Entries under a dropped root still link when they carry a file extension or a :line suffix, and every other root is unchanged: /usr/local/bin/tool, /etc/hosts, and workspace-relative paths keep their chips.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
ApprovabilityVerdict: Approved 77c58f0 Simple bug fix that removes kernel pseudo-filesystem paths (/dev/, /proc/, /sys/, /run/, /boot/) from the allowlist of linkable file paths. The change only affects markdown link rendering in chat UI and includes test coverage. You can customize Macroscope's approvability policy. Learn more. |
What Changed
POSIX_FILE_ROOT_PREFIXESinapps/web/src/markdown-links.tslisted/dev/,/proc/,/sys/,/run/, and/boot/alongside the ordinary filesystem roots. Anything under one of those roots clearedlooksLikePosixFilesystemPath, so the inline-code linkifier turned it into a file chip. This drops those five roots from the list. Nothing else about the heuristic changes.Two tests are added, one for
resolveMarkdownFileLinkTargetand one forresolveInlineCodeFileLinkMeta, covering/dev/kvm,/dev/null,/proc/cpuinfo, and/sys/class/net/eth0.Why
An assistant message that mentions
/dev/kvmrenders it as a clickable chip labeled "kvm" with a folder icon — the path is a device node, the label drops the directory, and clicking it tries to open something no editor wants./dev/nullshows up constantly in agent output and hits the same path.The chips for real files are the point of the feature, so the fix is scoped to the roots that never hold editable files. Entries under a dropped root still link when they carry a file extension or a
:linesuffix (/run/user/1000/app.sock), which is the generic rule the rest of the heuristic already uses.UI Changes
Before
After
Checklist
Note
Low Risk
Narrow heuristic tweak in chat markdown link detection with regression tests; no auth, data, or API surface changes.
Overview
Chat markdown was treating paths under
/dev/,/proc/,/sys/,/run/, and/boot/as normal POSIX file roots, so mentions like/dev/nullor/proc/cpuinfoshowed up as clickable file chips and tried to open in the editor.This change drops those five prefixes from
POSIX_FILE_ROOT_PREFIXESinmarkdown-links.tsand documents that excluded roots can still link when the path has a file extension or:linesuffix. Tests coverresolveMarkdownFileLinkTargetandresolveInlineCodeFileLinkMetafor typical device and kernel paths.Reviewed by Cursor Bugbot for commit 77c58f0. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Stop linking kernel pseudo-filesystem paths in chat markdown
Removes
/dev/,/proc/,/sys/,/run/, and/boot/fromPOSIX_FILE_ROOT_PREFIXESin markdown-links.ts so paths like/dev/nullor/proc/cpuinfoare no longer rendered as file links. Paths under these roots that have a file extension or:linesuffix are still linkable.Macroscope summarized 77c58f0.