Skip to content

fix(web): PR description file links resolve in the PR's repository from a No-project thread - #41073

Merged
juliusmarminge merged 2 commits into
mainfrom
factory/issue-41065
Nov 22, 2026
Merged

juliusmarminge merged 2 commits into
mainfrom
factory/issue-41065

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Nov 22, 2026 •

Copy link
Copy Markdown
Member

Clicking a repo-relative file path in a linked pull request's description from a 'No project' thread opened a broken tab that looked for the file in the thread's scratch folder. The description renders in the PR's own checkout, but its file links gave the file panel a path relative to that checkout, and the panel reads relative paths from the thread's folder. Links in markdown rendered in a folder other than the thread's own now open the absolute path under that folder. Ordinary chat links are unchanged.

Fixes #41065

Reproduction on main

Commit 324ac49 (origin/main), web dev server with T3CODE_DEV_SEED=0 and a --home-dir outside any git checkout. Without that, the No project option is hidden because scratch is disabled when the data dir is inside a repo. Fixtures: a git repo repo-a (origin https://github.com/pingdotgg/t3code.git) holding packages/client-runtime/src/state/filesystem.ts, and a folder home holding dev/repo-a plus a second copy at backup/repo-a/packages/client-runtime/src/state/filesystem.ts. Both were added with t3 project add (repo-a, then home). Created a No-project thread with the free Replay provider (cwd /scratch/2026-11-22-go-93b2964d). Linked #28243 through the command palette's 'Link pull request to thread'; its description has inline code packages/client-runtime/src/state/filesystem.ts, rendered as a filesystem.ts file chip. Clicking the chip in the PR Summary tab opened a file tab with breadcrumb 'No project > packages > client-runtime > src > state > filesystem.ts' and 'The file could not be accessed or read. It may be missing or inaccessible. Attempted path /scratch/2026-11-22-go-93b2964d/packages/client-runtime/src/state/filesystem.ts. Workspace folder: /scratch/2026-11-22-go-93b2964d.' This matches the report. Control: with the backup copy moved out of home, a reload and the same click opened /home/dev/repo-a/packages/client-runtime/src/state/filesystem.ts correctly. Restoring the copy brought the failure back on a fresh load, so it fails every time whenever a second project lists a different file with the same repo-relative suffix.

Evidence

Web client, Chromium 156 on Linux, 1280×800, light theme. Both commits used fresh isolated state, native No-project scratch outside Git, and the free Replay provider.

Steps: register repo-a with the target file and the PR repository's origin; register Home with a different backup file at the same repo-relative suffix; start a No-project thread; link #28243; open Summary and click filesystem.ts.

Before After
c89ca0a2f2 c3bf1c5ad1
Opens an unreadable path inside the scratch folder. Opens the correct repository file.
Before: scratch-folder read error After: correct repository file
Before recording After recording

scenarios:prove exited 0: failsOnBase=true, passesOnHead=true. Captures and recordings visually inspected.

Scenario · Runner configuration patch: keep T3 home outside Git

Tests

  • vp test run apps/web/src/components/ChatMarkdown.browser.test.tsx -t "another checkout" with the base ChatMarkdown.tsx: fails as expected (received packages/state/filesystem.ts)
  • vp test run apps/web/src/components/ChatMarkdown.browser.test.tsx -t "workspace file opens": 6 passed
  • vp test run apps/web/src/components/ChatMarkdown.browser.test.tsx apps/web/src/components/ChatMarkdown.permissions.browser.test.tsx: 2 files, 63 tests passed
  • vp run check:changed: pass (format, lint, knip, typecheck of 2 packages, tests, react compiler)
  • Manual run in the web app (dev server, fresh home, repo-a and Home registered, No-project Replay thread, PR fix(web): Tab completes folder names in the add-project browser #28243 linked): clicking the filesystem.ts chip in the PR Summary now opens repo-a's file instead of the missing scratch path
  • PR CI on c3bf1c5: all 39 checks passed

Not in this change

  • When the server cannot match the PR's repository to any registered project, the description renders in the thread's own folder. A repo-relative path that two other projects contain as different files is still left unresolved there.
  • ChatMarkdown's other panel opens (skill links and media 'open file') still pass paths unchanged and were not checked for markdown rendered outside the thread's folder.

Who did the work

  • Written by Claude Opus 5.5, in Claude Code
  • Reviewed by GPT-6.1 Sol, in Codex, and by Claude Opus 5.5, each on its own
  • Proof captured by GPT-6.1 Sol and checked by Claude Opus 5.5

Run by the t3code factory in T3 Code.

…om a No-project thread

A repo-relative path in a linked pull request's description gave up when
another project held a different file at the same path, and opened a
broken tab under the thread's scratch folder. An ambiguous cross-project
match now retries among the projects whose repository is the PR's.

Fixes #41065

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Nov 22, 2026
@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

ChatMarkdown now determines the thread’s panel root from its worktree or matching project. When that root differs from the message working directory, it resolves the opened path against the working directory. A browser test checks this behavior for a thread with a scratch worktree.

Changes: Workspace-aware markdown file opening

Layer / File(s) Summary
Panel root and path resolution
apps/web/src/components/ChatMarkdown.tsx, apps/web/src/components/ChatMarkdown.browser.test.tsx
ChatMarkdown selects a panel root from the thread worktree or matching project. When the root and cwd differ, it resolves the path against cwd. The browser test checks that a relative markdown link opens under /repo-a when the thread has a /scratch/thread worktree.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Low

Possibly related issues

Suggested reviewers: stienswout

Merge Risk: Minimal · up to c3bf1

Repo-relative file links in a PR description opened from a scratch thread now resolve against the PR repository's checkout. No concrete merge-blocking risk remains in the reviewed change.

Pre-merge checks: Passed 3 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Linked Issues check Inconclusive Directly linked issue #41065 asks that a repo-relative file link in a linked PR description, opened from a 'No project' scratch thread, resolve against the PR's repository (Option A: registered projec… Provide readable diff hunks for apps/web/src/components/ChatMarkdown.tsx and packages/client-runtime/src/workspaceBasenameLookup.ts (or confirm whether the latter changed) at head c3bf1c5 against merge base c89ca0a. Confirm that the matchin…
Passed Passed checks: 3 passed

Check name Status Explanation
Title check Passed The title names the fix and its scope: PR description file links resolving in the PR's repository from a No-project thread. The raw summary and PR objectives both describe repository-preferred resolut…
Out of Scope Changes check Passed The visible change summary lists only apps/web/src/components/ChatMarkdown.tsx (+17/-1) and apps/web/src/components/ChatMarkdown.browser.test.tsx (+33/-0). The source change resolves file links in the…
Description check Passed The description covers the problem, the change, scope, and verification in detail. The Problem section explains the broken tab from a No project thread, and the Change section explains that links rend…
Full details: Title check

Explanation

The title names the fix and its scope: PR description file links resolving in the PR's repository from a No-project thread. The raw summary and PR objectives both describe repository-preferred resolution for ambiguous file links in ChatMarkdown, so the title matches the main change. It follows the conventional commit form the template asks for.

Full details: Out of Scope Changes check

Explanation

The visible change summary lists only apps/web/src/components/ChatMarkdown.tsx (+17/-1) and apps/web/src/components/ChatMarkdown.browser.test.tsx (+33/-0). The source change resolves file links in the markdown file-open path. The test covers a workspace-file-open case with a worktree path. Both relate to the file-link behavior in #41065, so no unrelated change is visible. The full file list could not be confirmed, because the repository diff is unavailable, and the PR description mentions a pickProjectLinkMatch change that does not appear in the summary.

Full details: Description check

Explanation

The description covers the problem, the change, scope, and verification in detail. The Problem section explains the broken tab from a No project thread, and the Change section explains that links rendered outside the thread's folder now resolve to an absolute path under that folder. Scope links the issue (fixes #41065) and states it is a bug fix. Verification gives focused test commands with results, a manual run, before/after evidence, and PR CI results. The template's required sections are all present and filled in, so the check passes. The description does not explicitly say that the fix prefers the PR's repository, which the PR objectives describe, but this gap is minor and does not block the check.

Full details: Linked Issues check

Explanation

Directly linked issue #41065 asks that a repo-relative file link in a linked PR description, opened from a 'No project' scratch thread, resolve against the PR's repository (Option A: registered project matching the PR's owner/name, or Option B: the PR's Files/Code view). The current change summary describes ChatMarkdown.tsx changes to openFileInPanel. It resolves the panel root from the thread worktree path or the matching project's workspace root, and resolves the path relative to cwd when the two differ. The summary does not show how the matching project is chosen. It does not mention a PR-repository preference in pickProjectLinkMatch (packages/client-runtime/src/workspaceBasenameLookup.ts), which the PR description and objectives cite as the fix. The repository diff could not be read because changed blobs are missing from the checkout. The previous PASS rested on a different change summary (a sourceControlMediaRepository fallback) and does not carry over to the current head. Whether the current code resolves the issue's failing case (second project with a different file at the same suffix) is not established. The Evidence section of the PR is also unfilled, which is not a coding requirement.

Resolution

Provide readable diff hunks for apps/web/src/components/ChatMarkdown.tsx and packages/client-runtime/src/workspaceBasenameLookup.ts (or confirm whether the latter changed) at head c3bf1c5 against merge base c89ca0a. Confirm that the matching-project selection in openFileInPanel or pickProjectLinkMatch prefers the project whose repository identity equals the PR repository, and that the fixture case from #41065 resolves to the PR repository's file.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between ad2bc46 and c3bf1c5.

Files selected for processing: 2

  • apps/web/src/components/ChatMarkdown.browser.test.tsx
  • apps/web/src/components/ChatMarkdown.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.

A pull request body renders with the PR checkout as its cwd, but its
file links handed the panel a path relative to that checkout, which the
panel reads from the thread's own folder. From a No-project thread that
opened a missing file in the scratch folder. Links rendered in another
folder now open the absolute path under it. The earlier repository
retry is removed: it never ran in that case.

Fixes #41065

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@juliusmarminge
juliusmarminge merged commit 7103527 into main Nov 22, 2026
40 checks passed
@juliusmarminge
juliusmarminge deleted the factory/issue-41065 branch November 22, 2026 22:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Clicking repo-relative file links in a linked PR description from a 'No project' thread tries to open them inside the scratch folder

1 participant