Repository navigation
fix(e2e): run the opencode host off the real binary, not the cmd-shim (Windows Bun 1.4 EINVAL) - #85
Merged
Conversation
On Windows, Bun.which("opencode") resolves the npm cmd-shim, and the
harness fed that path straight to node:child_process spawn. Bun 1.4.4
port of Node's CVE-2024-27980 guard then rejects the .cmd outright: the
e2e suite fails on main with spawn EINVAL under 1.4.4 (reproduced)
while 1.3.10 ran it. Running a .cmd through cmd.exe was never sound
for this harness anyway — every shim form probed splits a multi-word
prompt across argv, and cmd metacharacters in an argument mangle or
(Bun 1.4's own .cmd quoting guard) throw.
resolveOpencode now unwraps the standard npm cmd-shim to the exe it
calls, and turn() spawns through native Bun.spawn (same argv, Web
streams instead of event emitters) so an exotic shim degrades to the
previous best effort instead of crashing. Verified on Windows: e2e
9/9 on 1.3.10 and 1.4.4 with the fix; on main the same runs die on
spawn EINVAL under 1.4.4.
This was referenced Oct 24, 2026
Merged
|
🎉 This PR is included in version 0.8.11 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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.
The gap
e2e/support/harness.tsfed the PATH-resolved opencode binary straight intonode:child_processspawn. On Windows,Bun.which("opencode")resolves npm'sopencode.cmdshim, and Bun 1.4.4's port of Node's CVE-2024-27980 guard rejects spawning a.cmdwith an argv array outright: on currentmain, the e2e suite on Windows under Bun 1.4.4 dies at every turn withspawn opencode.cmd EINVAL(reproduced); 1.3.10 still ran it. The unit suite is unaffected — this only blocks the Windows e2e story.Running a
.cmdthroughcmd.exewas never sound for this harness in the first place: every npm cmd-shim form probed splits a multi-word prompt across argv (verified by echoing%1..%4through a shim — only the accident thatopencode runrejoins trailing args as a sentence kept it working), andcmdmetacharacters in a quoted prompt mangle the command — Bun 1.4's own native-spawn guard now refuses such args.The change
resolveOpencode()unwraps the standard npm cmd-shim ("%dp0%\<target>.exe" %*) to the real executable it calls.turn()spawns through nativeBun.spawninstead ofnode:child_process(same argv; Web streams + a race instead of event emitters), so a shim format the unwrapper doesn't recognize degrades to the previous best-effort instead of crashing.src/is untouched.Verification
Linux legs run with the same CI-pinned host (
@opencode/cli2.0.26, registry tarball); Windows legs with the installed 2.1.4 host.tsc --noEmitclean;bun run lintoutput identical to main.Model-assisted work: Qwen3-flash-next (analysis, implementation, and verification assistance).