fix: isolate per-folder exception in mode picker for multi-project workspaces#190
Merged
Merged
Conversation
7719c6e to
704f1f9
Compare
Contributor
There was a problem hiding this comment.
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
loadModeOptionsandgetWorkspaceNameForMode. - 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>
704f1f9 to
481f6d9
Compare
jdneo
approved these changes
May 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
In
McpPreferencePage.getWorkspaceNameForMode(), the entire workspace-folder loop was wrapped in a singletry-catch. If any project in the workspace had a non-file://URI (e.g. EFS-backedsftp://,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 thePaths.get()call for each workspace folder into a per-folder innertry-catch. One bad URI now only skips that single folder; the loop continues for the remaining folders.INFO/WARNdiagnostic log statements so future issues can be diagnosed fromworkspace.logwithout a debugger.Testing
Manually verified in a two-project workspace where one project uses a non-
file://URI:WARNlog entry.