Relative file links with a slash get no workspace lookup when the file is in a subfolder or worktree #28554
What happened#
Agents often write file links relative to the folder they were working in (a git worktree under the project, or a subfolder like backend/), not the thread's workspace root. Clicking one opens the right panel with "The file could not be accessed or read", e.g. primitive/proposers/sql_context.py while the file lives at .worktrees/nl2sql/primitive/proposers/sql_context.py.
Bare names (sql_context.py) get a basename lookup (needsWorkspaceBasenameLookup), but anything containing / does not: findWorkspaceFileMatch only tries stripRepeatedWorkspacePrefix, which returns null for these, so the panel opens the literal missing path.
Diagnosis#
Resolver works as designed; the gap is the missing fallback. Measured on one user's history (2,622 Claude replies, 12 projects):
- 152 relative links with a slash missed at the workspace root.
- Of those that exist somewhere on disk today, 87/119 (73%) resolve against a directory the agent's own tool calls had operated in (cd targets / absolute paths in Bash, Read, Edit inputs) — usually a subfolder or a git worktree.
- Pre-registered alternative ("agent's recorded session cwd differs from root") was refuted: only 17/152 (11%).
Code:
apps/web/src/components/ChatMarkdown.tsx(findWorkspaceFileMatch,openFileInPanel),packages/client-runtime/src/workspaceBasenameLookup.ts.
Steps to reproduce#
- Project at
<root>, git worktree created by the agent at<root>/.worktrees/x(thread itself has no worktreePath). - Agent replies with
`src/foo.py`where only<root>/.worktrees/x/src/foo.pyexists. - Click the link: panel shows "could not be accessed", attempted path
<root>/src/foo.py.
Version#
0.1.5 (desktop, t3code-bin). Link code unchanged on main as of 2026-11-01. Triage CLI: 0.1.6.
Environment#
Linux x64 (Arch, Hyprland), desktop app (t3code-bin) against local server, Claude provider.
Evidence#
Screenshot of the failing panel (attached by user). Counts above from a read-only scan of the local state DB and Claude session logs.
Related issues#
#4804 (case-distinct links, closed) — different bug, same lookup area.
Fix applied or workaround#
Stop hook that forces absolute paths in replies. Suggested fix: when a relative link with a slash misses at the root, run the same suffix search used for bare names (match entries ending in /<path>), and open it if unique — including git worktrees listed for the project.
Filed by#
Claude Opus 5.5 (claude-opus-5-5) via Claude Code, t3 triage.
jaroxciv(GitHub profile, opens in a new tab) added labelsvia-triage
tanstack-source added labelsbug
juliusmarminge closed this
Sign in to join this conversation.