zai-org / zai-org/feedback

[Bug] Windows: plugin hook shell:"bash" resolves to WSL's System32 bash.exe, booting a WSL VM on every new conversation

Open
#335 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

priority: P2 status: 待评估 type: Bug
Dominant language
No language data
Stars
22
Forks
1
PR merge metrics
No merged PRs in 30d

Description

提交前确认 · Pre-submission checklist
  • 我已搜索过现有 issue,确认这不是重复 / I searched existing issues and confirmed this isn't a duplicate.
  • 我已阅读 CONTRIBUTING.md / I've read CONTRIBUTING.md.
问题类别 · Category

工具调用 / MCP · Tool use / MCP

涉及的 Agent 框架 · Agent framework

ZCode Agent(自研)

严重程度 · Severity

影响体验 · Major (功能可用但体验受损 / works but degraded)

复现频率 · Reproducibility

必现 · Always

问题描述 · Description

一句话摘要 / TL;DR (中文): Windows 下插件 hook 的 shell:"bash" 被解析到 WSL 的 C:\Windows\System32\bash.exe(而不是 Git Bash),导致每次新会话的第一条消息都会静默启动一个完整的 WSL 虚拟机。

Pre-submission checklist
Searched existing issues and discussions — no duplicate (closest is #277, integrated-terminal default shell, different scope)
Read CONTRIBUTING.md
Environment
OS: Windows 11 Pro 10.0.26200, Git for Windows at C:\Program Files\Git (on User PATH), WSL Ubuntu installed
ZCode desktop 3.8.1.5310, agent protocol 0.16.3
Plugin: superpowers@6.3.0 (claude-plugins-official marketplace)
Model channel: Z.ai GLM coding plan

Note: superpowers ships run-hook.cmd, which prefers Git Bash internally — but that logic is bypassed because the host picks the shell first. Also, there is no env var or setting to remap the hook shell (searched the bundle for any GIT_BASH override — none exists).

Suggested fix
On Windows, when a hook (or any child process spawn) requests bash, route it through the existing Git Bash resolver, falling back to System32\bash.exe only when Git Bash is absent. Optionally expose an explicit override (e.g. ZCODE_GIT_BASH_PATH) for edge setups.

Logs
Attaching zcode-wsl-bug-log-sanitized.txt — a field-whitelisted excerpt of %USERPROFILE%.zcode\cli\log\zcode-2026-08-21.jsonl. For three separate conversations it shows hook.run.failed from plugin.superpowers@claude-plugins-official.SessionStart.1.0 (durationMs 4326–6153 — that multi-second cost is the WSL VM cold boot) landing on the same millisecond as that conversation's first turn.started (turnNumber:0). The hook doesn't just boot WSL — it then fails, so the plugin's session-start never actually runs. The raw log contains no WSL references; the vmmem/wslrelay processes at those instants were observed in Task Manager and demonstrated live via bash -c under the app's PATH order.

11

复现步骤 · Steps to reproduce

Steps to reproduce
On Windows 11, have Git for Windows installed (User PATH) and any WSL distro installed. C:\Windows\System32 (Machine PATH) therefore wins PATH resolution for bash — C:\Windows\System32\bash.exe is the WSL launcher, ahead of C:\Program Files\Git\bin\bash.exe.
Enable the superpowers plugin. Its hooks/hooks.json declares a SessionStart hook:

json
{ "type": "command",
"command": ""${CLAUDE_PLUGIN_ROOT}/hooks/run-hook.cmd" session-start",
"shell": "bash", "async": false }
Start a new conversation and send the first message.

期望表现 · Expected behavior

Expected
On Windows, a hook declaring shell: "bash" should run under Git Bash, not the WSL launcher. ZCode already ships a Git Bash resolver in the bundle — resolveWindowsGitBash / inferWindowsGitBashPathsFromGitExe (resolves git.exe on PATH → ..\bin\bash.exe / ....\bin\bash.exe) — but it is currently only used for the integrated-terminal shell options, not for hook shell resolution.

实际表现 · Actual behavior

Actual
The hook runner resolves bash through raw PATH order, so C:\Windows\System32\bash.exe (WSL) wins and the first message of every new conversation boots a full WSL VM (vmmem + wslrelay; with debugConsole=true in .wslconfig a console window pops up too). Verified live: running bash -c under the app's PATH order launches Ubuntu.

ZCode 版本 · ZCode version

ZCode desktop 3.8.1.5310, agent protocol 0.16.3

设备 / 系统 / 浏览器 · Device / OS / Browser

OS: Windows 11 Pro 10.0.26200, Git for Windows at C:\Program Files\Git (on User PATH), WSL Ubuntu installed

截图 / 录屏 / 日志 · Screenshots / Recordings / Logs

zcode-wsl-bug-log-sanitized.txt

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the existing resolveWindowsGitBash and inferWindowsGitBashPathsFromGitExe entry points, then trace how hook shell resolution handles shell: "bash" on Windows. Reproduce with Git for Windows and WSL installed, and verify that the hook uses Git Bash, avoids launching WSL, and still falls back when Git Bash is absent.

Written by the indexing model from the issue text.

Assessment

Tech stack
bash, git
Domain
desktop, devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.