Repository navigation
fix(cli): escape codex args and stop aborting on exit in launch-codex - #8856
Merged
diegosouzapw merged 2 commits intoJul 28, 2026
Merged
diegosouzapw merged 2 commits into
diegosouzapw merged 2 commits into
Conversation
`launch-codex` spawns `codex.cmd` with `shell: true` on Windows, so Node joins argv with plain spaces and no escaping (DEP0190). This mangles every Windows invocation, not only the ones with a multi-word user argument, because the injected `-c` provider flags carry quoted TOML values: ["-c","model_provider=omniroute", ..., "model_providers.omniroute.base_url=http://localhost:20128/v1", "fix","the","bug"] cmd.exe strips the TOML quotes (`model_provider=omniroute` no longer parses as a TOML string), splits multi-word arguments, and swallows everything after an unquoted `&`. The same defect was fixed for `launch` in diegosouzapw#8837; this ports it to `launch-codex`, which that PR disclosed but left unfixed. - extract the escaping into `bin/cli/utils/winShellArgs.mjs` and reuse it from both launchers instead of keeping a private copy in `launch.mjs` - quote the codex argv (provider flags + profile + pass-through args) on the win32 shell path; argv is untouched off Windows, where no shell is involved - replace `process.exit()` in the command action with `process.exitCode`: on any non-zero child exit it aborted with the libuv `!(handle->flags & UV_HANDLE_CLOSING)` assertion while the inherited stdio handles were closing Test: `tests/unit/cli/launch-codex-windows-spawn-args.test.ts` pins the exact encoding with golden strings (the cmd.exe round-trip is Windows-only and skips on Linux CI, so without goldens CI would guard nothing) and round-trips the real provider flags through a probe `.cmd` shim that forwards `%*`.
Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
diegosouzapw
merged commit Jul 28, 2026
8e0d7e4
into
diegosouzapw:release/v3.8.49
15 of 16 checks passed
diegosouzapw
added a commit
that referenced
this pull request
Jul 28, 2026
…e lost credits Aggregates every pending changelog.d fragment into the [3.8.49] section and regenerates the contributors table from the reconciled bullets. Three fixes this surfaced: - The [3.8.49] section had no `### 📝 Maintenance` heading, so the aggregator's findIndex matched the first one in the file — inside [3.8.47] — and would have filed 92 maintenance bullets under the wrong release. Added the heading to the living section; [3.8.47] stays at its original 234 bullets. - 46 bullets carried no PR/issue reference. Fragments may keep the number only in the filename (`<N>-slug.md`), which the aggregator does not copy into the bullet, so the link and the credit were dropped on aggregation. Restored, scoped strictly to the [3.8.49] range. - 9 external contributors lost their attribution that way and are credited again: @MisileLab (#8566), @MumuTW (#8619), @epsilonode (#8724), @hppsc1215 (#8835), @sumanxg (#8837, #8856), @TitoTFP (#8838), @HouMinXi (#8842, #8845). Contributors table: 84 → 155 entries, no one removed. 42 i18n mirrors synced. check:changelog-integrity green — no base bullet lost.
Merged
muhamadgalihsaputra
pushed a commit
to niyatna/NiyatnaRoute
that referenced
this pull request
Sep 27, 2026
…diegosouzapw#8856) * fix(cli): escape codex args and stop aborting on exit in launch-codex `launch-codex` spawns `codex.cmd` with `shell: true` on Windows, so Node joins argv with plain spaces and no escaping (DEP0190). This mangles every Windows invocation, not only the ones with a multi-word user argument, because the injected `-c` provider flags carry quoted TOML values: ["-c","model_provider=omniroute", ..., "model_providers.omniroute.base_url=http://localhost:20128/v1", "fix","the","bug"] cmd.exe strips the TOML quotes (`model_provider=omniroute` no longer parses as a TOML string), splits multi-word arguments, and swallows everything after an unquoted `&`. The same defect was fixed for `launch` in diegosouzapw#8837; this ports it to `launch-codex`, which that PR disclosed but left unfixed. - extract the escaping into `bin/cli/utils/winShellArgs.mjs` and reuse it from both launchers instead of keeping a private copy in `launch.mjs` - quote the codex argv (provider flags + profile + pass-through args) on the win32 shell path; argv is untouched off Windows, where no shell is involved - replace `process.exit()` in the command action with `process.exitCode`: on any non-zero child exit it aborted with the libuv `!(handle->flags & UV_HANDLE_CLOSING)` assertion while the inherited stdio handles were closing Test: `tests/unit/cli/launch-codex-windows-spawn-args.test.ts` pins the exact encoding with golden strings (the cmd.exe round-trip is Windows-only and skips on Linux CI, so without goldens CI would guard nothing) and round-trips the real provider flags through a probe `.cmd` shim that forwards `%*`. * docs(changelog): add fragment for diegosouzapw#8856 Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com> --------- Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
muhamadgalihsaputra
pushed a commit
to niyatna/NiyatnaRoute
that referenced
this pull request
Sep 27, 2026
…e lost credits Aggregates every pending changelog.d fragment into the [3.8.49] section and regenerates the contributors table from the reconciled bullets. Three fixes this surfaced: - The [3.8.49] section had no `### 📝 Maintenance` heading, so the aggregator's findIndex matched the first one in the file — inside [3.8.47] — and would have filed 92 maintenance bullets under the wrong release. Added the heading to the living section; [3.8.47] stays at its original 234 bullets. - 46 bullets carried no PR/issue reference. Fragments may keep the number only in the filename (`<N>-slug.md`), which the aggregator does not copy into the bullet, so the link and the credit were dropped on aggregation. Restored, scoped strictly to the [3.8.49] range. - 9 external contributors lost their attribution that way and are credited again: @MisileLab (diegosouzapw#8566), @MumuTW (diegosouzapw#8619), @epsilonode (diegosouzapw#8724), @hppsc1215 (diegosouzapw#8835), @sumanxg (diegosouzapw#8837, diegosouzapw#8856), @TitoTFP (diegosouzapw#8838), @HouMinXi (diegosouzapw#8842, diegosouzapw#8845). Contributors table: 84 → 155 entries, no one removed. 42 i18n mirrors synced. check:changelog-integrity green — no base bullet lost.
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.
Problem
launch-codexspawnscodex.cmdwithshell: trueon Windows, so Node joins argv with plain spaces and no escaping (the DEP0190 warning). This is the same defect fixed forlaunchin #8837, which disclosed it here but left it unfixed.It is worse for
launch-codexthan forlaunch: it breaks every Windows invocation, not only the ones with a multi-word user argument, becausebuildCodexProviderArgs()injects-cflags whose TOML values are quoted. Captured through a probe.cmdshim that forwards%*exactly like the real npm shim:Three separate corruptions:
model_provider="omniroute"reaches codex asmodel_provider=omnirouteand no longer parses as a TOML string.fix the bug & ship it) is split into separate argv entries.&is swallowed — cmd.exe reads it as a command separator.Second defect, also ported from #8837:
process.exit(exitCode)in the command action aborts with the libuv!(handle->flags & UV_HANDLE_CLOSING)assertion (async.c:94, exit0xC0000409) on any non-zero child exit, because it tears the loop down while the inherited stdio handles of the just-exited child are still closing.Fix
launch.mjsintobin/cli/utils/winShellArgs.mjsand reuse it from both launchers, instead of duplicating a subtle two-layer escape.quoteClaudeArgskeeps its signature and behaviour.launch-codex.mjs: quote the whole codex argv (provider flags + profile + pass-through args) on the win32 shell path via the newquoteCodexArgs. Off Windows there is no shell, so argv is passed through untouched.launch-codex.mjs:process.exit()→process.exitCode, letting the loop drain.Validation
tests/unit/cli/launch-codex-windows-spawn-args.test.ts, mirroring thelaunchtest added in #8837:.cmdshim's%*re-parse requires — the cmd.exe round-trip is Windows-only and skips on Linux CI, so without goldens CI would guard nothing;.cmdasserts the child argv is byte-identical to what the caller passed, using the actualbuildCodexProviderArgs()output plus quotes, ampersands, pipes,%PATH%,^,!, a trailing backslash and an empty argument.Run on Windows 11 / Node 24.18.0: