Skip to content
Source
Sign inSign up
pingdotgg/t3code

[Bug]: Absolute Windows file links render without a usable destination #6418

Closedteloverge(GitHub profile, opens in a new tab) opened this issue 3 comments

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

On Windows, create one file outside the active workspace:

New-Item -ItemType Directory -Force D:\tmp\t3-link-repro
Set-Content -LiteralPath D:\tmp\t3-link-repro\example.md -Value '# Link target'

Then render in a thread message with direct Windows drive destination:

Open the example

Bare Windows path, matching output that agents sometimes produce:

M:\batches\issue-40-v1\docs\prompt.md

Repeat with a path under the active workspace so both sides of the workspace boundary are covered.

Similar to: #6360 desktop thread file links do nothing instead of opening the file panel but that is a macOS bug with different file paths. However, they may share same cause.

Expected behavior

Windows drive paths should use the existing chat file-link behavior:

  • A file inside the active workspace opens in T3 Code's file panel.
  • A file outside the active workspace falls back to the configured editor.
  • The shortened chip label may be used for display, but the tooltip and Copy full path action retain the complete resolved path.

Actual behavior

There are two related failures:

  • A direct Markdown destination such as D:/tmp/t3-link-repro\example.md renders with link styling but has no usable href.
  • A bare path such as M:\batches...\prompt.md remains plain text and is not interactive.

This reproduces for paths inside and outside the active project/worktree. The raw provider transcript and persisted message contain the complete paths, so the paths are not truncated by the provider, event store, or projection.

The direct-drive case is lost between Markdown parsing and the custom anchor renderer. rehype-sanitize interprets D: as a URL protocol and removes the href before React Markdown calls urlTransform. Calling rewriteMarkdownFileUriHref() only from urlTransform is therefore too late.

The bare-path case has a separate trigger: GFM autolinking does not recognize filesystem paths, so no link node is created at all.

T3 already contains code paths that can handle both targets once the message author uses a specific syntax:

  • file:///D:/... survives sanitization and is later handled by rewriteMarkdownFileUriHref().
  • An absolute Windows path inside an inline-code span is recognized by the existing inline file-link resolver.

Those are producer-side formatting conventions, not automatic normalization. The affected provider messages instead contained a direct D:/... Markdown destination and a bare M:... path. Relying on every provider and user to know T3-specific formatting requirements would leave the behavior provider-dependent and inconsistent.

A minimal replay of the production Markdown pipeline produced:

Example: Open the example

M:\batches...\prompt.md

Impact

Major degradation or frequent failure

Version or commit

0.0.34-nightly.20260812.1079

Environment

Windows

Logs or stack traces

No relevant error was emitted when the valid file link was clicked or activated with Return.

The absence of an error appears to be part of the defect.

Screenshots, recordings, or supporting files

image.png

Workaround

The message author can use an explicit file URL or put the path in inline code:

Open the example M:\batches\path\to\artifact.txt

T3 does not currently apply these conversions automatically. They are useful for manually authored messages, but they are not a reliable general workaround for agent output because the client does not control which syntax each provider emits.

  1. teloverge(GitHub profile, opens in a new tab) added labelsneeds-triage

  2. Fix is in #7182. Windows drive destinations and bare paths are now normalized to file URLs before sanitization so they keep a usable destination.

  3. Second confirmation on Windows, with a destination shape that differs from the original report in a way worth recording.

    Environment: T3 Code 0.0.33 (stable), Windows 11. Still reproduces against main @ be7d35a.

    Repro

    An agent listed files it had just created. Because the paths contain spaces, it emitted percent-encoded destinations rather than the plain D:/tmp/... form in the report (names below are placeholders; the spaces, the & and the encoding are verbatim):

    - [Notes - August 2026.md](C:/Users/me/docs/20%20Projects/Alpha%20%26%20Beta/Notes%20-%20August%202026.md)

    It renders blue and underlined, and clicking it does not open the file panel. This is your first failure mode, and it is worth noting that percent-encoding does not sidestep it — the drive letter is read as a protocol before any decoding happens, so the encoded form fails identically to the plain one.

    Your diagnosis holds exactly. Tracing 0.0.33's shipped bundle: hast-util-sanitize's safeProtocol strips the href on the parseRawHtml: true path, and defaultUrlTransform returns "" on the false path, both because C: parses as an unknown scheme. resolveMarkdownFileLinkTarget resolves the path correctly either way — the anchor simply never receives a destination, so the entry already sitting in markdownFileLinkMetaByHref is never looked up.

    Status, since this is still needs-triage

    Nothing has merged and main @ be7d35a is unchanged, so this reproduces on current nightlies. Four PRs are open against it — #5283, #6237, #7182, #7189 — of which #6237 currently conflicts and #5283 has unresolved review feedback.

    The two live ones are not interchangeable, because they take different scopes against the two failures in your report:

    • #7189 rewrites drive destinations at the remark AST stage. I verified it against my case by re-running 0.0.33's actual sanitize and urlTransform gates (detail here). It fixes the direct-destination failure, and says plainly that it does not close the bare-path one.
    • #7182 rewrites the markdown source before parsing, and additionally autolinks bare M:\... paths and handles UNC destinations and link-reference definitions — so it targets both failures listed here.

    Flagging the split mainly so this issue is not closed by the narrower of the two: merging #7189 alone would still leave the bare-path half of this report open.

  4. Resolved by PR #6439 and PR #8081 in response to Issue #6360.

Sign in to join this conversation.