Skip to content

Multi-repo: the files panel and @ search don't follow the .code-workspace folder list #323

Closed

Description

@dotrahat

For a .code-workspace project, the files panel and @ file search don't show the folders the file lists. With two or more repos they show only the git folders, so a listed plain folder is left out. With one repo they show the whole workspace folder, so folders the file doesn't list show up.

A listed folder is left out (two repos)

~/dev/scope-test/
  scope-test.code-workspace   folders: api, web, docs
  api/    git
  web/    git
  docs/   no git, listed
    release.md

The files panel shows only api and web, and @release.md shows "No matching files or folders". To point the agent at docs/release.md, you have to type or paste the path.

Scenario A: the .code-workspace lists api, web and docs, but the files panel shows only api and web, and @release.md finds no match

Unlisted folders are shown (one repo)

~/dev/scope-test-three/
  scope-test-three.code-workspace   folders: api, docs
  api/    git
  docs/   no git, listed
  luigi/  no git, not listed
    yoshi.md

The files panel shows api, docs, luigi and the .code-workspace file itself, and @yoshi finds luigi/yoshi.md, although the file doesn't list luigi.

Scenario D: the .code-workspace lists api and docs, but the files panel also shows luigi and the workspace file, and @yoshi finds luigi/yoshi.md

The other two combinations

Two repos with an unlisted folder (scope-test-two: lists api, web, docs; luigi on disk). The files panel shows api and web, so the listed docs and the unlisted luigi are both hidden, and @release finds nothing.

Scenario C: two repos, the files panel shows only api and web, and @release finds no match

One repo, no unlisted folder (scope-test-one: lists api, docs). @release finds docs/release.md, and the files panel shows api, docs and the workspace file.

Scenario B: with one repo, @release finds docs/release.md and the files panel shows the whole workspace folder

Why

Two decisions use the wrong signal:

  • Which folders: WorkspaceFile.read keeps only listed folders that have a .git, as repoRoots (apps/server/src/workspace/WorkspaceFile.ts:184-186). The listed plain folders aren't stored on the project.
  • Whether to show separate folders at all: the files panel and @ search only use repoRoots when there are two or more (apps/web/src/components/ChatView.tsx:3653, apps/web/src/components/files/FileBrowserPanel.tsx:126). With one repo they fall back to the project's workspace root, which for a .code-workspace project is the folder the file sits in (ChatView.tsx:3630-3633). The comment on the @ search roots expects that fallback to be the repo: "single-repo projects search the worktree-aware gitCwd alone" (ChatView.tsx:3674-3675).

The same fallback is why a one-repo workspace offers Initialize Git instead of Source Control (Scenarios B and D). With fewer than two repos, the header's git control runs on that workspace folder (apps/web/src/components/chat/ChatHeader.tsx:401-417), which has no .git.

How this differs from #313

#313 lists repoRoots in the agent's instructions, and its wording was narrowed so it doesn't say plain folders are outside the project (comment). This issue is about the files panel and @ search, which pick their folders from the same git-only list.

Question

Should the files panel and @ search follow the folders a .code-workspace lists, whether they have git or not and however many repos there are?

If yes, one way to do it: store the listed folders that exist on the project next to repoRoots, the same way repoRoots is stored. Every place that saves repoRoots already has the listed folders from the same read of the file:

  • adding the project (apps/web/src/components/CommandPalette.tsx:3086-3090)
  • saving the folders dialog (apps/web/src/components/ProjectFoldersDialog.tsx:222-226)
  • the re-read when a project loads (apps/web/src/hooks/useWorkspaceProjectReconcile.ts:106-113)
  • opening a workspace file from the desktop app (apps/web/src/components/desktop/DesktopAppActivationCoordinator.tsx:77-80)

The re-read on load only updates the project when repoRoots or the file path changes (useWorkspaceProjectReconcile.ts:100-101), so it would need to compare the folder list too. Otherwise a hand edit that only adds or removes a plain folder wouldn't reach the project.

The files panel and @ search would then use that list for any project with a workspaceFile, and diffs, checkpoints and PRs would keep using repoRoots.

Activity

  1. LoganRupe commented on Sep 29, 2026

    @LoganRupe
    Owner

    @dotrahat could you review #325 when you get a chance?

  2. dotrahat commented on Sep 30, 2026

    @dotrahat
    Author

    @LoganRupe sure, I'll review that.

  3. added a commit that references this issue on Sep 30, 2026
    75c7d8e
  4. dotrahat commented on Sep 30, 2026

    @dotrahat
    Author

    @LoganRupe, I reviewed #325 after it merged: #325 (comment)

    All four scenarios from this issue pass on 75c7d8e37. The review lists four follow-ups (chat file links, the folder list only refreshing through Manage folders, one-repo workspaces not starting isolated runs, and mobile and agent access), which I can open as separate issues.

  5. LoganRupe commented on Oct 1, 2026

    @LoganRupe
    Owner

    @dotrahat thanks for the review, it was a big help. All four follow-ups are now on multi-repo-workspaces (feee30eed5):

    1. Chat file links (fix(web): chat file links and files panel refresh follow the workspace folder list #331): links resolve against the same folders the files panel lists, so nested folders, folders outside the workspace folder, and worktree files highlight in the tree.
    2. Folder list refresh (fix(web): chat file links and files panel refresh follow the workspace folder list #331): the panel's refresh button re-reads the .code-workspace, and the tree waits for the first read instead of flashing the old layout.
    3. One-repo workspaces (fix(web): one-repo workspaces get their git controls back #332): the git controls are back, so New worktree works and Initialize Git is gone.
    4. Mobile and agent access (fix(mobile): files and @ search follow the .code-workspace folder list #333, feat(server): agents can reach every folder a .code-workspace lists #334): mobile's file tree and @ search follow the folder list, and agents can reach every listed folder. Plain folders are shared with isolated runs and sit outside checkpoints, which the docs now say.

    Two things I know are still open: mobile chat links don't use the folder list yet, and Codex may still block writes to folders outside its working directory.

    If you get a chance to retest from a fresh build, I'd love to hear how it goes. I'll close this once you're happy, and please open new issues for anything else you find.

  6. dotrahat commented on Oct 1, 2026

    @dotrahat
    Author

    @LoganRupe I'm happy to assist. I'll retest fresh build soon and share.

  7. dotrahat commented on Oct 2, 2026

    @dotrahat
    Author

    @LoganRupe retested on a fresh build of feee30eed, and all four follow-ups work:

    1. Chat file links: links into a nested folder, a folder outside the workspace folder, and an isolated run's worktree all highlight in the tree.
    2. Folder list refresh: the refresh button picks up edits made outside the app, and recovers the list after the .code-workspace was unreadable.
    3. One-repo workspaces: Source Control is back instead of Initialize Git, and a New worktree run works.
    4. Agent access: asked for the project's folders, the agent now lists docs too, and in Auto-accept edits Claude's edit to a listed folder outside the workspace folder needed no approval (it only asked about a shell command it ran first). Codex asked for approval for the same write, as you expected.

    The original four scenarios from this issue, the folders dialog, and isolated runs in both two-repo and one-repo projects all pass. I didn't test mobile, since that needs a mobile build from this branch.

    One new bug turned up while retesting: #335, where right-click actions in the files panel use the folder's display name instead of its real path. From my side, this one is good to close.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions