Remote-SSH: Agent Session changed-file diff opens working-tree side as local Windows path, not vscode-remote:// URI
- Dominant language
- TypeScript
- Stars
- 193k
- Forks
- 42.4k
- PR merge metrics
- PR metrics pending
Description
## Summary
When opening a diff for a file from the **Chat/Agent Sessions "changed files" list** while connected via **Remote-SSH**, VS Code fails to open the working-tree side of the diff with:
```
The editor could not be opened because the file was not found.
Unable to read file '\home\\\'
(Error: Unable to resolve nonexistent file '\home\\\')
```
Note the **backslashes** and the **missing `vscode-remote://ssh-remote+/` authority** — the client is treating a remote POSIX absolute path as if it were a local Windows path, instead of constructing a proper `vscode-remote://` URI. The file exists and is perfectly readable on the remote host; opening it directly via Explorer/`Ctrl+P` works fine. Only the diff/editor opened from the agent session's changed-files entry fails.
This looks like the same class of bug as the older, now-closed #166937 ("Remote SSH: unable to resolve nonexistent file" — Source Control "WorkingTree" diff), but reproduced against the newer native **Agent Sessions / Chat** changed-files diff instead of classic Source Control, and on a current build, so I'm filing fresh rather than reopening.
## Environment
- VS Code version: `1.135.0` (commit `08d4889f9ec4a1685d257b9b95de036c8e1ce1e5`, quality `stable`)
- Client OS: Windows 11
- Remote: Remote-SSH (`remoteAuthority=ssh-remote+`) to a Linux host
- Remote OS: `Linux 7.0.0-30-generic #30-Ubuntu SMP ... x86_64 GNU/Linux`, Ubuntu 26.04.1 LTS
- Chat backend: native Agent Sessions / AgentHost (Copilot CLI agent), session URI `copilotcli:/`
## Steps to reproduce
1. Connect to a Linux remote via Remote-SSH.
2. Open a folder that is a git repository and start a chat/agent session (Agent Sessions / Copilot Chat agent mode) that edits a tracked file.
3. In the session's "changed files" list, click the modified file to open its diff.
4. The "before" side (`git-blob:` virtual resource, e.g. `git-blob:/home///?{"sessionUri":...,"sha":...,"repoRelativePath":...}`) opens fine.
5. The "after"/working-tree side fails to open with the error above.
## Actual behavior
- Editor shows: "The editor could not be opened because the file was not found."
- Dev Tools / log shows a `file:///home//...` (or equivalent local-looking) path being resolved against the **Windows client filesystem** rather than through the Remote-SSH `vscode-remote://` file system provider, producing backslash-mangled, drive-relative-looking paths like:
```
\home\\\
```
- A related but separate symptom in the same session: opening the same diff also logs
```
[ProtocolServer] Request 'createResourceWatch' failed Resource not found: git-blob:/home///?{"sessionUri":"copilotcli:/","sha":"","repoRelativePath":""}
```
i.e. the immutable git-blob virtual FS provider doesn't support file watching and throws instead of no-op'ing — a secondary, lower-severity bug likely worth fixing alongside this one.
## Expected behavior
Opening the working-tree side of an agent-session changed-file diff over Remote-SSH should resolve through the remote file system provider (i.e. build a `vscode-remote://ssh-remote+/home//...` URI), matching how Explorer/Quick Open/regular Source Control diffs already behave correctly in the same window.
## Additional notes
- Regular file opens (Explorer, `Ctrl+P`, editing) work correctly in the same session — only the diff opened from the agent session's changed-files entry is affected.
- The underlying file/content is not lost: `git show :` against the repo's checkpoint commit (agent sessions write real checkpoint commits under `refs/agents//checkpoints/...`) confirms the referenced blob and working tree file both exist and are intact.
- Related/older issue (different feature, same root symptom family, closed in 2023 on an older build): #166937
Log excerpt (paths/user/session redacted)
```
[error] Error: The editor could not be opened because the file was not found.
at nZ.handleSetInputError (...)
at async nZ.setInput (...)
at async nHe.doSetInput (...)
at async nHe.doOpenEditor (...)
[error] Unable to read file '\home\\\tests\test_seven_calling.py'
(Error: Unable to resolve nonexistent file '\home\\\tests\test_seven_calling.py')
[warning] [RemoteAgentHostProtocol] Request N failed: {"code":-32008,"message":"Resource not found: git-blob:/home///tests/test_seven_calling.py?{\"sessionUri\":\"copilotcli:/\",\"sha\":\"\",\"repoRelativePath\":\"tests/test_seven_calling.py\"}"}
```
Contributor guide
Research direction
Start by reproducing the Agent Sessions changed-files diff over Remote-SSH and trace the working-tree URI from the changed-files entry into the editor open path. Compare it with Explorer, Quick Open, and regular Source Control diff URI handling; done means the working-tree side opens through the vscode-remote:// provider without Windows path mangling, with the git-blob watch error handled separately if included.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, typescript, vscode
- Domain
- desktop, developer-experience, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100