Repository navigation
fix(transport): launch npm shims directly so quoted arguments work - #313
Merged
Merged
Conversation
On Windows a .cmd shim was launched through cmd.exe, and the argument escaper rejects any double quote because cmd.exe cannot carry one safely. Codex and OpenCode are npm shims, so an initial prompt or a Helm brief containing a double quote failed to spawn. The resolver now reads an npm cmd-shim and launches what it points at: node plus the script for a Node bin (using a node.exe beside the shim when there is one, as the shim itself does), or the target itself when it is an .exe. The arguments then reach the program as argv, with no shell in between. Anything the resolver does not recognise with certainty - an unreadable file, another wrapper's format, more than one candidate line, a missing target, a .bat, node not on PATH - keeps the existing cmd.exe path unchanged, including the quote rejection, whose message now says what to do. Checked against the shims installed on this machine: codex and opencode resolve to node.exe plus their script; claude.exe was already direct; npm.cmd, a different wrapper, stays on the shell path. Tests: resolver cases through injected file seams (Node shim with and without a sibling node.exe, native target, unrecognised wrapper, missing target, .bat, node missing), and a local transport case proving a prompt with a double quote and an ampersand reaches the PTY as one unmodified argument without cmd.exe. Co-Authored-By: OpenAI Codex <noreply@openai.com>
|
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.



Summary
Review item 5.2 (
docs/REVIEW_2026-11-09.md).On Windows a
.cmdshim was launched throughcmd.exe, and the argument escaper rejects any double quote becausecmd.execannot carry one safely. Codex and OpenCode are npm shims, so an initial prompt or a Helm brief containing"failed to spawn.win-binary-resolver.tsreads an npm cmd-shim and returns a direct plan:nodeplus the script for a Node bin (anode.exebeside the shim wins, as in the shim itself), or the target when it is an.exe. Arguments then reach the program as argv with no shell in between.cmd.exepath: an unreadable file, another wrapper's format, more than one candidate line, a missing target, a.bat, ornodenot on PATH. The resolver never throws.local-transport.tsandcoder-transport.tsplace the plan's leading arguments before the user's.Checked against the shims installed on this machine:
codexandopencoderesolve tonode.exeplus their script;claude.exewas already direct;npm.cmd, a different wrapper, stays on the shell path.Test plan
npx tsc --noEmitnpx eslint src/main/transport src/shared/shell-quote.tsnpx vitest run src/main/transport src/shared— 200 passed, 5 skipped&— it launches and the prompt arrives intactOut of scope
🤖 Generated with Claude Code