Repository navigation
[Bug]: Chat and composer file chips show a folder icon for files without an extension #17398
Description
Activity
Note
Grok responding on behalf of Julius.
Thanks for the clear pointer. I haven't reproduced this end-to-end; below is what current
main(c9fa1367c) shows for the path you named.Kind is guessed from the basename alone
inferEntryKindFromPathtreats a basename with no.as a directory (and a leading-dot name with no second.the same way). Call sites that paint the chip icon from that helper:FileTagChipContent— used by chat Markdown file chips (ChatMarkdown.tsx) and by the live composer mention node (ComposerPromptEditorTiptap.tsx).UserMessageMentionChipfor sent@mentions.
So
LICENSE,Makefile,Dockerfile, and extensionless binaries like~/.local/bin/some-toolget a folder icon. The same heuristic also classifies common dotfiles such as.gitignore/.envas directories.Composer search already knows the real kind, then drops it
The
@picker builds items withpathKind: entry.kindfrom workspace path search, andComposerCommandMenuuses that for the menu icon. On select, only the path is written viaserializeComposerFileLink(item.path). The tip-tapcomposer-mentionnode storespath+sourceonly (attrs), andMentionContextRecordlikewise has no kind field. After insert, the chip re-runsinferEntryKindFromPath.Markdown / inline-code chips go through
resolveMarkdownFileLinkMeta, which does not attach a kind and does not stat the target. Trailing/(or\) survives intofilePathin some cases;basenameOfPaththen yields an empty basename and the current heuristic already maps that to directory. File-tree drag mentions strip the trailing slash on purpose, so those directory pills lose that signal.Suggested direction
Prefer, in order:
- Keep known kind where it exists — persist
pathKindon the composer mention node (and, if worth the schema change, onMentionContextRecord), and pass an optionalkindintoFileTagChipContent/ timeline chips instead of re-inferring. That matches what the picker already shows. - Tighten the path heuristic for chips that have no kind:
- Treat a trailing
/or\as directory before looking at the basename. - Default extensionless basenames to file rather than directory (folders in chat links more often carry a trailing separator, or arrive from search with a real kind). Trade-off: a real folder link without a trailing separator would then show a file icon until something else supplies kind.
- Optionally reuse the existing
EXTENSIONLESS_FILE_NAMESallowlist (already used when deciding whether a path looks like a file) as a middle ground.
- Treat a trailing
- The leading-dot branch that marks
.gitignore-style names as directories looks worth revisiting at the same time (dotfile vs folder like.git).
Related
- #15215 — outside-workspace folder link opens a failing file preview (open behavior, not the icon guess).
- #5291 (closed) — directory chips dropping the final path segment when a trailing separator was present.
- #15237 — relative Markdown folder links with a trailing slash not chipping.
I didn't find a duplicate of this icon mis-guess, or an open PR that changes
inferEntryKindFromPath.- addedbugSomething is broken or behaving incorrectly.Something is broken or behaving incorrectly.via-triageFiled through npx t3 triageFiled through npx t3 triage
on Oct 9, 2026
Before submitting
Area
apps/web
Steps to reproduce
LICENSE,Makefile, or an executable such as~/.local/bin/some-tool.@mention ofLICENSE.Expected behavior
The chip shows a file icon, because the path is a file.
Actual behavior
The chip shows a folder icon. The icon is guessed from the name alone: a basename without a dot is treated as a directory (
inferEntryKindFromPath, used byFileTagChipandMessagesTimeline). SoLICENSE,Makefile,Dockerfileand most CLI binaries look like folders.I hit this with a link to a symlinked CLI binary outside the project. The folder icon made it look like a directory, so it was not clear why the preview failed (the preview correctly refuses binary files).
Impact
Cosmetic issue
Version or commit
Desktop 0.0.45 (Alpha). Same code on main @ 2c7a446.
Environment
macOS (Darwin 25.6.0), desktop app, Claude provider
Logs or stack traces
No response
Screenshots, recordings, or supporting files
No response