t3code icon indicating copy to clipboard operation
t3code copied to clipboard

[Bug]: Inline code like `avatars/u1.webp` becomes a file chip labeled `u1.webp` even when the path does not exist

Open madebyjulz opened this issue 1 month ago • 7 comments

Before submitting

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

Area

apps/web

The classifier is inlineCodeFilePathCandidate in packages/shared/src/markdownLinks.ts; the chip label comes from fileLinkLabel in packages/shared/src/fileLinks.ts.

Steps to reproduce

  1. Open any thread.

  2. Have an assistant response use an example storage key or path in inline code, where that path does not exist in the workspace:

    `scope: "global"` (the default) means the key is the pattern as written, for example `avatars/{userId}.webp` gives `avatars/u1.webp`.
    
  3. Read the rendered message, then click the second span.

Expected behavior

avatars/u1.webp renders as ordinary inline code with its full text. It is an example object key, not a file in the workspace, so it should not be a link — or at least the chip should keep the text the agent wrote.

Actual behavior

The span renders as a file chip with an image icon labeled just u1.webp. The sentence now reads "avatars/{userId}.webp gives 🖼 u1.webp", which drops the avatars/ part and no longer says what the agent wrote. Clicking it opens a preview for <workspace>/avatars/u1.webp, which does not exist.

This happens a lot with docs-style answers: S3 keys, URL paths, example output paths, paths in other repos or on other machines. Any dir/name.ext span in inline code becomes a chip.

Cause

On main @ 47f2c8d29e981c7723467efe137ee19e91df924e:

  • inlineCodeFilePathCandidate accepts any span with a / and an extension on the basename. Nothing checks whether the path exists in the workspace before it becomes a chip.
  • fileLinkLabel then shows only the basename (plus a parent suffix only when basenames collide), so the directory part of what the agent wrote disappears from the sentence.

Possible fixes

  • Only turn inline code into a chip once the path resolves to an existing file (or show unresolved paths as plain inline code).
  • For inline code, keep the written text as the label instead of collapsing it to the basename, as was done for descriptive Markdown link labels in #10787.

Related: #22181 and #13899 (same class: inline code becomes a chip and hides its prefix, triggered there by a :line suffix), #10787 / #28509 (chip labels replacing the text that was written).

Impact

Minor bug or occasional failure

Version or commit

T3 Code desktop, current release (Nov 2026)

Environment

macOS, Claude Code provider

madebyjulz avatar Nov 02 '26 16:11 madebyjulz

I'd like to work on this. I propose keeping inline-code file chips but preserving the path exactly as written in their labels, so avatars/u1.webp stays avatars/u1.webp, across web, desktop, mobile, and find-in-thread.

This would address the lost text while keeping existing link detection, avoiding filesystem checks during rendering and extra remote latency. Missing paths would still be clickable. Would that direction be acceptable, including preserving absolute paths and :line suffixes as written?

BilalIrfanContact avatar Nov 02 '26 22:11 BilalIrfanContact

Same issue on T3 Code Desktop 0.1.5 (macOS 26, arm64), local server 0.1.5.

An assistant answer described a convention in inline code: "the ## Markers table in docs/architecture/[stack.md](https://github.com/Users/nicolasklein/.t3/scratch/2026-11-05-read-triage-playbook-md-users-01e78e66/docs/architecture/stack.md)". The path names a file that exists in other projects that follow this convention, but not in the thread's workspace. It rendered as a file chip. Clicking it opened the file preview with "The file could not be accessed or read. It may be missing or inaccessible." for <workspace>/docs/architecture/stack.md.

This one is a docs-style answer about conventions that span projects, so the path is correct, just not for this workspace. If missing paths fell back to plain inline code (as #30021 proposes), this case would be handled.

Triaged with Claude Opus 5.5 in Claude Code via T3 Code triage.

hey-nicolasklein avatar Nov 05 '26 10:11 hey-nicolasklein

Still reproduces on main @ 475ae52. One part this issue doesn't mention, and #29657 doesn't change: the hover tooltip.

The tooltip shows the path resolved against the thread's cwd, not the text the agent wrote. resolveInlineCodeFileLinkMeta joins any relative candidate onto cwd by string only (markdown-links.ts#L48-L61, markdownLinks.ts#L492-L511), and the tooltip renders that targetPath (MarkdownFileLink.tsx#L402-L404).

So when an answer describes another program's layout in relative terms, e.g. config/AGENTS.md meaning "AGENTS.md in that tool's config directory", hovering the chip shows <cwd>/config/AGENTS.md: a file that doesn't exist and that the agent never wrote. Between the basename label and the resolved tooltip, the original text appears nowhere on screen. Only "Copy relative path" in the context menu gives it back.

With #29657 the label keeps the written text, but the tooltip would still show the made-up absolute path. Either fix proposed above would cover this too: render unresolved paths as plain inline code, or show the written text instead of the resolved path when the target doesn't exist.

merrkry avatar Nov 19 '26 11:11 merrkry

I'm adding my 2 cents here. For me, the issue is not just about it rendering like a "chip" when the path doesn't exist.

It's also in the general case.

The agent is trying to tell me it's doing something with a path, and I want to see what that path is. If it's linked to a path, that's fine, but the visible text (IMO) should be the path itself, not some obscured version of it.

screenshot-2026-11-21 10-42-59

Ramblurr avatar Nov 21 '26 10:11 Ramblurr

Here's another case of this.. not an absoulute path, just a url

image

Maybe other people find those helpful, but I find hiding the URL and instead printing a icon and the title of the page to be very .... not helpful...I'd always just rather see the URL that the model is trying to tell me about.

Ramblurr avatar Nov 23 '26 17:11 Ramblurr

Maybe other people find those helpful, but I find hiding the URL and instead printing a icon and the title of the page to be very .... not helpful...I'd always just rather see the URL that the model is trying to tell me about.

Nope; I despise it, and it should at least be an option, in my opinion.

It kinda works if it's done only for the workspace project, but even that only works if your project is small; otherwise it is only extremely confusing. Bonus points when the agent is referring to a file on a remote filesystem; that makes me want to commit sudoku. The renderer is trying to be "too smart" and fails to convey information conveniently.

For the nonexistent files, it could probably still be useful if they were shown in a different color (i.e. similar to Wikipedia "redlinks"); but then for the next several turns they would re-check file existence again to go back to a normal link or give up forever.

Amunak avatar Nov 23 '26 18:11 Amunak

The renderer is trying to be "too smart" and fails to convey information conveniently.

100% this. The focus should be on conveying the information, helping the poweruser with their task, not just looking pretty.

Ramblurr avatar Nov 23 '26 19:11 Ramblurr

Same failure without any cd or worktree, on the macOS desktop client:

  • T3 Code: v0.1.12-nightly.20261123.5124
  • Workspace folder: /Users/fulequn/workspace/fulequn-tools
  • An assistant message referenced a file it had just written outside the workspace in inline code: src/lib.rs
  • The file exists at /Users/fulequn/workspace/sources/fast-anything/examples/fuzzy-dedupe/.fast/ports/fuzzy.find_duplicates/src/lib.rs
  • Clicking the lib.rs chip opens the preview with:
Attempted path  /Users/fulequn/workspace/fulequn-tools/src/lib.rs
Workspace folder: /Users/fulequn/workspace/fulequn-tools

The relative path is joined onto the thread's workspace root, so it can never resolve, and the authored text src/lib.rs is not visible anywhere in the chip. Same symptom as #35337, but the agent never changed directory.

fulequn avatar Nov 27 '26 09:11 fulequn