Skip to content

fix(web): chat file links and files panel refresh follow the workspace folder list - #331

Merged
LoganRupe merged 1 commit into
multi-repo-workspacesfrom
bug/323/chat-links-and-folder-list-refresh
Oct 1, 2026
Merged

LoganRupe merged 1 commit into
multi-repo-workspacesfrom
bug/323/chat-links-and-folder-list-refresh

Conversation

@LoganRupe

@LoganRupe LoganRupe commented Oct 1, 2026 •

Copy link
Copy Markdown
Owner

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-workspace as 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 repoRoots or 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/2026 and ../outside-notes. Three chat links are clicked in turn: nested folder, outside folder, worktree. Then later is added to the .code-workspace on disk and the panel is refreshed.

_Video: https://github.com/user-attachments/assets/02e4985b-22a8-4a5d-9d49-a45ac9501b78

…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.
Copilot AI balanced review requested due to automatic review settings October 1, 2026 00:10
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:M labels Oct 1, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

A failed refresh can retain stale workspace roots instead of applying the documented fallback.

Review effort: Balanced
Findings: 1 Medium severity

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;

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants