feat(provider): launch Codex against a custom provider profile (PR-2) - #68
Merged
xjoker merged 1 commit intoAug 26, 2026
Merged
Conversation
Wire provider profiles into `codex-switch launch`. When the alias names a provider profile, launch takes a separate path from the ChatGPT one: - translate the profile into `codex -c model_providers.<id>.* / model_provider / model` overrides (layered over the user's base config, so ~/.codex and its MCP servers are untouched), and - inject the API key into the Codex child process under the profile's env_key, never onto the command line. No auth.json staging/backup/restore happens for providers (there is no OAuth token), so that whole window is skipped. Auto-select (no alias) stays ChatGPT-only. Extracted ensure_codex_available() and child_exit_code() shared by both launch paths. provider.rs gains codex_config_args()/launch_env()/toml_string() (pure, unit-tested: overrides present and TOML-quoted, key absent from argv, env pair correct, escaping). Verified end-to-end with a stub codex (args + env, key not in argv) and real codex 0.149.1 (base MCP server still lists through a provider launch). Co-authored-by: xJoker <xjoker@users.noreply.github.com>
xjoker
marked this pull request as ready for review
August 26, 2026 05:01
cursor Bot
pushed a commit
that referenced
this pull request
Aug 26, 2026
Real dev already carries #67 (provider store) and #72 (env config). Re-merged the true dev HEAD and resolved the add/add conflicts in provider.rs / cli.rs / commands/provider.rs by keeping the provider-docs full-feature versions (verified supersets of dev's #67). environment.json (#72) merged in cleanly. This PR now cleanly adds #68-#73 (launch / TUI / docs / codex overrides) that are not yet in dev. Full suite: 1019 passed. Co-authored-by: xJoker <xjoker@users.noreply.github.com>
xjoker
added a commit
that referenced
this pull request
Aug 26, 2026
Completes the custom API provider feature. #67 (profiles store + CLI) and #72 (Cloud Agent environment) are already on dev; this adds the remaining pieces as a single clean commit on top of dev so the repo's rebase-and-merge can apply it without conflicts: - launch <provider>: codex -c overrides + env-injected API key (never argv, never ~/.codex/auth.json) - TUI Accounts/Providers tabs + add/remove provider wizard - per-provider Codex overrides: --set KEY=VALUE, --reasoning, --no-web-search, and matching TUI wizard steps (values passed to Codex verbatim) - provider documentation (docs/wiki/Providers.md, etc.) The original per-PR history is preserved in the already-merged #68-#73. Full suite: 1019 passed. Co-authored-by: xJoker <xjoker@users.noreply.github.com>
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.
Second slice of custom-provider support (方案 A). Wires provider profiles into
codex-switch launch.Stacked on PR-1 (#67) — base branch is
cursor/provider-profiles-store-5a91, so this diff shows only the launch changes. Retarget todevonce #67 merges.What's in this PR
When the launch alias names a provider profile,
launchtakes a separate, simpler path from the ChatGPT one:codex -c …overrides (model_providers.<id>.name/base_url/env_key/wire_api,model_provider,model). These layer on top of the user's base~/.codex/config.toml, so~/.codexis never written and its MCP servers/settings are preserved.env_key— never onto the command line (stays out of argv/ps).auth.jsonstaging/backup/restore for providers (there's no OAuth token), so that entire window is skipped.launchwith no alias) stays ChatGPT-only.ensure_codex_available()andchild_exit_code(), now shared by both launch paths.src/provider.rsgains pure, unit-tested helpers:codex_config_args(),launch_env(),toml_string().Tests
provider.rs): overrides are present and TOML-quoted; the API key never appears in argv;launch_env()returns the derived var + key;toml_stringescaping.codexsmoke:launch <provider> <arg>passes the-coverrides, injects the key via env, forwards user args, and the key is not in argv.codex-switch launch <provider> mcp listapplies the-cprovider and still lists a base-config MCP server → base config/MCP preserved through a provider launch.Verification (Linux)
cargo fmt --check,cargo clippy --all-targets --all-features -- -D warnings,cargo test --all— all pass, 0 failed.Out of scope: TUI add/display (PR-3), docs (PR-4), provider
use-mode, DeepSeek-via-OpenRouter guidance.Note: CI Format and audit will be red until #63 (webbrowser RUSTSEC bump) merges to
dev; pre-existing and unrelated.