model-provider: route model discovery through HTTP client factory (#31361)

This commit is contained in:
Michael Bolin authored and GitHub committed 2026-07-09 02:32:10 +00:00
1 parent 555aa79d5a
commit 5892c7b69d
36 files changed
+658 -131

No files matched your search

+24 -4
View File
@@ -340,6 +340,8 @@ impl ModelProvider for ConfiguredModelProvider {
mod tests {
use std::num::NonZeroU64;
use codex_http_client::HttpClientFactory;
use codex_http_client::OutboundProxyPolicy;
use codex_login::auth::AgentIdentityAuthPolicy;
use codex_login::auth::BedrockApiKeyAuth;
use codex_model_provider_info::ModelProviderAwsAuthInfo;
@@ -656,7 +658,12 @@ mod tests {
let manager =
provider.models_manager(test_codex_home(), /*config_model_catalog*/ None);
let catalog = manager.raw_model_catalog(RefreshStrategy::Online).await;
let catalog = manager
.raw_model_catalog(
RefreshStrategy::Online,
HttpClientFactory::new(OutboundProxyPolicy::ReqwestDefault),
)
.await;
let models = catalog
.models
.iter()
@@ -675,7 +682,10 @@ mod tests {
);
let default_model = manager
.list_models(RefreshStrategy::Online)
.list_models(
RefreshStrategy::Online,
HttpClientFactory::new(OutboundProxyPolicy::ReqwestDefault),
)
.await
.into_iter()
.find(|preset| preset.is_default)
@@ -706,7 +716,12 @@ mod tests {
}),
);
let catalog = manager.raw_model_catalog(RefreshStrategy::Online).await;
let catalog = manager
.raw_model_catalog(
RefreshStrategy::Online,
HttpClientFactory::new(OutboundProxyPolicy::ReqwestDefault),
)
.await;
assert_eq!(catalog.models.len(), 1);
assert_eq!(catalog.models[0].slug, "gpt-5.5");
@@ -748,7 +763,12 @@ mod tests {
let manager =
provider.models_manager(test_codex_home(), /*config_model_catalog*/ None);
let catalog = manager.raw_model_catalog(RefreshStrategy::Online).await;
let catalog = manager
.raw_model_catalog(
RefreshStrategy::Online,
HttpClientFactory::new(OutboundProxyPolicy::ReqwestDefault),
)
.await;
assert!(
catalog