fix(acp): resolve Windows ENOENT when spawning ACP agent process#400
Merged
zts212653 merged 4 commits intozts212653:mainfrom Apr 10, 2026
Merged
fix(acp): resolve Windows ENOENT when spawning ACP agent process#400zts212653 merged 4 commits intozts212653:mainfrom
zts212653 merged 4 commits intozts212653:mainfrom
Conversation
AcpClient.initialize() used bare child_process.spawn() which cannot find npm-global .cmd shims on Windows. Reuse the same 3-tier fallback from cli-spawn.ts: resolve .cmd → underlying .js script, then Git Bash shell, then cmd.exe shell. Skipped when custom spawnFn is injected (test path unchanged). Fixes: spawn gemini ENOENT on Windows [宪宪/Opus-46🐾] Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Owner
|
Thanks for the fix. I checked the ACP path against our current Windows spawn helpers, and the bug itself looks real: The fix direction here also looks right. Reusing the same 3-step Windows fallback ( That said, I don’t think we should merge this PR as-is yet:
What I’d suggest before merge:
Once those are in, this looks like a good candidate to land. — 缅因猫-gpt5.4 |
…2653#401) Covers the default spawn path (no custom spawnFn) in AcpClient.initialize() on Windows: verifies .cmd shim resolution rewrites spawn to node + script.js. Co-Authored-By: 砚砚/Codex [砚砚/Codex🐾] <noreply@anthropic.com> Co-Authored-By: 宪宪/Opus-46 [宪宪/Opus-46🐾] <noreply@anthropic.com>
zts212653
approved these changes
Apr 10, 2026
Owner
zts212653
left a comment
There was a problem hiding this comment.
Bug 确认真实:AcpClient 在 Windows 下确实漏了 .cmd shim fallback。这轮已经补了回归测试,并且我补推了 lint fixup;等当前 CI 全绿后就可以合。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
AcpClient.initialize() used bare child_process.spawn() which cannot find npm-global .cmd shims on Windows. Reuse the same 3-tier fallback from cli-spawn.ts: resolve .cmd → underlying .js script, then Git Bash shell, then cmd.exe shell. Skipped when custom spawnFn is injected (test path unchanged).
PR Type
Related Issue
Closes #401
What
AcpClient.tsto add Windows .cmd shim resolution using the existing 3-tier fallback fromcli-spawn-win.tsacp-client-windows-spawn.test.jscovering the default spawn path on WindowsWhy
On Windows, npm-global CLI tools like
geminiare installed as.cmdshim scripts.child_process.spawn()withoutshell: truecannot locate.cmdfiles, causingENOENT. The non-ACP path (cli-spawn.ts) already handled this; AcpClient did not.Tradeoff
Could have used
shell: trueuniversally, but that introduces shell injection risk and is inconsistent with the existing strategy incli-spawn-win.ts.Test Evidence