Repository navigation
agentHost: open Working Set files of remote windows as remote files - #346553
Merged
Ladislau Szomoru (lszomoru) merged 2 commits intoNov 6, 2026
Merged
Ladislau Szomoru (lszomoru) merged 2 commits into
Ladislau Szomoru (lszomoru) merged 2 commits into
Conversation
In a window attached to a remote (WSL, SSH, containers), the ambient agent host resolves with the `local` authority. The Working Set, its Keep/Undo matching, and the editor review converted changeset files with `toAgentHostUri(file, authority)`, which leaves `local` file URIs unwrapped. Clicking a changed file then opened the remote path on the client's disk, which a Windows client shows with backslashes and reports as not found. #345031 fixed this through the connection's mapper authority, but #345306 changed the editor-remote mapper to return `vscode-remote` URIs, so the authority fell back to `local` again. Map the file through the owning connection's `resourceUris.fromAgentHost` instead, so it opens as the workspace's file, while recorded contents stay Agent Host content URIs. The tests now use the real editor-remote mapper. Fixes #345420 Co-authored-by: Copilot <[email protected]>
Ladislau Szomoru (lszomoru)
requested review from
Connor Peet (connor4312) and
Justin Chen (justschen)
November 6, 2026 14:53
Ladislau Szomoru (lszomoru)
marked this pull request as ready for review
November 6, 2026 14:54
Ladislau Szomoru (lszomoru)
enabled auto-merge (squash)
November 6, 2026 14:54
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are recorded for the connection-aware Working Set URI mapping changes.
No open issues 🎉
What changed in this PR
Fixes #345420 by mapping Agent Host Working Set files through the owning connection’s URI mapper. In remote windows, files now open as workspace resources rather than paths on the client’s disk.
Changes:
- Uses the connection’s mapper for Working Set files, Keep/Undo matching, and editor review.
- Preserves host-backed recorded content and existing per-response changes behavior.
- Updates remote-window regression tests to use the real editor-remote mapper and adapts other tests to the new helper signature.
| File | Description |
|---|---|
src/vs/workbench/contrib/chat/test/browser/agentHost/agentHostSnapshotController.test.ts |
Passes the identity mapper to the updated helper. |
src/vs/workbench/contrib/chat/test/browser/agentHost/agentHostSessionInputPills.test.ts |
Verifies remote Working Set resources with the real mapper. |
src/vs/workbench/contrib/chat/test/browser/agentHost/agentHostResponseFileChanges.test.ts |
Adapts changeset conversion coverage to the mapper parameter. |
src/vs/workbench/contrib/chat/test/browser/agentHost/agentHostEditReview.test.ts |
Covers editor review with local, remote-host, and editor-remote mappers. |
src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionInputPills.ts |
Supplies the owning mapper for Working Set display and Keep/Undo matching. |
src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostResponseFileChanges.ts |
Maps file identities through the supplied mapper while preserving recorded-content routing. |
src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostEditReview.ts |
Uses the Working Set connection’s mapper for review file identities. |
Review effort: Balanced
This comment was marked as off-topic.
This comment was marked as off-topic.
Justin Chen (justschen)
previously approved these changes
Nov 6, 2026
Connor Peet (connor4312)
disabled auto-merge
November 6, 2026 18:41
…URIs Address review feedback: the changeset helper now takes the owning connection, so callers can no longer pass a mapper built from an authority. The per-response changes provider uses its connection's resourceUris for both changeset and response-part files, which removes its remaining TODO(agent-host-uri) bypasses. Recorded contents stay Agent Host content URIs. The provider tests now run across every Agent Host connection kind, including the strict exactly-once mapper. Co-authored-by: Copilot <[email protected]>
Connor Peet (connor4312)
approved these changes
Nov 6, 2026
Ladislau Szomoru (lszomoru)
deleted the
lszomoru/agents/vscode-issue-345420-investigation
branch
November 6, 2026 21:52
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.
Fixes #345420
In a window attached to a remote (WSL, SSH, containers), clicking a file in the Working Set above the chat input fails with "The editor could not be opened because the file was not found." On a Windows client, the path in the error has backslashes (
\home\…). View All Edits still works.Cause
In a remote window, the ambient agent host runs on the remote, but its sessions resolve with the
localauthority. The Working Set, its Keep/Undo matching, and the editor review converted changeset files withtoAgentHostUri(file, authority). Forlocal, that leavesfile:URIs unwrapped, so the client opened the remote path on its own disk. View All Edits reads the recorded contents through the host, so it was unaffected.#345031 fixed this by using the authority of the connection's resource URIs. #345306 then changed the editor-remote mapper to return
vscode-remoteURIs, sogetAgentHostResourceAuthorityfell back tolocalagain. The test added in #345031 still used the earlier mapper, so it did not catch the regression.Change
agentHostChangesetFileToEntryDifftakes the owning connection and maps the file with itsresourceUris.fromAgentHost, as the Agent Host URI-space guidance asks. In a remote window the file is now the workspace'svscode-remotefile. Recorded contents stay Agent Host content URIs and are read through the host as before.resourceUristoo, which removes itsTODO(agent-host-uri)bypasses. Its outside-workspace check still compares host files with host working directories.createEditorRemoteAgentHostResourceUriMapper, and the per-response provider tests run across every connection kind inagentHostConnectionKinds. All of them fail without the fix.Not in this PR
Checkpoint restore in
AgentHostSnapshotControllerstill builds file URIs from the authority (TODO(agent-host-uri)), so it has the same problem in a remote window.How to test
./scripts/code.sh, then Remote-TestResolver: New TestResolver Window, and open a git repository.chat.editor.preferCopilotHarnessandchat.editor.workingSet.enabledare on by default) and ask for an edit.file:resource. The breadcrumbs show the absolute path, File: Copy Relative Path of Active File copies an absolute path, and opening the file from the Explorer opens a second tab. A Windows client attached to WSL shows "file not found" instead.Validation
./scripts/test.sh --run src/vs/workbench/contrib/chat/test/browser/agentHost/agentHostSessionInputPills.test.ts --run src/vs/workbench/contrib/chat/test/browser/agentHost/agentHostEditReview.test.ts --run src/vs/workbench/contrib/chat/test/browser/agentHost/agentHostResponseFileChanges.test.ts --run src/vs/workbench/contrib/chat/test/browser/agentHost/agentHostSnapshotController.test.ts: passed (251 tests). Without the fix, the remote-window and connection-kind cases fail.pnpm run typecheck-client: passedpnpm run eslint <changed files>: passed