Skip to content

Inline-code file paths that contain a space render as plain code instead of a file chip #37740

Closed

Description

@astarktc

What happened

When an agent writes a file path in inline code and the path contains a space, the chat shows plain code with nothing to click. The same path without a space becomes a file chip that opens in the right panel, including absolute paths outside the workspace (read-only, since #9140) and paths on a remote environment. Paths with spaces are routine on macOS: OneDrive and other cloud folders under ~/Library/CloudStorage/, iCloud Drive under ~/Library/Mobile Documents/, and folders like Finance Use Cases.

Diagnosis

inlineCodeFilePathCandidate in packages/shared/src/markdownLinks.ts returns null for any span that matches INLINE_CODE_DISQUALIFIER_PATTERN = /[\s]/, before it looks at the path's shape. The whitespace rule keeps commands such as cd /tmp && ls` from becoming chips, but it also rejects every real path that contains a space. Bracket links got a similar fix in #17742; inline code did not.

Steps to reproduce

  1. Create ~/Path Test/notes with spaces.md.
  2. Have an agent reply with that absolute path in inline code, for example `/Users/<you>/Path Test/notes with spaces.md`.
  3. In the same reply, include `/Users/<you>/notes.md` for a file without spaces.

Expected: both render as file chips and open in the right panel.
Actual: the second is a chip; the first is plain code.

Version

main 1d1489d0b8 (the pattern is unchanged there); seen in daily use on a build of 222288b00f (0.1.9).

Environment

macOS desktop client connected to a remote macOS server over the tailnet; the file lives under a OneDrive folder on the server. The cause is in shared code, so web and mobile are both affected.

Evidence

inlineCodeFilePathCandidate on main:

input result
/Users/me/Library/CloudStorage/OneDrive-Org/Alex/Partners/notes.md the path (a chip)
/Users/me/Library/CloudStorage/OneDrive-Org/Alex/Partners/Acme/Finance Use Cases/working/2026-11-16 message - draft.md null (plain code)

Related issues

#17742 (bracket links with spaces, fixed), #26685 (media embeds with spaces), #27970 (Windows paths with spaces in links and images). None of them covers inline code.

Fix applied or workaround

Workaround: ask the agent to write [name](</path with spaces/file.md>) instead of inline code.

Possible fix: let whitespace through only for an explicit absolute or ~/ path that has a file-shaped basename and no shell syntax (&&, |, ;, >, $, a -flag). Render the chip only after filesystem.getMetadata confirms the file exists, and show plain code until then, so /usr/bin/python3 script.py stays code. We are carrying this in our own build and can open a focused PR if you want one.

Filed by

astarktc, with Claude Opus 5.5 in Pi under T3 Code.

Activity

  1. added a commit that references this issue on Nov 16, 2026
    c9238a9
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions