Skip to content

GitHub Copilot Agent Fails to Edit Files on Remote Windows SSH Host due to "Outside Workspace" Error #265804

Closed

Description

Summary

When connected from a Windows 11 client to a Windows 10 remote host via the VS Code Remote - SSH extension, the GitHub Copilot Chat agent (@workspace) and edit functionalities consistently fail to modify files.

The agent understands the request and attempts to apply changes, but it fails with errors indicating the file cannot be found or is "outside of the workspace," even though the file is clearly within the currently opened project folder and is often the active file in the editor. This issue was not present in the past but has started recently and persists despite extensive troubleshooting.

Environment

  • Client OS: Windows 11
  • Remote Host OS: Windows 10
  • VS Code Version: 1.103.2
  • Connection Method: VS Code's official Remote - SSH extension.
  • Key Extensions:
    • GitHub Copilot
    • GitHub Copilot Chat
    • Remote - SSH

(Note: The issue persists across both the latest versions and several downgraded versions of these extensions.)

Steps to Reproduce

  1. On the Windows 11 client, use VS Code to connect to the Windows 10 remote host via SSH.
  2. Open a project folder on the remote host (e.g., d:\code\my_project).
  3. Open any file within that project (e.g., d:\code\my_project\src\test.md).
  4. In the Copilot Chat panel, use the agent to request a simple edit. For example: @workspace /edit Please add a test comment to the file test.md.

Expected Behavior

Copilot should successfully apply the requested changes to the file test.md on the remote host.

Actual Behavior

The operation fails. The initial error message often suggests the file path could not be found for editing:

"It appears the file path d:\code\my_project\src\test.md could not be found for editing."

Analysis of the Copilot logs reveals a more specific, two-stage failure process:

  1. Copilot first attempts to use the apply_patch tool, which fails with the error:

    Applying patch failed with error: File not found: d:\code\my_project\src\test.md

  2. Copilot then attempts to recover by using the create_file tool, which fails with the critical error:

    ERROR while calling tool: File d:\code\my_project\src\test.md is outside of the workspace, and not open in an editor, and can't be read

This "outside of the workspace" error is the core of the problem, as the logs simultaneously confirm that the VS Code workspace is correctly identified as d:\code\my_project. The agent incorrectly determines that a file inside its own workspace is external, and therefore refuses to act on it.

Troubleshooting Steps Already Taken

The following solutions have been attempted without success, confirming this is likely a persistent bug in the toolchain:

  • Session & Cache:

    • Starting new chat sessions.
    • Executing the Clear All Workspace Chats command.
    • Manually clearing the VS Code cache.
    • Restarting VS Code and the remote connection.
  • Extensions & Environment:

    • Completely uninstalling and reinstalling the GitHub Copilot, GitHub Copilot Chat, and Remote - SSH extensions.
    • Cloning the project into a new, clean directory on the remote host.
    • Updating all related extensions to their latest versions.
    • Systematically downgrading the extensions to several older versions. The problem persists, suggesting it is not a simple regression in a single recent update.

This issue significantly impacts the usability of Copilot for remote development in a Windows-to-Windows environment. Any insights or fixes would be greatly appreciated.

Activity

  1. added
    chat-ext-issue
    on Sep 9, 2025
  2. removed
    chat-ext-issue
    on Sep 9, 2025
  3. Guderian114514 commented on Sep 10, 2025

    @Guderian114514
    Author

    2025-09-10 18:28:13.504 [error] Error from tool insert_edit_into_file with args {"code":"# 示例标题\n\n这是一个随便写入的内容。\n\n- 项目1\n- 项目2\n","explanation":"在1.md中添加一段简单的示例内容。","filePath":"d:\Data\gyh\literature_tracker\test\1.md"}: File d:\Data\gyh\literature_tracker\test\1.md is outside of the workspace, and not open in an editor, and can't be read: Error: File d:\Data\gyh\literature_tracker\test\1.md is outside of the workspace, and not open in an editor, and can't be read

  4. herbsal commented on Sep 10, 2025

    @herbsal

    I am facing the same issu with a little different setup as follows:

    • guest OS Windows 11
    • Linux Host access via vscode remote ssh extension
    • copilot uses the Internet connection of the ui
    • both edit and agent mode don't work
    • I was testing using the automatically reference, opened file and explicitly referencing filled from the workspace using the hash character
    • ask mode works fine
    • using inline chat/editing of selections works fine
    • edit mode works fine when using a workspace on the guest machine

    I'd like to add that a few weeks back, everything was working smoothly as intended. What changed is a switch to a new guest machine with Windows 11 instead of 10 and probably a few vscode/extension updates. I haven't tested again using the old notebook but will try to do so soon.

  5. herbsal commented on Sep 11, 2025

    @herbsal

    I just updated to vscode 1.104 which was released today. On my end, that resolved the issue. Edit mode is working again as it should also in the remote ssh workspace.

  6. Guderian114514 commented on Sep 12, 2025

    @Guderian114514
    Author

    I just updated to vscode 1.104 which was released today. On my end, that resolved the issue. Edit mode is working again as it should also in the remote ssh workspace.

    Hey herbsal, thanks a lot for your reply and for looking into this! This issue had been bugging me for quite a while, so I really appreciate your help and attention. Glad to hear we both got it sorted out in the end!

  7. Scatterblak commented on Sep 12, 2025

    @Scatterblak

    Still fighting this. The way that vs code throws workspace files all over the system and then can't reconcile resources and specifications is a bit of a tragedy, unfortunately.

  8. Jinshijiming commented on Sep 14, 2025

    @Jinshijiming

    I just updated to vscode 1.104 which was released today. On my end, that resolved the issue. Edit mode is working again as it should also in the remote ssh workspace.

    Edit mode is working,but Agent mode not work

  9. Guderian114514 commented on Sep 15, 2025

    @Guderian114514
    Author

    I just updated to vscode 1.104 which was released today. On my end, that resolved the issue. Edit mode is working again as it should also in the remote ssh workspace.

    Edit mode is working,but Agent mode not work

    Indeed, I suspect there are still unfixed bugs

  10. igamenovoer commented on Sep 23, 2025

    @igamenovoer

    still not work, agent thinks it has created a file, but the file is not created on remote. If I try to open it by clicking in the chat dialog, it will fail to open. Editing in agent mode does not work either, some issue, it thinks it has editted the file but nothing is actually written. In edit mode, it works, but not agent mode, vscode is 1.104.1 latest version (just auto update)

    Image
  11. igamenovoer commented on Sep 23, 2025

    @igamenovoer

    still not work, agent thinks it has created a file, but the file is not created on remote. If I try to open it by clicking in the chat dialog, it will fail to open. Editing in agent mode does not work either, some issue, it thinks it has editted the file but nothing is actually written. In edit mode, it works, but not agent mode, vscode is 1.104.1 latest version (just auto update)

    Image

    I get it, it is because the github copilot is running as ui extension, which runs on local extension host, forcing it to run on remote host can solve the problem:

    open the user setting json and then set these

    "remote.extensionKind": {
      "github.copilot": ["workspace"],
      "github.copilot-chat": ["workspace"]
    }

    after that, restart the ssh session again then it will work

  12. Guderian114514 commented on Sep 26, 2025

    @Guderian114514
    Author

    still not work, agent thinks it has created a file, but the file is not created on remote. If I try to open it by clicking in the chat dialog, it will fail to open. Editing in agent mode does not work either, some issue, it thinks it has editted the file but nothing is actually written. In edit mode, it works, but not agent mode, vscode is 1.104.1 latest version (just auto update)
    Image

    I get it, it is because the github copilot is running as ui extension, which runs on local extension host, forcing it to run on remote host can solve the problem:

    open the user setting json and then set these

    "remote.extensionKind": {
    "github.copilot": ["workspace"],
    "github.copilot-chat": ["workspace"]
    }
    after that, restart the ssh session again then it will work

    your tip about forcing Copilot extensions to run on the remote host solved the agent issue for me. I hadn’t looked deeper since edit mode was “good enough,” but your workaround fixed the real problem. Really appreciate you sharing it.

  13. herbsal commented on Oct 1, 2025

    @herbsal

    Gao Yinghao (@Guderian114514) I'd like to ask you to re-open the issue, since having to run copilot to run on the remote host is not a fix but rather a workaround that may help in certain scenarios.

    If however the remote host does not have Internet access, this workaround cannot be applied. And I can also confirm that agent mode does not work.

  14. Guderian114514 commented on Oct 2, 2025

    @Guderian114514
    Author

    @Guderian114514 I'd like to ask you to re-open the issue, since having to run copilot to run on the remote host is not a fix but rather a workaround that may help in certain scenarios.

    If however the remote host does not have Internet access, this workaround cannot be applied. And I can also confirm that agent mode does not work.

    Thanks, you make a great point. I've re-opened the issue.

  15. chrmarti commented on Oct 2, 2025

    @chrmarti
    Collaborator

    The Copilot extensions need to run on the remote extension host. They do this by default, the errors are usually caused by having "remote.extensionKind" in the user settings forcing the Copilot extensions to run locally where they do not have access to the workspace files. This is expected behavior. If you need them to work with a remote that does not have network access, could you open a feature request for use? Thanks.

  16. herbsal commented on Oct 3, 2025

    @herbsal

    Christof Marti (@chrmarti) it does perfectly work using remote ssh when using ask or edit mode and it does have access to the workspace in these cases. Even if the remote host does not have Internet access. Since only agent mode does not work and edit mode intermittently did not work for a few versions, that's why we suspected a bug.

    Are you saying that edit mode is not even expected to work but we're just lucky that it actually does?

  17. locked and limited conversation to collaborators on Nov 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions