Skip to content

fix(launch): pass Codex argv after -- without eating alias or model overrides - #79

Merged
cursor[bot] merged 5 commits into
devfrom
cursor/launch-passthrough-6670
Aug 26, 2026
Merged

cursor[bot] merged 5 commits into
devfrom
cursor/launch-passthrough-6670

Conversation

@xjoker

@xjoker xjoker commented Aug 26, 2026 •

Copy link
Copy Markdown
Owner

Problem

codex-switch launch -- exec --json "…" was not a Codex exec. Clap stopped parsing flags at --, then still filled the next positional as alias, so this became Profile 'exec' not found.

Provider launches always appended -c model="saved" (plus that model's reasoning / web_search). A passthrough --model / -m then fought the saved model, and ChatGPT --model had to sit before a Codex subcommand.

--full-auto is not a current Codex flag.

Follow-up holes after the first patch:

  • launch work exec -- --json dropped exec (passthrough replaced clap args instead of merging).
  • launch exec --json still treated exec as an alias and stole --json.
  • One-shot --model still printed/JSON-reported the saved model.
  • --json launch mixed Codex stdout with the envelope.
  • TUI mapped CLI custom reasoning to (skip), hid env_key / wire_api / --set, and could not pass extra Codex argv.

After those TUI extras landed, three more provider/TUI holes (not CLI argv):

  • Add form rendered env key / wire API / extra -c but Tab never focused them (Enter still skipped to Models, which is intended).
  • provider rename always rewrote env_key to the derived default, wiping a custom name.
  • Extra -c was split on every comma, so a value like foo=a, b became two overrides.

Approach

Do not set launch args last = true. That would break launch work exec hi (passthrough without --).

  1. Split argv at --, a known Codex subcommand (exec, resume, …), or a non-launch flag (-s, …). Merge tokens on both sides of --.
  2. ChatGPT: insert --model before a Codex subcommand.
  3. Provider: keep -c overrides in front of exec. If the passthrough already sets --model / -m / --model=, drop per-model -c pairs (model, model_reasoning_effort, web_search) and keep model_provider / model_providers.*. Banner and JSON report the one-shot model.
  4. --json launch pipes Codex stdout/stderr into codex_stdout / codex_stderr on the envelope.
  5. TUI: preserve custom reasoning; edit env key / wire API / extra -c; Tab on the provider picker types extra Codex argv.
  6. Add form: Enter stays Alias → URL → Key → Models; Tab visits env / wire / extra. Extra -c keeps commas inside a value. Rename re-derives env_key only when it still matches the old default.

launch work --json is still codex-switch JSON (put Codex --json after --, or after exec). A prompt that looks like an alias still needs --.

Tests (local, verified)

clippy --all-targets -- -D warnings, then:

  • cargo test --test test_launch_passthrough — 7 passed (fake codex on PATH records argv)
  • cargo test --lib filters for cli::tests, launch::, tui::provider_form, tui::provider_launch, provider::tests
Open in Web Open in Cursor 

cursoragent and others added 2 commits August 26, 2026 13:57
Clap treated `launch -- exec` as alias `exec`. Split the first `--` after
the launch subcommand so Codex flags (`exec --json`, `--color`, `--model`)
and alias-shaped prompts pass through. Provider `-c` overrides stay in
front of subcommands; a passthrough `--model`/`-m` drops the competing
`-c model=` pair. Docs drop the removed Codex `--full-auto` flag.

Co-authored-by: lolitaupdate <[email protected]>
When Codex argv after `--` already sets --model/-m, strip saved model,
reasoning, and web_search -c pairs so they do not apply to a one-shot
model. Keep provider definition overrides. Add a fake-codex argv
integration test.

Co-authored-by: lolitaupdate <[email protected]>
@xjoker
xjoker marked this pull request as ready for review August 26, 2026 14:25
cursoragent and others added 3 commits August 26, 2026 14:41
Treat known Codex subcommands and non-launch flags as argv, not aliases.
Keep tokens on both sides of `--`. Report one-shot --model in the banner
and JSON envelope, and capture Codex stdout/stderr when `--json launch`
is set. TUI keeps CLI custom reasoning, edits env_key/wire_api/--set,
and accepts extra Codex argv on the provider picker.

Co-authored-by: lolitaupdate <[email protected]>
Add's Enter path still skips to Models; Tab now visits env key, wire
API, and extra -c. Extra -c values may contain commas. Rename only
re-derives the default env_key name.

Co-authored-by: lolitaupdate <[email protected]>
@cursor
cursor Bot merged commit 0a630fc into dev Aug 26, 2026
@xjoker
xjoker deleted the cursor/launch-passthrough-6670 branch September 9, 2026 01:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants