Repository navigation
fix(launch): pass Codex argv after -- without eating alias or model overrides - #79
Merged
Merged
Conversation
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
marked this pull request as ready for review
August 26, 2026 14:25
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]>
Co-authored-by: lolitaupdate <[email protected]>
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
codex-switch launch -- exec --json "…"was not a Codexexec. Clap stopped parsing flags at--, then still filled the next positional asalias, so this becameProfile 'exec' not found.Provider launches always appended
-c model="saved"(plus that model's reasoning /web_search). A passthrough--model/-mthen fought the saved model, and ChatGPT--modelhad to sit before a Codex subcommand.--full-autois not a current Codex flag.Follow-up holes after the first patch:
launch work exec -- --jsondroppedexec(passthroughreplaced clap args instead of merging).launch exec --jsonstill treatedexecas an alias and stole--json.--modelstill printed/JSON-reported the saved model.--json launchmixed Codex stdout with the envelope.(skip), hidenv_key/wire_api/--set, and could not pass extra Codex argv.After those TUI extras landed, three more provider/TUI holes (not CLI argv):
-cbut Tab never focused them (Enter still skipped to Models, which is intended).provider renamealways rewroteenv_keyto the derived default, wiping a custom name.-cwas split on every comma, so a value likefoo=a, bbecame two overrides.Approach
Do not set launch args
last = true. That would breaklaunch work exec hi(passthrough without--).--, a known Codex subcommand (exec,resume, …), or a non-launch flag (-s, …). Merge tokens on both sides of--.--modelbefore a Codex subcommand.-coverrides in front ofexec. If the passthrough already sets--model/-m/--model=, drop per-model-cpairs (model,model_reasoning_effort,web_search) and keepmodel_provider/model_providers.*. Banner and JSON report the one-shot model.--json launchpipes Codex stdout/stderr intocodex_stdout/codex_stderron the envelope.-c; Tab on the provider picker types extra Codex argv.-ckeeps commas inside a value. Rename re-derivesenv_keyonly when it still matches the old default.launch work --jsonis still codex-switch JSON (put Codex--jsonafter--, or afterexec). 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 (fakecodexon PATH records argv)cargo test --libfilters forcli::tests,launch::,tui::provider_form,tui::provider_launch,provider::tests