[Bug]: Clicking repo-relative file links in a linked PR description from a 'No project' thread tries to open them inside the scratch folder
### 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
Steps to reproduce
- Have a registered project for a GitHub repo (e.g.
repo-aat<root>/dev/repo-a) and a broader project whose tree also contains another copy/worktree/symlink of a matching path (e.g. aHomeproject containing bothdev/repo-a/rules/foo.mdand.t3/worktrees/repo-a/.../rules/foo.mdor.codex/memory/rules/foo.md). - In a
No projectscratch thread (so the thread'scwdis<t3>/scratch/<thread-dir>), link and open a PR forrepo-ain the right-hand PR panel. - Click an auto-linkified repo-relative file path inside the PR description (for example inline code
`rules/foo.md`).
Expected behavior
Clicking a repo-relative file reference inside a PR's description resolves against the PR's repository (either opening the file from the registered project matching the PR's owner/name, or opening the file in the PR's Code/Files tab) instead of trying to open a nonexistent file inside the thread's scratch folder.
Actual behavior
T3 Code opens a new file tab with breadcrumb No project > rules > foo.md and displays:
The file could not be accessed or read.
It may be missing or inaccessible.
Attempted path
<t3>\scratch\<thread-dir>\rules\foo.md
Workspace folder: <t3>\scratch\<thread-dir>. Check the link's path or locate the file in Files.
Root cause & decision context for maintainers
Traced in apps/web + packages/client-runtime (local checkout at 2f265f0024):
apps/web/src/components/pullRequest/PullRequestMarkdown.tsx:126-135:PullRequestBodySegmentViewalready hascontext.repository(owner/name) and forwards it to<ChatMarkdown>for media (sourceControlMediaRepository={repository}), but passes the thread'scwd(<t3>/scratch/<thread-dir>) for file links—even when the PR belongs to a different repository.apps/web/src/components/ChatMarkdown.tsx:861-883+packages/client-runtime/src/workspaceBasenameLookup.ts:125(pickProjectLinkMatch): Because<scratch-cwd>/rules/foo.mddoes not exist,findWorkspaceFileMatchsearches allotherRootsequally without usingrepository. When more than one path acrossotherRootsends with/rules/foo.md(for example aHomeproject that also covers worktrees or symlinked copies alongside the repo project),matches.size > 1, sopickProjectLinkMatchreturnsnull.apps/web/src/components/ChatMarkdown.tsx:919:openAt(match ?? panelPath)then falls back topanelPath(rules/foo.md), whichFilePreviewPanelattempts to read relative to the scratchcwd.
Design question to decide before any PR:
When a PR rendered inside a different workspace / No project thread contains a repo-relative file citation:
- Option A: Resolve the PR's
cwd(or prioritize lookup infindWorkspaceFileMatch) to the registered project whoserepositoryIdentitymatchescontext.repositoryon the same environment. - Option B: Open matching paths in the PR's own Files/Code view (or source-control blob URL) when the file isn't in the active thread's workspace, rather than opening a broken file preview tab against a scratch folder.
- Option C (complement): In
pickProjectLinkMatch, prefer exact root-relative matches (entry.path === target) over deeper suffix matches (.../worktrees/.../target) when a nested parent project (likeHome) overlaps a child project.
Impact
Minor bug or occasional failure
Version or commit
T3 Code (Nightly) 0.1.12-nightly.20261122.5098 (traced against 2f265f0024)
Environment
Windows 11, T3 Code Desktop Nightly 0.1.12-nightly.20261122.5098, Antigravity (gemini-4-neon)
Workaround
Open the PR's Files Changed tab (or view the file on GitHub) instead of clicking repo-relative paths inside the PR description from a No project scratch thread.