Skip to content

Support copilot agent hooks when installed to local extension space #300044

@jpmorris

Description

@jpmorris
  • Copilot Chat Extension Version: 0.37.9

  • VS Code Version: 1.109.3

  • OS Version: Windows 11 (local) → SSH Remote to Amazon SageMaker (Linux)

  • Feature: Agent hooks (settings.json hooks)

  • Selected model: Claude Opus 4

  • Logs:

2026-03-08 05:39:48.316 [info] [#44] [UserPromptSubmit] Running: {"command":"echo hook-userprompt-fired","cwd":{"$mid":1,"fsPath":"\\home\\sagemaker-user","_sep":1,"external":"vscode-remote://ssh-remote%2Bsagemaker-local/home/sagemaker-user","path":"/home/sagemaker-user","scheme":"vscode-remote","authority":"ssh-remote+sagemaker-local"}}2026-03-08 05:39:48.316 [info] [HookExecutor] Hook command failed to start: echo hook-userprompt-fired: spawn C:\WINDOWS\system32\cmd.exe ENOENT

Steps to Reproduce:

I cannot run copilot extension installed to the ssh space because the sagemaker machine I connect to has no internet access, so I need to set it up for local windows extension space.

  1. make sure copilot installs to local extensions
    "remote.extensionKind": {
    "github.copilot": ["ui"],
    "github.copilot-chat": ["ui"]
  }
  1. Connect VS Code on Windows to a remote Linux host via SSH (Remote - SSH extension)
  2. Install the Copilot Chat extension on the local/UI side (not the remote server side) — this is required when the remote host is airgapped with no internet
  3. Create ~/.claude/settings.json on the remote host with any hook, e.g.:
{  "hooks": {    "UserPromptSubmit": [      { "type": "command", "command": "echo hello" }    ]  }}
  1. Send any message in Copilot Chat

Expected: The hook command executes successfully (either on the remote host or locally with a valid cwd)

Actual: Hook fails with spawn C:\WINDOWS\system32\cmd.exe ENOENT. The HookExecutor reads the config from the remote workspace but executes the command locally on Windows using child_process.spawn with shell: true. It passes the remote workspace path (\home\sagemaker-user) as the cwd, which does not exist on the local Windows filesystem. Node.js throws ENOENT when validating the cwd before spawning.

Root cause: The cwd from the remote workspace URI's fsPath (\home\sagemaker-user) is used directly as a local filesystem path. On Windows this resolves to a non-existent UNC-style path, causing the spawn to fail before cmd.exe even launches.

Metadata

Metadata

Assignees

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