OmniRoute/bin
Suman 8e0d7e4ddd
fix(cli): escape codex args and stop aborting on exit in launch-codex (#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 #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 #8856

Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>

---------

Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
2026-07-28 11:50:00 -03:00
..
cli fix(cli): escape codex args and stop aborting on exit in launch-codex (#8856) 2026-07-28 11:50:00 -03:00
_ops-common.sh Release v3.8.40 2026-06-29 08:40:06 -03:00
aliasResolver.mjs fix(cli): register ESM alias resolver for @/ paths under global install (#7808) 2026-07-20 10:10:33 -03:00
aliasResolverHook.mjs fix(cli): register ESM alias resolver for @/ paths under global install (#7808) 2026-07-20 10:10:33 -03:00
cold-start-bench.sh Release v3.8.40 2026-06-29 08:40:06 -03:00
mcp-server.mjs Release v3.8.24 (#3747) 2026-06-13 17:27:40 -03:00
nodeRuntimeSupport.mjs Release v3.8.40 2026-06-29 08:40:06 -03:00
omniroute.mjs fix(cli): prepare Next.js cache dir on Android/Termux before serve (#8593) 2026-07-27 19:07:19 -03:00
reset-password.mjs fix(cli): register reset-password subcommand + non-TTY stdin path (#6261, #6258) (#6387) 2026-07-06 18:13:06 -03:00
restore-data.sh Release v3.8.40 2026-06-29 08:40:06 -03:00
restore-policies.sh Release v3.8.40 2026-06-29 08:40:06 -03:00
rollback.sh Release v3.8.40 2026-06-29 08:40:06 -03:00
snapshot-data.sh Release v3.8.40 2026-06-29 08:40:06 -03:00