Repository navigation
URGENT fix(build): route ChatGPT Web MCP bundle through runBuildTool (Windows/Node 24 build crash) v.50/.51 - #11706
Merged
diegosouzapw merged 3 commits intoAug 30, 2026
Conversation
prepublish.ts spawned npx.cmd raw to bundle the codex-chatgpt-web MCP bridge. On Node >= 20 spawning a .cmd shim without a shell throws EINVAL (CVE-2024-27980 hardening), crashing the CLI build on Windows. Route it through runBuildTool() like every other esbuild/tsc invocation in the file. Fixes cheaper-inference#11704.
Regression for cheaper-inference#11704: prepublish.ts must not spawn npx.cmd to bundle the Codex ChatGPT Web MCP bridge (EINVAL on Node >= 20/Windows). Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
diegosouzapw
merged commit Aug 30, 2026
38a2966
into
cheaper-inference:release/v3.8.51
14 of 15 checks passed
muhamadgalihsaputra
pushed a commit
to niyatna/NiyatnaRoute
that referenced
this pull request
Sep 27, 2026
…(Windows/Node 24 build crash) v.50/.51 (cheaper-inference#11706) Confirmed the bug is real and unfixed on the current tip before merging: `scripts/build/prepublish.ts` line 332 was still calling `execFileSync(NPX_BIN, ...)` directly (raw win32 npx.cmd spawn), the exact CVE-2024-27980 shim pattern the file's own header warns about. Root cause, fix, and evidence match — routing through the existing `runBuildTool()` helper. Thanks for catching the one call site the earlier refactor missed.
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.
What was broken
npm run build:cli(scripts/build/prepublish.ts) crashes on Node ≥ 20 on Windows while bundling the ChatGPT Web (Codex) MCP bridge. The crash killed the CLI packaging step, so a user building from the source-only release ZIP (no prebuiltdist/) cannot produce a working global install.Red evidence (Node
v24.18.0, Windows,v3.8.50source ZIP):Root cause
scripts/build/prepublish.ts:326(old) calledexecFileSync(NPX_BIN, ...)directly —NPX_BINis"npx.cmd"on win32. On Node ≥ 20, spawning a.cmdshim withoutshell: truethrowsEINVAL(CVE-2024-27980 spawn hardening). This is the exact failure mode the file's own header comment documents (lines 46–52), which is whyrunBuildTool()was introduced — it resolves the tool's JS entry and runs it withprocess.execPath, no shim, no shell. This one call site was missed by that refactor and is the only remaining rawNPX_BINspawn in the file.The fix (this PR)
scripts/build/prepublish.ts— route that one call through the existingrunBuildTool():execFileSync(NPX_BIN, [runBuildTool("esbuild", "esbuild", [["esbuild", "...mcp-server.ts", ...]{ cwd: ROOT, stdio: "inherit" }Full diff (6 lines changed, 3 added / 3 removed): the esbuild args and options are byte-identical; only the spawn mechanism changes.
What was tested
prepublish.tscrashes at this exact step on Node 24/Windows before the change (crash log above).npm run build:clicompletes —dist/server.js,dist/BUILD_SHA, anddist/open-sse/vendor/codex-chatgpt-web/adapters/chatgpt-web/mcp-server.jsare all produced, and the resulting global install boots (omniroute --version→ 3.8.50, server serves on :20128).eslinton the changed file → 0 errors;npm run typecheck:core→ clean;check:changelog-integrity→ OK vsorigin/release/v3.8.51.Scope
2 files, surgical:
scripts/build/prepublish.ts(1 call site)changelog.d/fixes/11704-prepublish-npx-cmd-win32.md(fragment)Fixes #11704.