Repository navigation
chat: open session file artifacts through the remote agent host - #343483
Merged
Merged
Conversation
In a window attached to a remote, the window's own agent host runs on the remote but its sessions resolve with the reserved `local` authority. Artifact pills wrapped file artifacts with that authority, which leaves `file:` URIs unwrapped, so remote files such as generated videos were opened from the client's disk and failed to load. Derive the authority from the connection's resource URI mapping instead. Fixes #343050 Co-authored-by: Copilot <[email protected]>
Federico Brancasi (federicobrancasi)
previously approved these changes
Oct 22, 2026
Contributor
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
3 open issues
What changed in this PR
Fixes opening session file artifacts from the Artifacts pill in Remote-SSH windows by ensuring the opened URI is wrapped using the session connection’s resource URI mapper (rather than the session’s reserved local authority), so files are read via the remote agent host instead of the client filesystem.
Changes:
- Derive the correct authority for file-artifact URIs from the connection’s
resourceUrismapping and use it when wrappingfile:artifacts viatoAgentHostUri. - Add coverage ensuring file artifacts open through the owning connection across local, remote window (ambient remote), and named remote host scenarios.
| File | Description |
|---|---|
| src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionInputPills.ts | Uses connection-derived resource authority when wrapping file artifacts so remote artifacts open through the agent host. |
| src/vs/workbench/contrib/chat/test/browser/agentHost/agentHostSessionInputPills.test.ts | Adds a regression test verifying artifact opening behavior across local/remote authority scenarios. |
Review effort: Lite
Benjamin Christopher Simmonds (benibenj)
previously approved these changes
Oct 22, 2026
Clicking a single artifact pill opens its resource synchronously, so the test no longer waits for a macrotask before asserting. Co-authored-by: Copilot <[email protected]>
Logan Ramos (lramos15)
dismissed stale reviews from Benjamin Christopher Simmonds (benibenj) and Federico Brancasi (federicobrancasi)
via
October 22, 2026 12:44
14fe4f0
Dirk Bäumer (dbaeumer)
approved these changes
Oct 22, 2026
Benjamin Christopher Simmonds (benibenj)
approved these changes
Oct 22, 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.

Fixes #343050
Opening a session's file artifact from the Artifacts pill in a Remote-SSH Editor Window opened the remote path as a local file, so the video preview showed "An error occurred while loading the video file". The renderer logged:
Cause
In a window attached to a remote, the window's own agent host runs on the remote, but its sessions resolve with the reserved
localauthority. The artifact pill passed that authority totoAgentHostUri, which deliberately leavesfile:URIs unwrapped forlocal. The pill therefore openedfile:///home/...from the client's disk instead of reading the file through the agent host. The same session works in the Agents window because it connects to the remote through a named connection, so its artifact URIs are wrapped.Fix
File artifacts are now wrapped with the authority the session's connection uses for its own resource URIs (
connection.resourceUris). Local windows and remote agent host connections produce the same URIs as before.How to test
.mp4) and add it as an artifact.Validation
./scripts/test.sh --run src/vs/workbench/contrib/chat/test/browser/agentHost/agentHostSessionInputPills.test.ts: passed (92 tests). The new test covers a local window, a Remote-SSH window, and a remote agent host connection. Without the fix, the Remote-SSH case opensfile:///home/user/videos/walkthrough.mp4.npm run typecheck-client: passed.npm run eslint -- <changed files>: passed.Not in this PR
Two more places use the session's
localauthority in Remote-SSH windows and are left for a follow-up:AgentHostContributioncreates the customization item provider with a hard-coded'local'.