mirror of
https://github.com/openai/codex.git
synced 2026-11-24 23:20:47 +00:00
Wire shared runtime authentication through threads and API clients (#59177)
## What changed - Share a lazily registered runtime across threads, model discovery, and extension clients when `runtime_agent_instances` is enabled, while honoring each thread's authentication mode and credential owner. - Bind model catalogs to the effective provider and authentication context while preserving cache policy and live API-key discovery settings. - Resolve credentials, routing, and transport policy together for each request. Preserve proxy and TLS settings, validate runtime account selectors, and prevent pooled connections from crossing runtime identities. - Accept supported ChatGPT subdomains when selecting the registration environment. ## Testing Add integration coverage for shared runtime registration, dual-header and assertion-only modes, disabled and third-party providers, credential replacement, subagents, and delegated review. Add coverage for catalog cache policy and runtime-aware connection reuse. GitOrigin-RevId: 99dd9d987c29c93597a648f6586f98ac6a932c3c
This commit is contained in:
@@ -113,8 +113,12 @@ async fn publication_harness(
|
||||
});
|
||||
harness.manager = ThreadManager::new(
|
||||
&harness.config,
|
||||
harness.manager.auth_manager(),
|
||||
harness.manager.get_models_manager(),
|
||||
crate::build_startup_models(
|
||||
&harness.config,
|
||||
harness.manager.auth_manager(),
|
||||
"spawn-publication-cleanup-test".to_string(),
|
||||
crate::test_support::fixed_model_catalog(harness.manager.get_models_manager()),
|
||||
),
|
||||
crate::CodexAppsToolsCache::default(),
|
||||
SessionSource::Exec,
|
||||
harness.manager.environment_manager(),
|
||||
@@ -124,7 +128,6 @@ async fn publication_harness(
|
||||
harness.manager.image_store(),
|
||||
crate::ThreadStoreBuilder::from_config(&harness.config, harness.state_db.clone()).build(),
|
||||
Some(graph.clone()),
|
||||
"spawn-publication-cleanup-test".to_string(),
|
||||
/*attestation_provider*/ None,
|
||||
/*external_time_provider*/ None,
|
||||
)
|
||||
|
||||
@@ -49,6 +49,7 @@ use codex_history::ResumedHistory;
|
||||
use codex_history::RolloutItem;
|
||||
use codex_login::AuthManager;
|
||||
use codex_login::CodexAuth;
|
||||
use codex_models_manager::manager::ModelCatalogSettings;
|
||||
use codex_models_manager::model_info::model_info_from_slug;
|
||||
use codex_protocol::AgentPath;
|
||||
use codex_protocol::ResponseItemId;
|
||||
@@ -3785,8 +3786,14 @@ async fn spawn_agent_full_fork_legacy_compaction_rebuilds_child_instructions_onc
|
||||
let auth_manager = AuthManager::from_auth_for_testing(CodexAuth::from_api_key("dummy"));
|
||||
harness.manager = ThreadManager::new(
|
||||
&parent_config,
|
||||
auth_manager.clone(),
|
||||
crate::thread_manager::build_models_manager(&parent_config, auth_manager),
|
||||
crate::build_startup_models(
|
||||
&parent_config,
|
||||
auth_manager.clone(),
|
||||
uuid::Uuid::new_v4().to_string(),
|
||||
Arc::new(ModelCatalogSettings::disk(
|
||||
parent_config.codex_home.to_path_buf(),
|
||||
)),
|
||||
),
|
||||
crate::CodexAppsToolsCache::default(),
|
||||
SessionSource::Exec,
|
||||
Arc::new(codex_exec_server::EnvironmentManager::default_for_tests()),
|
||||
@@ -3797,7 +3804,6 @@ async fn spawn_agent_full_fork_legacy_compaction_rebuilds_child_instructions_onc
|
||||
crate::ThreadStoreBuilder::from_config(&parent_config, harness.state_db.clone())
|
||||
.build(),
|
||||
crate::thread_manager::local_agent_graph_store_from_state_db(harness.state_db.as_ref()),
|
||||
uuid::Uuid::new_v4().to_string(),
|
||||
/*attestation_provider*/ None,
|
||||
/*external_time_provider*/ None,
|
||||
);
|
||||
@@ -4941,8 +4947,12 @@ async fn resume_thread_subagent_restores_stored_metadata() {
|
||||
let auth_manager = AuthManager::from_auth_for_testing(CodexAuth::from_api_key("dummy"));
|
||||
let manager = ThreadManager::new(
|
||||
&config,
|
||||
auth_manager.clone(),
|
||||
crate::thread_manager::build_models_manager(&config, auth_manager),
|
||||
crate::build_startup_models(
|
||||
&config,
|
||||
auth_manager.clone(),
|
||||
uuid::Uuid::new_v4().to_string(),
|
||||
Arc::new(ModelCatalogSettings::disk(config.codex_home.to_path_buf())),
|
||||
),
|
||||
crate::CodexAppsToolsCache::default(),
|
||||
SessionSource::Exec,
|
||||
Arc::new(codex_exec_server::EnvironmentManager::default_for_tests()),
|
||||
@@ -4952,7 +4962,6 @@ async fn resume_thread_subagent_restores_stored_metadata() {
|
||||
crate::thread_manager::passthrough_image_store(),
|
||||
thread_store.clone(),
|
||||
/*agent_graph_store*/ None,
|
||||
uuid::Uuid::new_v4().to_string(),
|
||||
/*attestation_provider*/ None,
|
||||
/*external_time_provider*/ None,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user