Repository navigation
Description
Generate by Copilot Chat
Environment
| Value | |
|---|---|
| OS | Windows 11 + WSL2 (Ubuntu) |
| VS Code | 1.117.0 |
| GitHub Copilot Chat | 0.45.x |
| Remote | WSL remote (vscode-server) |
| Affected plugin | mem0ai/mem0 mem0-plugin (installed on Windows side) |
Description
When using GitHub Copilot Chat via WSL remote, agent plugin hooks fail with a "not found" error. The root cause is that Copilot Chat's hook runner injects CLAUDE_PLUGIN_ROOT using the Windows local installation path (e.g. c:\Users\<username>\.vscode\agent-plugins\...\mem0-plugin), then passes that path directly to WSL's /bin/sh without any path normalization (e.g. converting to /mnt/c/... or a WSL-side equivalent).
Because /bin/sh in Linux treats backslashes as escape characters, the path c:\Users\<username>\.vscode\... gets its backslashes consumed, resulting in a mangled string like c:Users<username>.vscode... that is treated as a command name — and immediately fails with not found.
The plugin itself is not at fault: its hooks.json correctly uses ${CLAUDE_PLUGIN_ROOT}/scripts/on_user_prompt.sh (a relative expansion). The bug is entirely in the hook runner's path injection.
Steps to Reproduce
- Install any agent plugin (e.g.
mem0ai/mem0) on the Windows host (i.e. plugin dir isc:\Users\<username>\.vscode\agent-plugins\...). - Open VS Code and connect to a WSL remote via the WSL extension.
- Open an Agent Chat session (any workspace).
- Submit any user prompt.
- Observe the "UserPromptSubmit" hook failure in the Copilot Chat Hooks log.
Expected Behavior
The hook runner should detect that the current execution environment is WSL, and either:
- Convert the Windows plugin path to its WSL-accessible equivalent (
/mnt/c/Users/<username>/...), or - Use a WSL-side plugin installation path if available, or
- Skip hook execution gracefully when the plugin path is not accessible in the current shell environment.
Actual Behavior
Hooks fail immediately with:
/bin/sh: 1: c:Users<username>.vscodeagent-pluginsgithub.commem0aimem0mem0-plugin/scripts/on_user_prompt.sh: not found
From the Copilot Chat Hooks log (GitHub Copilot Chat Hooks.log), the hook runner is executing:
{
"command": "c:\\Users\\<username>\\.vscode\\agent-plugins\\github.com\\mem0ai\\mem0\\mem0-plugin/scripts/on_user_prompt.sh",
"cwd": {
"fsPath": "/home/<username>/projects/my-workspace",
"scheme": "file"
},
"env": {
"CLAUDE_PLUGIN_ROOT": "c:\\Users\\<username>\\.vscode\\agent-plugins\\github.com\\mem0ai\\mem0\\mem0-plugin"
},
"timeout": 5
}Note that cwd.fsPath is correctly a Linux path (/home/<username>/...), confirming the hook is running inside WSL. But command and CLAUDE_PLUGIN_ROOT are still Windows paths.
Root Cause Analysis
There appear to be two distinct problems combined:
Problem 1 — Wrong path origin:
The hook runner uses the plugin's Windows local installation path for CLAUDE_PLUGIN_ROOT and command, even though the execution context (shell, cwd) is already WSL. The runner does not detect the WSL remote environment and select the appropriate plugin path.
Problem 2 — No path normalization before shell execution:
The Windows path (c:\Users\...) is passed as-is to /bin/sh without:
- Converting drive notation (
C:\) →/mnt/c/ - Escaping or quoting backslashes
Linux /bin/sh treats \ as an escape character in an unquoted context, silently consuming all backslashes. The resulting "command" becomes an unrecognizable string, which fails as not found.
Plugin hooks.json for Reference
The plugin itself uses only ${CLAUDE_PLUGIN_ROOT}-relative paths and is not responsible for the bad path:
{
"hooks": {
"UserPromptSubmit": [
{
"hooks": [
{
"type": "command",
"command": "${CLAUDE_PLUGIN_ROOT}/scripts/on_user_prompt.sh",
"timeout": 5
}
]
}
]
}
}Affected Hooks
All hooks in the plugin are affected (since all use ${CLAUDE_PLUGIN_ROOT}):
SessionStart→on_session_start.shUserPromptSubmit→on_user_prompt.shStop→on_stop.shPreToolUse→block_memory_write.shPreCompact→on_pre_compact.sh,on_pre_compact.pyTaskCompleted→on_task_completed.sh
Suggested Fix
In the hook runner, before spawning the shell process:
- Detect WSL remote: check whether the current execution context is WSL (e.g. via
process.env.WSL_DISTRO_NAME, or by inspecting theremoteauthority of the active workspace). - Normalize the plugin path: if running in WSL and
CLAUDE_PLUGIN_ROOTis a Windows path (matches^[A-Za-z]:\\), convert it to its/mnt/<drive>/...equivalent before injecting it into the environment and command string. - Fallback: if the normalized path still does not exist in WSL, emit a warning rather than attempting to execute an invalid command.
Additional Notes
- The bug is 100% reproducible every time a prompt is submitted in a WSL remote session with any Windows-installed agent plugin.
- The failure is logged as
NonBlockingError, so the chat session continues — but all hooks are silently skipped, meaning features that depend on hooks (e.g. mem0 memory retrieval on each prompt) never execute. - The
cwdis correctly resolved to the WSL path, suggesting path normalization is already applied for the working directory but not forCLAUDE_PLUGIN_ROOT/command.
Activity
vs-code-engineering commentedon Apr 30, 2026
Thanks for creating this issue! We figured it's covering the same as another one we already have. Thus, we closed this one as a duplicate. You can search for similar existing issues. See also our issue reporting guidelines.
Happy Coding!
kilianpaquier commentedon Jun 2, 2026
Hello Connor Peet (@connor4312) Paul (@pwang347), could you indicate from which issue this one is duplicated ? On vscode 1.122.1 the issue still exists and it's quite annoying since all plugins using this substitution cannot be used with WSL or remote base developments.
Already tried the potential workaround
"GitHub.copilot-chat": "workspace"inremote.extensionKind.