-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Closed
Description
Thank you for your work on Codex! This is a regression in the Rust CLI configuration handling.
What version of Codex is running?
- codex --version: rust-v0.23.0-alpha.5 (regression appears between rust-v0.23.0-alpha and rust-v0.23.0-alpha.5)
Which model were you using?
- Any; reproduces with built-in provider ids such as openai and oss.
What platform is your computer?
- e.g., macOS (uname -mprs), Linux, or Windows. Please fill in.
What steps can reproduce the bug?
- Create/update ~/.codex/config.toml with a user override for a built-in model provider key:
model_provider = "oss"
[model_providers.oss]
name = "Open Source"
base_url = "http://my-ollama.example.com:11434/v1"
- Run Codex (Rust CLI), e.g.:
codex -m gpt-oss:20b --oss or codex with defaults
- Observe that requests still use the built-in provider configuration instead of the user override (e.g., base_url is not changed).
What is the expected behavior?
- User-defined entries under
[model_providers.<id>]
in~/.codex/config.toml
should override the built-in provider with the same , as documented (“override
and amend the default set of model providers”).
What do you see instead?
- The built-in provider entry wins; the user override is ignored when collides with a built-in key.
Additional information
- Root cause:
- codex-rs/core/src/config.rs merges built-ins with user-defined providers using:
for (key, provider) in cfg.model_providers.into_iter() {
model_providers.entry(key).or_insert(provider);
}
- codex-rs/core/src/config.rs merges built-ins with user-defined providers using:
- or_insert prevents overriding an existing (built-in) entry with the same key, so user overrides for keys like openai, azure, ollama, or oss are ignored.
- Background and related changes:
- Introduced in the work to read model_provider/model_providers from config.toml and later work adding chat completions support and profiles; docs were
updated to encourage overriding providers. - This behavior diverges from docs and breaks common use cases (e.g., overriding
[model_providers.oss]
base_url).
- Introduced in the work to read model_provider/model_providers from config.toml and later work adding chat completions support and profiles; docs were
- Proposed fix:
- Replace or_insert with insert so user-defined providers replace built-ins on the same key:
for (key, provider) in cfg.model_providers.into_iter() {
model_providers.insert(key, provider);
}
- Replace or_insert with insert so user-defined providers replace built-ins on the same key:
- This aligns with the documentation (“override and amend”).
- Suggested regression test:
- Given
model_provider = "oss"
and a custom[model_providers.oss].base_url
, assert thatConfig.model_provider.base_url
equals the custom value.
- Given
Thank you!
Metadata
Metadata
Assignees
Labels
No labels