mirror of
https://github.com/openai/codex.git
synced 2026-10-29 19:08:43 +00:00
## Why Model catalog refreshes need to use the same registered actor and credential owner as model requests when runtime authentication is enabled. ## What changed - Add `ProviderAuthContext` to carry credentials and optional runtime authentication into model providers and catalog clients. - Select runtime authentication independently for inference and catalog destinations. Reject unsupported OpenAI origins while preserving provider authentication for other destinations. - Include API organization and project selectors in runtime registration. Reuse registered runtimes across projects within an organization and replace them when the organization changes. - Preserve transport restrictions and account bindings, and strip sensitive headers on cross-origin redirects. - Apply the catalog timeout to authentication and fetching while allowing credential refresh and registration to finish safely. ## Testing Add coverage for runtime-authenticated catalogs, provider isolation, resource selection, gateway authentication, cross-origin redirects, and timeout recovery that preserves registration and refreshed tokens. GitOrigin-RevId: c14f1a02159031ea0af1f9b26ea890f8dca7d6ad
26 lines
904 B
Rust
26 lines
904 B
Rust
//! Fixtures for integration tests that seed provider credentials and model caches.
|
|
|
|
use codex_login::CodexAuth;
|
|
use codex_model_provider_info::ModelProviderInfo;
|
|
use codex_models_manager::cache::ModelsCacheEntry;
|
|
use codex_protocol::openai_models::ModelInfo;
|
|
|
|
/// Constructs a cache fixture matching the supplied test provider and authentication.
|
|
pub fn models_cache_entry(
|
|
provider_info: &ModelProviderInfo,
|
|
auth: Option<&CodexAuth>,
|
|
models: Vec<ModelInfo>,
|
|
) -> ModelsCacheEntry {
|
|
ModelsCacheEntry {
|
|
fetched_at: std::time::SystemTime::now().into(),
|
|
etag: None,
|
|
client_version: Some(codex_models_manager::client_version_to_whole()),
|
|
identity: crate::models_identity::identity(provider_info, auth).ok(),
|
|
models,
|
|
}
|
|
}
|
|
|
|
pub use crate::shared_state::test_support::seed_gateway_auth;
|
|
|
|
pub use crate::provider::test_support::runtime_model_provider;
|