Skip to content

feat(server): agents can reach every folder a .code-workspace lists - #334

Merged
LoganRupe merged 3 commits into
multi-repo-workspacesfrom
feature/323/agent-access-to-workspace-folders
Oct 1, 2026
Merged

LoganRupe merged 3 commits into
multi-repo-workspacesfrom
feature/323/agent-access-to-workspace-folders

Conversation

@LoganRupe

@LoganRupe LoganRupe commented Oct 1, 2026 •

Copy link
Copy Markdown
Owner

What Changed

Agents can now reach every folder a project's .code-workspace lists, not only the git repos.

  • The server reads the .code-workspace when a provider session starts. Listed folders that exist and are not repositories become the session's plain folders. There is no new column and no migration.
  • Claude and Codex get the plain folders outside the session's working directory through the existing extra-roots mechanism. repoRoots is untouched, so git surfaces and checkpoints behave as before.
  • Every provider gets a <project_folders> block in its instructions naming the plain folders. In an isolated run it adds one sentence: the folders are the originals, shared with other runs, and outside checkpoints.
  • If the file cannot be read, the session starts with the repos only and the server logs a warning.
  • A change to the file applies on the next session start.
  • docs/user/project-settings.md gains a short section on this.

A listed folder inside a repo root counts as part of that repo, so an isolated run keeps using the worktree for it.

Why

Follow-up 4 (agent half) from the review of #325 on #323. The files panel and @ search offered every listed folder, but the agent was only given repoRoots. A listed folder outside the workspace folder was never granted, and in an isolated run no plain folder was, so an @ reference could point the agent at a path it had to ask for or could not write.

Not covered here: plain folders are outside checkpoints and the diff panel, a recovered session is rebuilt from its working directory alone (the same gap repos have today), and Codex's sandbox may still block writes outside its working directory.

UI Changes

Before (995120e) on the left, this branch on the right. The workspace lists the repo api, the plain folder docs, and ../outside-notes. Both threads run Claude in Supervised mode, where reading outside the granted directories asks first.

  1. Current checkout: read a file in ../outside-notes. Left asks for a file read approval. Right answers.
  2. New worktree: read a file in docs, which sits beside the repo and not in its worktree. Left asks again. Right answers.

_Video:

compare.mp4

A workspace-file project only handed the agent its repo roots, so a listed folder that is not a git repository was out of reach when it sat outside the workspace folder, and in every isolated run.

The provider command reactor now reads the .code-workspace when a provider session starts. Listed folders that exist and are not repositories go into the workspace manifest as plain folders. Claude and Codex get the ones outside the session cwd through additionalRoots, and every provider gets them named in the runtime instructions, apart from the repositories. In an isolated run they stay the original folders and the instructions say so. An unreadable file logs a warning and the session starts with its repositories only.
Copilot AI balanced review requested due to automatic review settings October 1, 2026 02:17
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L 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

Newly listed Git repositories can be misclassified and granted as shared plain folders, bypassing isolated worktrees.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Adds .code-workspace plain-folder access to provider sessions while preserving repository-based git behavior.

Changes:

  • Resolves and grants listed non-repository folders at session start.
  • Adds provider instructions describing plain folders and isolation behavior.
  • Adds documentation and focused tests.
File Description
packages/​contracts/​src/​provider.ts Extends session inputs with plain-folder metadata.
docs/​user/​project-settings.md Documents workspace-folder behavior.
apps/​server/​src/​workspace/​WorkspaceManifest.ts Resolves plain folders and grants.
apps/​server/​src/​workspace/​WorkspaceManifest.test.ts Tests manifest resolution.
apps/​server/​src/​provider/​RuntimeInstructions.ts Adds project-folder instructions.
apps/​server/​src/​provider/​RuntimeInstructions.test.ts Tests instruction generation.
apps/​server/​src/​provider/​Layers/​CodexSessionRuntime.ts Carries metadata into Codex turns.
apps/​server/​src/​provider/​Layers/​CodexAdapter.ts Forwards metadata to Codex runtime.
apps/​server/​src/​orchestration/​Layers/​ProviderCommandReactor.ts Reads workspace files when sessions start.
apps/​server/​src/​orchestration/​Layers/​ProviderCommandReactor.test.ts Tests session folder propagation and failure fallback.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread apps/server/src/workspace/WorkspaceManifest.ts

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

Incomplete repository-overlap detection can expose original checkouts during isolated runs, and the documentation overstates which folders bypass checkpoints.

Review effort: Balanced
Findings: 1 High severity

Open (1)
Resolved since last review (1)
Previously missed (1)

In code that hasn't changed since last review

Low severity Clarify warning to apply only to folders outside repositories

docs/​user/​project-settings.md:111

This warning is inaccurate for a listed subfolder inside a repository: the manifest deliberately treats it as part of that repository, so an isolated thread uses the worktree copy and checkpoints do cover it. Qualify this as folders outside repositories so users are not incorrectly told those edits are shared and unrevertible.

Comment thread apps/server/src/workspace/WorkspaceManifest.ts Outdated
@LoganRupe
LoganRupe merged commit ea06838 into multi-repo-workspaces Oct 1, 2026
7 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 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