Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Aug 5, 2025

Summary

This PR fixes issue #6720 where Roo Code incorrectly identifies the .roo folder location in multi-root workspaces. When .roo is added as one of the workspace folders, it should be recognized directly rather than being treated as a subdirectory of another workspace folder.

Problem

In multi-root workspaces, when .roo is added as a workspace folder, Roo Code was still creating/looking for .roo as a subdirectory of the first workspace folder instead of recognizing the existing .roo workspace folder.

Solution

  • Added findWorkspaceWithRoo() utility function to detect when .roo is one of the workspace folders
  • Updated getProjectRooDirectoryForCwd() to return the .roo workspace folder path directly when it exists
  • Updated all direct .roo path constructions throughout the codebase to use the centralized utility functions
  • Added comprehensive tests for multi-root workspace scenarios

Changes

  • src/services/roo-config/index.ts: Added findWorkspaceWithRoo() and updated getProjectRooDirectoryForCwd()
  • src/core/webview/webviewMessageHandler.ts: Updated to use getProjectRooDirectoryForCwd()
  • src/services/mcp/McpHub.ts: Updated to use getProjectRooDirectoryForCwd()
  • src/services/marketplace/SimpleInstaller.ts: Updated to use getProjectRooDirectoryForCwd()
  • src/core/config/CustomModesManager.ts: Updated to use getProjectRooDirectoryForCwd()
  • src/services/roo-config/tests/index.spec.ts: Added tests for the new functionality

Testing

  • Added unit tests for findWorkspaceWithRoo() function
  • Added tests for getProjectRooDirectoryForCwd() with multi-root workspace scenarios
  • All existing tests pass without regression
  • Manually tested in VS Code with multi-root workspaces

Fixes #6720


Important

Fixes issue #6720 by correctly identifying .roo folder in multi-root workspaces using a new utility function and updating relevant code paths.

  • Behavior:
  • Code Updates:
    • src/services/roo-config/index.ts: Adds findWorkspaceWithRoo() and updates getProjectRooDirectoryForCwd().
    • src/core/webview/webviewMessageHandler.ts, src/services/mcp/McpHub.ts, src/services/marketplace/SimpleInstaller.ts, and src/core/config/CustomModesManager.ts: Updated to use getProjectRooDirectoryForCwd().
  • Testing:
    • Adds unit tests for findWorkspaceWithRoo() and getProjectRooDirectoryForCwd() in src/services/roo-config/__tests__/index.spec.ts.
    • Manually tested in VS Code with multi-root workspaces.
  • Misc:
    • Initializes vscodeUtils in src/extension.ts for roo-config wrapper.

This description was created by Ellipsis for 97e969a. You can customize this summary. It will automatically update as commits are pushed.

- Add findWorkspaceWithRoo() utility to detect when .roo is a workspace folder
- Update getProjectRooDirectoryForCwd() to return .roo workspace path directly
- Update all direct .roo path constructions to use centralized utilities
- Add comprehensive tests for multi-root workspace scenarios

Fixes #6720
@roomote roomote bot requested review from cte, jr and mrubens as code owners August 5, 2025 11:41
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. bug Something isn't working labels Aug 5, 2025
Copy link
Contributor Author

@roomote roomote bot left a comment

Choose a reason for hiding this comment

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

I reviewed my own code and found it surprisingly coherent. Must be a bug in the review process.

Overall, the implementation correctly addresses issue #6720 by detecting when .roo is a workspace folder and using it directly instead of creating a subdirectory. The changes are well-tested and maintain backward compatibility.

However, there are a couple of issues that need attention:

  1. Missing async/await in getRooDirectoriesForCwd: The function calls getProjectRooDirectoryForCwd() but doesn't await it, which will cause issues since it's now async.

  2. Documentation clarity: The JSDoc for findWorkspaceWithRoo() could be clearer about finding a folder named .roo rather than one containing it.

  3. Async consistency: While the diff shows updates to use await, we should verify all callers throughout the codebase handle the async nature properly.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Aug 5, 2025
roomote added 2 commits August 5, 2025 11:48
- Separate vscode-dependent code into vscode-utils.ts
- Create wrapper module to conditionally use vscode functionality
- Update all imports to use the wrapper instead of direct imports
- Initialize vscode utilities during extension activation
- This prevents the webview build from failing due to vscode module not being available in browser context
- Update custom-system-prompt.ts to use async getSystemPromptFilePath
- Update ClineProvider.ts to handle async change
- Update MarketplaceManager.ts to use getProjectRooDirectoryForCwd wrapper
- Update webviewMessageHandler.ts to use wrapper (already done)

This ensures all .roo path constructions properly check for workspace folders
@daniel-lxs daniel-lxs moved this from Triage to PR [Needs Prelim Review] in Roo Code Roadmap Aug 6, 2025
@hannesrudolph hannesrudolph added PR - Needs Preliminary Review and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Aug 6, 2025
@daniel-lxs
Copy link
Member

Same issue as on #6701, the first root directory will be chosed if it contains a .roo directory

@daniel-lxs daniel-lxs closed this Aug 12, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Aug 12, 2025
@github-project-automation github-project-automation bot moved this from PR [Needs Prelim Review] to Done in Roo Code Roadmap Aug 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working PR - Needs Preliminary Review size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Roo does not identify .roo folder in multiroot workspace

4 participants