Files
OmniRoute/bin/cli/commands
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
..
2026-06-11 04:01:24 -03:00
2026-05-26 23:51:47 -03:00
2026-06-19 06:49:01 -03:00
2026-06-19 06:49:01 -03:00
2026-06-21 08:56:51 -03:00
2026-06-28 06:58:29 -03:00
2026-06-23 03:08:29 -03:00
2026-05-26 23:51:47 -03:00
2026-06-20 14:55:24 -03:00
2026-06-20 07:09:43 -03:00
2026-07-04 13:00:30 -03:00
2026-06-20 07:09:43 -03:00
2026-07-04 13:00:30 -03:00
2026-06-20 07:09:43 -03:00
2026-06-20 07:09:43 -03:00
2026-06-20 07:09:43 -03:00
2026-06-20 07:09:43 -03:00
2026-06-20 07:09:43 -03:00
2026-06-20 07:09:43 -03:00
2026-06-20 07:09:43 -03:00
2026-05-26 23:51:47 -03:00
2026-06-19 06:49:01 -03:00
2026-06-21 08:56:51 -03:00