Skip to content

feat(provider): save per-provider Codex config overrides - #73

Merged
xjoker merged 5 commits into
cursor/provider-docs-5a91from
cursor/provider-codex-overrides-5a91
Aug 26, 2026
Merged

xjoker merged 5 commits into
cursor/provider-docs-5a91from
cursor/provider-codex-overrides-5a91

Conversation

@xjoker

@xjoker xjoker commented Aug 26, 2026 •

Copy link
Copy Markdown
Owner

目的

让 provider 保存 Codex 启动 overrides,launch 时自动作为 codex -c KEY=VALUE 注入,省得用户每次手敲 -- -c ...。在此之上提供语义化便捷选项,降低配置门槛。典型用途:给某些第三方模型固定 web_search=disabled,或给思考模型固定 model_reasoning_effort=medium。

改动

存储 + 注入(底层)

  • ProviderProfile 新增 #[serde(default)] codex_config: Vec<String>,以 "key=value" 原样落盘到 provider.toml。
  • launch 的 codex_config_args() 在 model 选择之后追加这些 override(层叠在用户 ~/.codex/config.toml 之上,不写盘)。
  • validate() 只校验 KEY=VALUE 形状(含 = 且 key 非空);取值原样透传给 Codex,不硬校验枚举。
  • provider list/show 的 JSON 增加 codex_config;show 文本增加对应行(空则 codex_config (none))。

CLI

  • provider add --set KEY=VALUE(可重复)透传任意 override。
  • provider add --reasoning EFFORT(→ model_reasoning_effort=EFFORT)、--no-web-search(→ web_search=disabled)便捷封装。冲突时显式 --set 覆盖便捷 flag。

TUI 向导

  • 选完 model 后增加两步:reasoning 单选(←/→,默认 (skip) 不设)、web_search 开关(Space,默认保持开启)。选择落进 codex_config。

文档

  • Providers.md、Command-Reference.md 记录 --set / --reasoning / --no-web-search 与 TUI 两步。

底线

  • API key 仍只走 stdin/隐藏输入,never argv;override 里不放 key(key 走 env 注入)。
  • 不硬编码 effort 枚举拒绝未知值(xhigh/max/ultra 随 Codex 版本演进),未知值交给 Codex 报错;--set 始终是任意 key 的逃生舱。契合"配置可替换、不硬编码"。

验证

  • cargo fmt --check、cargo clippy --all-targets --all-features -- -D warnings、cargo test --all(1011 passed)全绿。
  • 新增单测:override 注入顺序在 model 之后、validate 拒绝无 key、codex_config 落盘 round-trip;merge_codex_config 翻译/覆盖/未知值透传;TUI 向导默认跳过与选择保存。
  • wiki 契约测试 test_distribution_contract wiki_ 通过。
  • 真实 OpenRouter token 的思考模型端到端验证:见下方评论/后续更新。

Base 是 cursor/provider-docs-5a91(栈式 PR)。

Open in Web Open in Cursor 

chou xiao and others added 5 commits August 26, 2026 04:02
Providers can now carry extra `codex -c KEY=VALUE` overrides (`provider add
--set`, repeatable) that launch applies automatically, so model-specific
Codex settings like `web_search=disabled` or `model_reasoning_effort=medium`
no longer have to be retyped on every launch.

Overrides are stored verbatim in provider.toml and layered on top of the
model selection at launch. Codex, not codex-switch, remains the source of
truth for valid keys/values: only KEY=VALUE shape is validated, values pass
through untouched.

Co-authored-by: xJoker <[email protected]>
`provider add --reasoning <effort>` saves model_reasoning_effort=<effort> and
`--no-web-search` saves web_search=disabled, lowering the barrier for the two
most common model-specific settings. They are shortcuts over --set: any value
passes through to Codex unchecked (the effort set is Codex's to define), and an
explicit --set for the same key still wins.

Co-authored-by: xJoker <[email protected]>
After the model step the wizard offers a reasoning-effort single choice
(default "(skip)") and a web_search on/off toggle, both saved into the
provider's codex_config. Presets cover the common efforts; the CLI --set stays
the escape hatch for any other value.

Co-authored-by: xJoker <[email protected]>
@xjoker
xjoker marked this pull request as ready for review August 26, 2026 05:01
@xjoker
xjoker merged commit b300585 into cursor/provider-docs-5a91 Aug 26, 2026
@xjoker
xjoker deleted the cursor/provider-codex-overrides-5a91 branch August 26, 2026 05:24
cursor Bot pushed a commit that referenced this pull request Aug 26, 2026
Brings the whole custom-API-provider stack (#67-#73) up to date with dev
(webbrowser 1.2.4, pay-per-use credits column, etc). The only conflict was
src/tui/ui.rs: kept both dev's credits_table_* helpers and the provider
tab/panel renderers, and merged the test-module imports. Full suite: 1019 passed.

Co-authored-by: xJoker <[email protected]>
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 <[email protected]>
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 <[email protected]>
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.

1 participant