fix(provider): preserve fallback runtime options when resolving credentials

This commit is contained in:
Chummy 2026-02-19 18:37:37 +08:00
parent bb22bdc8fb
commit 435c33d408

View file

@ -822,15 +822,14 @@ pub fn create_resilient_provider_with_options(
// Each fallback provider resolves its own credential via provider- // Each fallback provider resolves its own credential via provider-
// specific env vars (e.g. DEEPSEEK_API_KEY for "deepseek") instead // specific env vars (e.g. DEEPSEEK_API_KEY for "deepseek") instead
// of inheriting the primary provider's key. Passing `None` lets // of inheriting the primary provider's key. Passing `None` lets
// `resolve_provider_credential` check the correct env var for the // `resolve_provider_credential` check the correct env var for the
// fallback provider name. // fallback provider name.
// //
// Route through `create_provider_with_url` (not // Keep using `create_provider_with_options` so fallback entries that
// `create_provider_with_options`) so that `custom:` URL prefixes // require runtime options (for example Codex auth profile overrides)
// (e.g. "custom:http://host.docker.internal:1234/v1") work as // continue to work.
// fallback entries. match create_provider_with_options(fallback, None, options) {
match create_provider_with_url(fallback, None, None) {
Ok(provider) => providers.push((fallback.clone(), provider)), Ok(provider) => providers.push((fallback.clone(), provider)),
Err(_error) => { Err(_error) => {
tracing::warn!( tracing::warn!(