Skip to content

[Bug]: Chat and composer file chips show a folder icon for files without an extension #17398

Description

@sergical

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/web

Steps to reproduce

  1. In any thread, have the agent reply with a file link or inline code path to a file that has no extension. Examples: LICENSE, Makefile, or an executable such as ~/.local/bin/some-tool.
  2. Look at the chip that the link becomes. The same happens for a composer @ mention of LICENSE.

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 by FileTagChip and MessagesTimeline). So LICENSE, Makefile, Dockerfile and 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

Activity

  1. juliusmarminge commented on Oct 9, 2026

    @juliusmarminge
    Member

    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

    inferEntryKindFromPath treats 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:

    So LICENSE, Makefile, Dockerfile, and extensionless binaries like ~/.local/bin/some-tool get a folder icon. The same heuristic also classifies common dotfiles such as .gitignore / .env as directories.

    Composer search already knows the real kind, then drops it

    The @ picker builds items with pathKind: entry.kind from workspace path search, and ComposerCommandMenu uses that for the menu icon. On select, only the path is written via serializeComposerFileLink(item.path). The tip-tap composer-mention node stores path + source only (attrs), and MentionContextRecord likewise has no kind field. After insert, the chip re-runs inferEntryKindFromPath.

    Markdown / inline-code chips go through resolveMarkdownFileLinkMeta, which does not attach a kind and does not stat the target. Trailing / (or \) survives into filePath in some cases; basenameOfPath then 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:

    1. Keep known kind where it exists — persist pathKind on the composer mention node (and, if worth the schema change, on MentionContextRecord), and pass an optional kind into FileTagChipContent / timeline chips instead of re-inferring. That matches what the picker already shows.
    2. 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_NAMES allowlist (already used when deciding whether a path looks like a file) as a middle ground.
    3. 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.

  2. added
    bugSomething is broken or behaving incorrectly.
    via-triageFiled through npx t3 triage
    on Oct 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is broken or behaving incorrectly.via-triageFiled through npx t3 triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions