Repository navigation
fix(web): chat file links and files panel refresh follow the workspace folder list - #331
Merged
LoganRupe merged 1 commit intoOct 1, 2026
Conversation
…space folder list Chat file links now resolve against the same roots the files panel lists, so a link into a nested folder, a folder outside the workspace folder, or an isolated run's worktree is highlighted in the tree. The panel's refresh button re-reads the .code-workspace, and the tree waits for the first read instead of showing the fallback roots.
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
A failed refresh can retain stale workspace roots instead of applying the documented fallback.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Aligns chat file links and file-panel refreshes with .code-workspace folder roots.
Changes:
- Resolves chat links against displayed project roots.
- Refreshes workspace roots alongside file contents.
- Delays tree rendering until initial roots resolve.
| File | Description |
|---|---|
apps/web/src/lib/projectFileRoots.test.ts |
Tests nested, external, and worktree links. |
apps/web/src/components/files/FilePreviewPanel.tsx |
Gates tree rendering and forwards root refreshes. |
apps/web/src/components/files/FileBrowserPanel.tsx |
Refreshes workspace roots from the file-tree action. |
apps/web/src/components/ChatView.tsx |
Supplies resolved roots to links and the files panel. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
3687
to
+3693
| const workspaceFolders = workspaceFileQuery.data?.folders ?? null; | ||
| // The first read of the folder list has not settled. The files panel holds | ||
| // its tree until then, since the fallback roots can show unlisted folders. | ||
| const projectFileRootsPending = | ||
| projectWorkspaceFile !== null && | ||
| workspaceFileQuery.data === null && | ||
| workspaceFileQuery.error === null; |
Owner
Author
There was a problem hiding this comment.
Leaving this one. Keeping the last list that read successfully is what I want when a refresh fails: the fallback shows unlisted folders, so dropping to it on a transient relay error would be worse than a stale list. I've corrected the PR description, which only described the first-read failure.
This was referenced Oct 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What Changed
Chat file links now resolve against the same roots the files panel lists. A link into a nested workspace folder (
notes/2026), a folder outside the workspace folder (../notes), or an isolated run's worktree opens the file and highlights it in the tree.The files panel's refresh button re-reads the
.code-workspaceas well as the folder contents. An edit made in an editor shows up on refresh, and so does a file that failed to read and is readable again.The tree waits for the first read of the folder list instead of showing the fallback roots and remounting when the real list arrives.
Why
Follow-ups 1 and 2 from the review of #325 on #323.
Links were still matched against
repoRoots, and only with two or more repos, so they missed plain folders and matched the original checkouts while the panel showed worktrees. Nothing but the Manage folders dialog re-read the folder list, so the panel kept a stale list or stayed on the fallback after a failed read. The fallback is the pre-#325 layout, so unlisted folders showed while the first read was in flight.Not covered here: one-repo workspaces hiding the git toolbar, mobile, and agent access to plain folders. A first read that fails still falls back to
repoRootsor the whole workspace folder, and refresh now recovers it. A refresh that fails keeps the last list that read successfully.UI Changes
Before (75c7d8e) on the left, this branch on the right. An isolated run in a workspace listing
api,web,docs,notes/2026and../outside-notes. Three chat links are clicked in turn: nested folder, outside folder, worktree. Thenlateris added to the.code-workspaceon disk and the panel is refreshed._Video: https://github.com/user-attachments/assets/02e4985b-22a8-4a5d-9d49-a45ac9501b78