Fix remote agent-host workspace URI translation - #333296
Draft
Dileep Yavanmandha (dileepyavan) wants to merge 3 commits into
Draft
Fix remote agent-host workspace URI translation#333296Dileep Yavanmandha (dileepyavan) wants to merge 3 commits into
Dileep Yavanmandha (dileepyavan) wants to merge 3 commits into
Conversation
Normalize remote workspace directory URIs at the editor AHP boundary and restore workbench identities in responses and updates. Preserve existing permission checks and cover creation, reconnects, and multi-root updates. Fixes microsoft#331566 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Dileep Yavanmandha <dileepy@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot started reviewing on behalf of
Dileep Yavanmandha (dileepyavan)
August 29, 2026 00:48
View session
Contributor
There was a problem hiding this comment.
Copilot review overview
Review tier: Balanced
Findings: 2
新建议题s introduced by this change (2)
| Severity | Finding |
|---|---|
src/vs/workbench/services/agentHost/common/editorRemoteAgentHostTransport.ts — SessionWorkingDirectoryReplaced is the one directory action not translated here. On an… |
|
src/vs/workbench/services/agentHost/browser/editorRemoteAgentHostServiceClient.ts — The shared protocol client also adds a singular workingDirectory containing the same… |
What changed in this PR
Adds remote Agent Host URI translation between workbench vscode-remote: identities and host-local file: URIs.
Changes:
- Introduces a URI-translating AHP transport.
- Integrates it with the remote service client.
- Adds transport and session-listing regression tests.
| File | Description |
|---|---|
editorRemoteAgentHostTransport.ts |
Translates directory-bearing protocol messages. |
editorRemoteAgentHostServiceClient.ts |
Wires the adapter and unwraps listed roots. |
editorRemoteAgentHostTransport.test.ts |
Tests translation and lifecycle behavior. |
editorRemoteAgentHostServiceClient.test.ts |
Tests integration and listed identities. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+123
to
+127
| case ActionType.SessionWorkingDirectorySet: | ||
| case ActionType.SessionWorkingDirectoryRemoved: | ||
| case ActionType.ChatWorkingDirectorySet: | ||
| case ActionType.ChatWorkingDirectoryRemoved: | ||
| return { ...action, directory: map(action.directory) }; |
Comment on lines
+249
to
+252
| return sessions.map(session => ({ | ||
| ...session, | ||
| workingDirectories: session.workingDirectories?.map(fromAgentHostUri), | ||
| })); |
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
注册 for free
to join this conversation on GitHub.
Already have an account?
登录 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.

Summary
Fixes #331566 — Agent file tools incorrectly prompt "Allow reading file outside of workspace?" for the current workspace in WSL. The same URI mismatch also affects Remote SSH.
The editor supplies workspace directories as
vscode-remote:URIs, but the agent host runs on the remote machine and needs host-localfile:URIs. AHP carries these values as strings inside JSON frames, so the regular remote IPC URI-object transformation does not apply. This breaks workspace containment checks and can cause customization watchers to fail withENOPRO.Changes
EditorRemoteAgentHostTransport, an editor-remote connection adapter that reuses the existingcreateURITransformerrather than introducing new conversion rules.EditorRemoteAgentHostServiceClientand unwrap the shared protocol client's session-list directory wrappers.Permission checks and sandbox policy are unchanged. Existing persisted sessions with incorrect host-side directory URIs are not migrated; use a new session when verifying.