Skip to content

Fix remote agent host file picker for new URI scheme#304541

Merged
roblourens merged 3 commits intomainfrom
roblou/well-louse
Mar 24, 2026
Merged

Fix remote agent host file picker for new URI scheme#304541
roblourens merged 3 commits intomainfrom
roblou/well-louse

Conversation

@roblourens
Copy link
Member

Update the remote agent host file picker to support a new URI scheme, ensuring proper decoding of paths for remote files.

roblourens and others added 2 commits March 24, 2026 11:10
Co-authored-by: Copilot <copilot@github.com>
Copilot AI review requested due to automatic review settings March 24, 2026 18:18
@roblourens roblourens enabled auto-merge (squash) March 24, 2026 18:18
@roblourens roblourens self-assigned this Mar 24, 2026
@vs-code-engineering
Copy link
Contributor

vs-code-engineering bot commented Mar 24, 2026

📬 CODENOTIFY

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

@alexr00

Matched files:

  • src/vs/workbench/services/dialogs/browser/simpleFileDialog.ts
  • src/vs/workbench/services/dialogs/test/browser/simpleFileDialog.test.ts

@bpasero

Matched files:

  • src/vs/workbench/services/dialogs/browser/simpleFileDialog.ts
  • src/vs/workbench/services/dialogs/test/browser/simpleFileDialog.test.ts

Copy link
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

Updates the remote agent host folder picker flow to work with the new vscode-agent-host:// URI encoding by stripping/re-applying the encoded path prefix in the SimpleFileDialog, and by decoding agent-host URIs back into real remote filesystem paths where needed.

Changes:

  • Add scopedPathPrefix handling in SimpleFileDialog to present “clean” paths while still constructing correct encoded vscode-agent-host:// URIs.
  • Adjust remote agent host contribution code to derive working directories by decoding the repository URI.
  • Add tests covering scoped path prefix behavior and agent host URI/root + label formatter consistency.

Reviewed changes

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

Show a summary per file
File Description
src/vs/workbench/services/dialogs/test/browser/simpleFileDialog.test.ts New unit tests for scoped path prefix strip/reapply + round-trip behavior.
src/vs/workbench/services/dialogs/browser/simpleFileDialog.ts Implements computed scoped prefix, strips it for display, re-adds it when constructing URIs, and tightens “root” back-navigation.
src/vs/sessions/contrib/remoteAgentHost/browser/remoteAgentHost.contribution.ts Switches working-directory derivation to decode agent-host URIs.
src/vs/platform/agentHost/test/common/agentHostFileSystemProvider.test.ts Adds tests for root encoding and formatter strip segment alignment.
src/vs/platform/agentHost/common/agentHostFileSystemProvider.ts Treats decoded “root” paths as directories to support the encoded root forms.

public async showOpenDialog(options: IOpenDialogOptions = {}): Promise<URI[] | undefined> {
this.scheme = this.getScheme(options.availableFileSystems, options.defaultUri);
this.scopedAuthority = this.getScopedAuthority(options.defaultUri);
this.scopedPathPrefix = options.defaultUri && this.scopedAuthority ? this.computeScopedPathPrefix(options.defaultUri) : '';
Copy link
Member Author

@roblourens roblourens Mar 24, 2026

Choose a reason for hiding this comment

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

@alexr00 fyi agenthost uri paths now have a 'path' which encodes some extra data, then ends with the normal path that we want to display to the user. The point of this change is to detect that prefix automatically from the uri formatter, when this.scopedAuthority is set, and map between that formatted path and the real uri, so the user can work on the correctly formatted paths.

Copy link
Member Author

Choose a reason for hiding this comment

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

If you think any of this is getting too complicated for this class, I could try to externalize some of this logic. I don't expect to make any more changes than this though.

Copy link
Member

Choose a reason for hiding this comment

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

The simple file dialog is a bit of a mess, I don't think this makes it so much worse. Thank you though!

resolveWorkingDirectory could receive a file:// URI from a non-agent-host
session. agentHostRemotePath would mis-decode those paths since it expects
the encoded agent host path format. Gate decoding on AGENT_HOST_SCHEME and
fall back to fsPath for file:// URIs.

(Written by Copilot)
@roblourens roblourens merged commit 020636f into main Mar 24, 2026
20 checks passed
@roblourens roblourens deleted the roblou/well-louse branch March 24, 2026 18:57
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.

4 participants