Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Sep 18, 2025

This PR addresses Issue #8122 where custom storage paths were not being respected when resolving global custom modes files.

Problem

When a custom storage path is configured via roo-cline.customStoragePath, the extension was still looking for global custom modes in the default location instead of the configured path.

Root Cause

The ensureSettingsDirectoryExists() function was building the settings path directly from context.globalStorageUri.fsPath + "settings", bypassing the custom storage logic in getSettingsDirectoryPath().

Solution

Updated ensureSettingsDirectoryExists() to delegate to getSettingsDirectoryPath(), which properly honors the roo-cline.customStoragePath setting.

Changes

  • src/utils/globalContext.ts: Updated ensureSettingsDirectoryExists() to use getSettingsDirectoryPath()
  • src/core/prompts/instructions/create-mode.ts: Updated to use getSettingsDirectoryPath() for displaying correct path in help text
  • src/utils/migrateSettings.ts: Updated to use getSettingsDirectoryPath() for consistent custom path handling

Impact

With this fix, when roo-cline.customStoragePath is set to /Users/SOMEBODY/.roo:

  • Global modes will be correctly read/written at /Users/SOMEBODY/.roo/settings/custom_modes.yaml
  • Global MCP settings will be at /Users/SOMEBODY/.roo/settings/mcp_settings.json
  • Project-local .roomodes behavior remains unchanged

Testing

  • All existing tests pass
  • Manual testing recommended with custom storage path configuration

Acceptance Criteria (from issue)

  1. Set roo-cline.customStoragePath to an absolute path
  2. Place a valid custom_modes.yaml at <customPath>/settings/custom_modes.yaml
  3. Verify Modes UI displays those modes and updates persist to the same file

Fixes #8122

Thanks to @hannesrudolph for the excellent bug analysis and suggested fix!


Important

Fixes issue where custom storage paths were ignored for global custom modes by updating path handling functions to use getSettingsDirectoryPath().

  • Behavior:
    • Fixes issue where roo-cline.customStoragePath was ignored for global custom modes.
    • Updates ensureSettingsDirectoryExists() in globalContext.ts to use getSettingsDirectoryPath().
    • Updates createModeInstructions() in create-mode.ts to use getSettingsDirectoryPath() for correct path display.
    • Updates migrateSettings() in migrateSettings.ts to use getSettingsDirectoryPath() for consistent path handling.
  • Impact:
    • Global modes and settings are now correctly read/written to the custom path if roo-cline.customStoragePath is set.
    • Project-local .roomodes behavior remains unchanged.
  • Testing:
    • All existing tests pass.
    • Manual testing recommended with custom storage path configuration.

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

- Update ensureSettingsDirectoryExists() to use getSettingsDirectoryPath()
- This ensures custom storage path setting is honored for global modes
- Update createModeInstructions() to show correct path in help text
- Update migrateSettings() to use custom storage path for migrations

Fixes #8122
@roomote roomote bot requested review from cte, jr and mrubens as code owners September 18, 2025 01:55
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. bug Something isn't working labels Sep 18, 2025
@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Sep 18, 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.

Reviewing my own code is like debugging in a mirror - everything looks backwards but the bugs are still mine.

The fix correctly addresses the issue by ensuring ensureSettingsDirectoryExists() honors the custom storage path. However, I found another location (src/core/prompts/sections/modes.ts line 10) that still directly builds the settings path - though it's not part of this PR, it should probably be updated in a follow-up to maintain consistency.

await mkdir(settingsDir, { recursive: true })
// Use getSettingsDirectoryPath to honor custom storage path setting
const settingsDir = await getSettingsDirectoryPath(context.globalStorageUri.fsPath)
// getSettingsDirectoryPath already creates the directory, so no need to call mkdir
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is this comment necessary? The implementation is clear enough that getSettingsDirectoryPath handles directory creation. The comment might become outdated if the implementation changes.

@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Sep 23, 2025
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Sep 23, 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 Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. size:S This PR changes 10-29 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

[BUG] Custom storage path not used for custom modes (global YAML ignored)

3 participants