Skip to content

fix: isolate per-folder exception in mode picker for multi-project workspaces#190

Merged
jdneo merged 1 commit into
mainfrom
fix/issue-180-mode-picker-multi-project
May 14, 2026
Merged

fix: isolate per-folder exception in mode picker for multi-project workspaces#190
jdneo merged 1 commit into
mainfrom
fix/issue-180-mode-picker-multi-project

Conversation

@duzitong
Copy link
Copy Markdown
Contributor

Problem

In McpPreferencePage.getWorkspaceNameForMode(), the entire workspace-folder loop was wrapped in a single try-catch. If any project in the workspace had a non-file:// URI (e.g. EFS-backed sftp://, ecf://, or other custom linked resources), Paths.get(URI.create(...)) would throw and the outer catch would return "" for all custom modes — hiding every custom mode from the mode picker dropdown.

Fixes #180

Changes

  • McpPreferencePage.java: Move the Paths.get() call for each workspace folder into a per-folder inner try-catch. One bad URI now only skips that single folder; the loop continues for the remaining folders.
  • Add INFO/WARN diagnostic log statements so future issues can be diagnosed from workspace.log without a debugger.

Testing

Manually verified in a two-project workspace where one project uses a non-file:// URI:

  • Before fix: custom modes were hidden from the mode picker.
  • After fix: modes scoped to the valid project appear correctly; the invalid-URI project is skipped with a WARN log entry.

Copilot AI review requested due to automatic review settings May 14, 2026 03:23
@duzitong duzitong force-pushed the fix/issue-180-mode-picker-multi-project branch from 7719c6e to 704f1f9 Compare May 14, 2026 03:25
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes issue #180 where multi-project workspaces containing a project with a non-file:// URI would cause the entire custom mode picker to be empty. The outer try/catch around the workspace-folder loop in getWorkspaceNameForMode is replaced with a per-folder try/catch so a single bad URI no longer aborts resolution for all custom modes. Additional diagnostic logging is added to aid future investigations.

Changes:

  • Wrap the per-folder Paths.get(URI.create(folder.getUri())) call in its own try/catch so one invalid URI only skips that folder.
  • Add diagnostic log statements throughout loadModeOptions and getWorkspaceNameForMode.
  • Include the offending mode id and folder URI in error messages for easier triage.
Comments suppressed due to low confidence (1)

com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/preferences/McpPreferencePage.java:1107

  • The PR description mentions adding "INFO/WARN diagnostic log statements", but the per-folder failure is logged at ERROR level (LOGGER.error(...)) rather than WARN. Since a single bad folder URI is now an expected, non-fatal condition that the loop is designed to skip, WARN would more accurately reflect the severity and avoid noise in error monitoring.
  /**
   * Load per-mode tool status from preferences.
   */

…rkspaces

In McpPreferencePage.getWorkspaceNameForMode(), the entire workspace-folder
loop was wrapped in one try-catch. If any project had a non-file:// URI
(e.g. EFS-backed sftp://, ecf:// or other custom linked resources),
Paths.get(URI.create(...)) would throw and the catch would return '' for
ALL custom modes — hiding them from the mode picker dropdown.

Move the Paths.get() call into a per-folder inner try-catch so one
bad URI only skips that folder; the loop continues for the rest.

Also add INFO/WARN diagnostic logs so future issues can be diagnosed
from workspace.log without a debugger.

Fixes: #180

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@duzitong duzitong force-pushed the fix/issue-180-mode-picker-multi-project branch from 704f1f9 to 481f6d9 Compare May 14, 2026 03:30
@jdneo jdneo merged commit 3452fa5 into main May 14, 2026
4 checks passed
@jdneo jdneo deleted the fix/issue-180-mode-picker-multi-project branch May 14, 2026 05:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The mode picker will be blank in preference page when workspace contains 'remote' FS project.

3 participants