Skip to content

Fix remote chat plugin paths - #326916

Merged
Martin Aeschlimann (aeschli) merged 19 commits into
microsoft:mainfrom
brandonh-msft:brandonh-msft-fix-chat-plugin-paths
Sep 17, 2026
Merged

Martin Aeschlimann (aeschli) merged 19 commits into
microsoft:mainfrom
brandonh-msft:brandonh-msft-fix-chat-plugin-paths

Conversation

@brandonh-msft

@brandonh-msft Brandon H (brandonh-msft) commented Jul 22, 2026 •

Copy link
Copy Markdown
Contributor

Configured plugin locations currently rebuild absolute paths as file: URIs, which makes them inaccessible when the workspace is remote. Preserve the user-home URI scheme and authority for absolute and tilde locations so Remote WSL and SSH paths resolve through the remote file service.

  • Preserve remote URI identity for configured plugin locations and enterprise plugin installs.
  • Add Remote WSL-style regression coverage for absolute and tilde paths.

Fixes: #301167

Copilot AI review requested due to automatic review settings July 22, 2026 05:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Preserves remote URI schemes and authorities when resolving configured plugin and skill paths.

Changes:

  • Resolves absolute, tilde, and enterprise plugin paths against remote user homes.
  • Applies equivalent handling to Copilot skill locations.
  • Adds Remote WSL regression tests.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
agentPluginServiceImpl.ts Preserves remote identity for plugin paths.
configuredAgentPluginDiscovery.test.ts Tests remote plugin path resolution.
customInstructionsService.ts Updates configured skill resolution.
skillConfigLocations.ts Preserves remote identity for shared skill locations.
skillConfigLocations.spec.ts Tests remote skill paths.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (1)

src/vs/workbench/contrib/chat/common/plugins/agentPluginServiceImpl.ts:684

  • URI.file normalizes according to the client OS, not the remote OS. For example, from a Linux/macOS client connected to a Windows SSH host, URI.file('C:\\plugins') keeps the backslashes and produces a path that does not begin with /; transplanting it onto the non-empty remote authority then throws URI validation instead of discovering the plugin. IPathService.fileURI() is specifically documented to use the target environment's path rules (pathService.ts:20-52); use it (and then preserve the remote identity) rather than URI.file for remote absolute paths.
			const uri = URI.file(path);
			return [userHome.scheme === Schemas.file ? uri : userHome.with({ path: uri.path })];

@wenma531

noreply (wenma531) commented Jul 22, 2026 via email

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

src/vs/workbench/contrib/chat/common/plugins/agentPluginServiceImpl.ts:679

  • The tilde branch still normalizes with URI.file, which uses the client OS. On a Linux/macOS client connected to a Windows SSH target, ~\plugins therefore retains backslashes in the remote URI even though the absolute-path branch correctly uses IPathService.fileURI for target-OS normalization. Normalize the expanded tilde path through the path service as well before restoring the home scheme/authority.
			return [userHome.with({ path: URI.file(untildify(path, userHome.path)).path })];

Brandon H (brandonh-msft) and others added 10 commits July 22, 2026 14:27
Preserve remote URI scheme and authority for configured plugin and skill locations.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: a709d3d4-1ecd-44ce-89bc-c343a6e47285
Only expand valid tilde path forms so other names beginning with tilde remain workspace-relative.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: a709d3d4-1ecd-44ce-89bc-c343a6e47285
Co-authored-by: Copilot App <[email protected]>

Copilot-Session: a709d3d4-1ecd-44ce-89bc-c343a6e47285
Co-authored-by: Copilot App <[email protected]>

Copilot-Session: a709d3d4-1ecd-44ce-89bc-c343a6e47285
Co-authored-by: Copilot App <[email protected]>

Copilot-Session: a709d3d4-1ecd-44ce-89bc-c343a6e47285
Co-authored-by: Copilot App <[email protected]>

Copilot-Session: a709d3d4-1ecd-44ce-89bc-c343a6e47285
Co-authored-by: Copilot App <[email protected]>

Copilot-Session: a709d3d4-1ecd-44ce-89bc-c343a6e47285
Co-authored-by: Copilot App <[email protected]>

Copilot-Session: a709d3d4-1ecd-44ce-89bc-c343a6e47285
Co-authored-by: Copilot App <[email protected]>

Copilot-Session: a709d3d4-1ecd-44ce-89bc-c343a6e47285
@brandonh-msft
Brandon H (brandonh-msft) force-pushed the brandonh-msft-fix-chat-plugin-paths branch from 6a0f13f to 183afc4 Compare July 22, 2026 21:28
Co-authored-by: Copilot App <[email protected]>

Copilot-Session: a709d3d4-1ecd-44ce-89bc-c343a6e47285
Co-authored-by: Copilot App <[email protected]>

Copilot-Session: a709d3d4-1ecd-44ce-89bc-c343a6e47285
@brandonh-msft
Brandon H (brandonh-msft) marked this pull request as ready for review July 22, 2026 22:57
@vs-code-engineering

Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

TylerLeonhardt

Matched files:

  • extensions/copilot/src/extension/chatSessions/claude/node/test/skillConfigLocations.spec.ts

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (5)

src/vs/workbench/contrib/chat/common/plugins/agentPluginServiceImpl.ts:685

  • When the remote target is Windows and path is a UNC location, fileURI() returns the server name in uri.authority (see pathService.ts:194-204). Replacing only the path therefore turns \\server\share\plugin into <remote>/share/plugin, silently dropping server. Preserve the UNC authority as the leading //server portion of the remote path before applying the remote connection authority.
			return [userHome.scheme === Schemas.file ? uri : userHome.with({ path: uri.path })];

extensions/copilot/src/platform/customInstructions/common/customInstructionsService.ts:257

  • For a UNC skill location on a remote Windows host, URI.file(location) stores the file server in uri.authority. This branch discards that value and resolves \\server\share\skills as <remote>/share/skills. Encode the UNC server into the remote URI path while retaining the remote connection authority.
								const uri = URI.file(location);
								configSkillLocationUris.push(locationRoot.scheme === Schemas.file ? uri : locationRoot.with({ path: uri.path }));

extensions/copilot/src/extension/chatSessions/common/skillConfigLocations.ts:44

  • For a UNC skill location on a remote Windows host, URI.file(location) stores the file server in uri.authority. Applying only uri.path loses that server and points at <remote>/share/skills instead of \\server\share\skills. Preserve the UNC server in the remote URI path.
			const uri = URI.file(location);
			results.push(locationRoot.scheme === Schemas.file ? uri : locationRoot.with({ path: uri.path }));

extensions/copilot/src/platform/customInstructions/common/customInstructionsService.ts:244

  • This infers the remote authority only from workspace folders. In a Remote WSL/SSH window with no folder open, getWorkspaceFolders() returns [] (workspaceServiceImpl.ts:66-67), so configured absolute and tilde locations still become file: URIs and cannot match remote skill resources. Use a source of the window's remote URI identity that is available independently of workspace folders.
					const locationRoot = userHome.scheme === Schemas.file
						? workspaceFolders.find(folder => folder.scheme === Schemas.vscodeRemote) ?? userHome
						: userHome;

extensions/copilot/src/extension/chatSessions/common/skillConfigLocations.ts:34

  • This fallback still returns file: URIs in an empty Remote WSL/SSH window because getWorkspaceFolders() returns [] when no folder is open (workspaceServiceImpl.ts:66-67). Absolute and tilde configured locations should retain the remote identity even in an empty window; derive it from a service that exposes the window's remote URI independently of workspace folders.
	const locationRoot = userHome.scheme === Schemas.file
		? workspaceFolders.find(folder => folder.scheme === Schemas.vscodeRemote) ?? userHome
		: userHome;

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: a709d3d4-1ecd-44ce-89bc-c343a6e47285
Co-authored-by: Copilot App <[email protected]>

Copilot-Session: a709d3d4-1ecd-44ce-89bc-c343a6e47285
…onh-msft-fix-chat-plugin-paths

# Conflicts:
#	src/vs/workbench/contrib/chat/common/plugins/agentPluginServiceImpl.ts

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

src/vs/workbench/contrib/chat/common/plugins/agentPluginServiceImpl.ts:680

  • Using userHome.path drops the authority of a local UNC home. For example, file://server/share/user expands ~/plugins from /share/user, so the plugin is looked up on the local drive instead of \\server\share\user\plugins; the previous fsPath conversion preserved this. Use fsPath for file homes and path for remote homes before calling untildify.
			const uri = await this._pathService.fileURI(untildify(path, userHome.path));

@brandonh-msft

Copy link
Copy Markdown
Contributor Author

failures appear to be transient. LMK if you disagree Christof Marti (@chrmarti) / TylerLeonhardt

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

src/vs/workbench/contrib/chat/common/plugins/agentPluginServiceImpl.ts:683

  • When the local user home is itself a UNC URI, expanding from userHome.path drops its server authority. For example, file://server/share/home plus ~/plugins becomes file:///share/home/plugins because _toTargetResource returns local file URIs unchanged. Restore the home authority for this tilde-derived local URI (or join directly onto userHome).
			const uri = await this._pathService.fileURI(untildify(path, userHome.path));
			return [this._toTargetResource(uri, userHome)];

@aeschli

Copy link
Copy Markdown
Contributor

Tested on WSL. Thanks Brandon H (@brandonh-msft) !

@brandonh-msft

Copy link
Copy Markdown
Contributor Author

Tested on WSL. Thanks Brandon H (Brandon H (@brandonh-msft)) !

who else needs to approve?
Martin Aeschlimann (@aeschli) Christof Marti (@chrmarti)

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.

chat.pluginLocations: absolute paths and tilde (~/) paths not resolved in Remote WSL

6 participants