Skip to content

[Fix] Multi-root workspaces treat secondary roots as outside the workspace#225

Draft
roomote[bot] wants to merge 5 commits into
mainfrom
roomote/repro-204-zoocode-e2e
Draft

[Fix] Multi-root workspaces treat secondary roots as outside the workspace#225
roomote[bot] wants to merge 5 commits into
mainfrom
roomote/repro-204-zoocode-e2e

Conversation

@roomote
Copy link
Copy Markdown
Contributor

@roomote roomote Bot commented May 21, 2026

Opened on behalf of Elliott de Launay. View the task or mention @roomote for follow-up asks.

Closes #204

What problem this solves

Fixes an issue where users working in a VS Code multi-root workspace could have tools treat files in secondary roots as outside the workspace. Read, edit, patch, and create flows could resolve relative paths against the first root, and root-specific .rooignore rules were not applied consistently.

Why this change was made

This change makes path resolution choose the workspace root that already contains the target file or its parent directory, then carries that resolved path through ignore and protection checks, file-context tracking, and file-tool operations. It also fixes the Windows absolute-path command case so secondary-root .rooignore rules still apply when commands reference C:\... paths directly, and adds focused unit coverage for the new multi-root resolver and absolute diff-path behavior.

User impact

File tools now behave correctly across multi-root workspaces, including creating new files under the right root and honoring secondary-root .rooignore rules across Unix and Windows command styles.

Related PRs

  • #228 - follow-up VS Code e2e coverage and harness split

@roomote roomote Bot added the roomote:auto-resolve-conflicts Allow Roomote to auto-resolve merge conflicts for this PR label May 21, 2026
@roomote roomote Bot added the roomote:auto-resolve-conflicts Allow Roomote to auto-resolve merge conflicts for this PR label May 21, 2026
@roomote
Copy link
Copy Markdown
Contributor Author

roomote Bot commented May 21, 2026

2 issues outstanding. See task

  • resolvePathInWorkspace() now resolves brand-new files into the only workspace root that already contains the parent directory, so create flows no longer fall back to the first root in that case.
  • Secondary-root .rooignore content is now loaded for execute_command and the prompt instructions instead of staying pinned to this.cwd.
  • e2e-mock is still red on the current head: the multi-root repro times out after 60s, so CI still is not proving that the second workspace folder becomes available under GitHub Actions. — moved to sibling PR #228 after splitting the product fix from the VS Code e2e harness work.
  • validateCommand() no longer skips Windows absolute paths, so validateAccess() still runs for secondary-root C:\\... arguments.
  • src/core/tools/__tests__/writeToFileTool.spec.ts now uses an explicit platform-aware in-root diff-path expectation, which matches the remaining Windows failure on f455a8e73 instead of feeding the assertion back through mocked path.resolve.
  • src/core/tools/__tests__/applyPatchTool.execute.spec.ts now matches the actual diff-path behavior on Windows instead of assuming the Linux-only in-root path shape.
  • src/core/tools/__tests__/listFilesTool.spec.ts, src/core/tools/__tests__/searchFilesTool.spec.ts, and src/core/tools/__tests__/applyDiffTool.spec.ts now directly cover the remaining multi-root path-resolution surfaces that were still missing from the patch.
  • platform-unit-test (ubuntu-latest) is still running on d4df00b6edcffd63cb03272eed48d2c05c36c3fb after the bounded wait, so the branch is not clean on Ubuntu yet.
  • platform-unit-test (windows-latest) is still running on d4df00b6edcffd63cb03272eed48d2c05c36c3fb after the bounded wait, so the branch is not clean on Windows yet.

Comment thread src/utils/pathUtils.ts
Comment thread src/core/ignore/RooIgnoreController.ts
Comment thread apps/vscode-e2e/src/runTest.ts Outdated
@roomote
Copy link
Copy Markdown
Contributor Author

roomote Bot commented May 21, 2026

Pushed d4df00b6e on #225.

What changed:

  • fixed the remaining Windows-only expectation mismatch in writeToFileTool.spec.ts by making the in-root diff-path expectation explicit per platform instead of routing it back through the mocked path.resolve
  • kept the patch scoped to the one spec file that still matched the old f455a8e73 failure log

Validation:

  • pnpm --dir src exec vitest run core/tools/__tests__/writeToFileTool.spec.ts
  • pnpm --dir src exec vitest run core/tools/__tests__/writeToFileTool.spec.ts core/tools/__tests__/applyPatchTool.execute.spec.ts core/tools/__tests__/listFilesTool.spec.ts core/tools/__tests__/searchFilesTool.spec.ts core/tools/__tests__/applyDiffTool.spec.ts
  • pnpm --dir apps/web-roo-code test

Visual proof: not applicable for this change because it only updates backend/tooling test coverage.

CI is rerunning now on d4df00b6e. On the previous head f455a8e73, codecov/patch was already green; this push is specifically to clear the remaining platform-unit-test (windows-latest) failure.

Comment thread src/core/ignore/RooIgnoreController.ts
Comment thread apps/vscode-e2e/src/suite/multi-root-read-file-content.test.ts Outdated
@roomote roomote Bot force-pushed the roomote/repro-204-zoocode-e2e branch from 3f96d01 to 5b6b41e Compare May 21, 2026 03:01
@edelauna edelauna marked this pull request as draft May 21, 2026 03:07
Comment thread src/core/tools/__tests__/writeToFileTool.spec.ts Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

roomote:auto-resolve-conflicts Allow Roomote to auto-resolve merge conflicts for this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Support for multi-root workspaces

1 participant