WIP fase 2b-2: rimosso login ChatGPT/OAuth/device code, agent/workload identity, backend-client; resta solo chiave API (test non tutti verdi)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -427,9 +427,19 @@ pub struct TestCodexBuilder {
|
||||
thread_store: Option<Arc<dyn ThreadStore>>,
|
||||
agent_graph_store: Option<Arc<dyn AgentGraphStore>>,
|
||||
image_store: Arc<dyn AttachmentStore>,
|
||||
catalog_discovery: bool,
|
||||
}
|
||||
|
||||
impl TestCodexBuilder {
|
||||
/// Authenticate with a stored API key and point the provider's model catalog at the
|
||||
/// mock server, so remote catalog refresh runs. Stored API keys only refresh catalogs
|
||||
/// from an explicit `model_catalog_url`.
|
||||
pub fn with_catalog_discovery_api_key(mut self) -> Self {
|
||||
self.auth = TestAuth::Cached(CodexAuth::from_api_key("Test API Key"));
|
||||
self.catalog_discovery = true;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_apps_tools_cache(mut self, cache: codex_core::CodexAppsToolsCache) -> Self {
|
||||
self.apps_tools_cache = cache;
|
||||
self
|
||||
@@ -1031,7 +1041,18 @@ impl TestCodexBuilder {
|
||||
// specific model can still override this with a config mutator.
|
||||
config.model = Some("gpt-5.5".to_string());
|
||||
config.cwd = cwd_override;
|
||||
config.model_provider = model_provider;
|
||||
if self.catalog_discovery {
|
||||
let catalog_url = model_provider
|
||||
.base_url
|
||||
.as_deref()
|
||||
.map(|base_url| format!("{}/models", base_url.trim_end_matches('/')));
|
||||
config.model_provider = ModelProviderInfo {
|
||||
model_catalog_url: catalog_url.map(Into::into),
|
||||
..model_provider
|
||||
};
|
||||
} else {
|
||||
config.model_provider = model_provider;
|
||||
}
|
||||
if let Ok(path) = codex_utils_cargo_bin::cargo_bin("codex") {
|
||||
config.codex_self_exe = Some(path);
|
||||
} else if let Ok(path) = codex_utils_cargo_bin::cargo_bin("codex-exec") {
|
||||
@@ -1586,6 +1607,7 @@ pub fn test_codex() -> TestCodexBuilder {
|
||||
thread_store: None,
|
||||
agent_graph_store: None,
|
||||
image_store: codex_core::passthrough_image_store(),
|
||||
catalog_discovery: false,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user