aKode fase 2b-2: rimosso login ChatGPT e tutti i sottosistemi solo-ChatGPT
- Login: resta solo chiave API (+ header, Bedrock). Rimossi OAuth/browser, device code, refresh/revoke su auth.openai.com, PAT, agent/workload identity, runtime agent instance, backend-client e openapi-models, workspace routing. - Rimossi: generazione immagini (ext + skill imagegen), history notes, plugin remoti (catalogo, sync, share), cyber access program, daybreak, cloud config e requirements (config_server ora fail-closed), attestation, frozen cloud skills, EMA MCP auth, Codex Apps/connettori, ricerca ospitata, header/zstd/ routing/cookie del backend Codex, fallback OPENAI_API_KEY del realtime. - Messaggi d'errore senza link a chatgpt.com. - Chiavi di config legacy accettate e ignorate; feature rimosse = Stage::Removed. - Test: cancellati solo quelli del codice rimosso; test di sicurezza (sandbox estensioni, permessi, redazione, auth storage, requirements) adattati. Restano solo fallimenti d'ambiente (code-mode-host/V8, ~/.agents). - Istruzioni di sistema invariate. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -17,7 +17,7 @@ use anyhow::Result;
|
||||
use anyhow::anyhow;
|
||||
use codex_agent_graph_store::AgentGraphStore;
|
||||
use codex_attachment_store::AttachmentStore;
|
||||
use codex_config::CloudConfigBundleLoader;
|
||||
use codex_config::test_support::ManagedConfigFixture;
|
||||
use codex_core::CodexThread;
|
||||
pub use codex_core::StartThreadOptions;
|
||||
use codex_core::ThreadManager;
|
||||
@@ -84,7 +84,7 @@ use wiremock::MockServer;
|
||||
use crate::TempDirExt;
|
||||
use crate::TestEnvironment;
|
||||
use crate::load_default_config_for_test;
|
||||
use crate::load_default_config_for_test_with_cloud_config_bundle;
|
||||
use crate::load_default_config_for_test_with_managed_config;
|
||||
use crate::responses::WebSocketTestServer;
|
||||
use crate::responses::output_value_to_text;
|
||||
use crate::responses::start_mock_server;
|
||||
@@ -405,15 +405,20 @@ impl TestAuth {
|
||||
}
|
||||
}
|
||||
|
||||
/// Host-supplied header auth without credentials, for tests that exercise the merged
|
||||
/// provider catalog refresh path.
|
||||
pub fn header_auth_for_testing() -> CodexAuth {
|
||||
CodexAuth::Headers(codex_login::AuthHeaders::new(Default::default()))
|
||||
}
|
||||
|
||||
pub struct TestCodexBuilder {
|
||||
apps_tools_cache: codex_core::CodexAppsToolsCache,
|
||||
config_mutators: Vec<Box<ConfigMutator>>,
|
||||
thread_manager_configurer: Option<Box<dyn FnOnce(ThreadManager) -> ThreadManager + Send>>,
|
||||
auth: TestAuth,
|
||||
pre_build_hooks: Vec<Box<PreBuildHook>>,
|
||||
workspace_setups: Vec<Box<WorkspaceSetup>>,
|
||||
home: Option<Arc<TempDir>>,
|
||||
cloud_config_bundle: Option<CloudConfigBundleLoader>,
|
||||
managed_config: Option<ManagedConfigFixture>,
|
||||
user_shell_override: Option<Shell>,
|
||||
exec_server_url: Option<String>,
|
||||
extensions: Arc<ExtensionRegistry<Config>>,
|
||||
@@ -427,11 +432,23 @@ 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 {
|
||||
pub fn with_apps_tools_cache(mut self, cache: codex_core::CodexAppsToolsCache) -> Self {
|
||||
self.apps_tools_cache = cache;
|
||||
/// 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
|
||||
}
|
||||
|
||||
/// Authenticate with host-supplied (empty) request headers. Header auth refreshes the
|
||||
/// provider catalog from the provider base URL and merges it over the bundled catalog.
|
||||
pub fn with_header_auth(mut self) -> Self {
|
||||
self.auth = TestAuth::Cached(header_auth_for_testing());
|
||||
self
|
||||
}
|
||||
|
||||
@@ -555,11 +572,9 @@ impl TestCodexBuilder {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_cloud_config_bundle(
|
||||
mut self,
|
||||
cloud_config_bundle: CloudConfigBundleLoader,
|
||||
) -> Self {
|
||||
self.cloud_config_bundle = Some(cloud_config_bundle);
|
||||
/// Loads the fixture as local managed requirements / config (system files).
|
||||
pub fn with_managed_config(mut self, managed_config: ManagedConfigFixture) -> Self {
|
||||
self.managed_config = Some(managed_config);
|
||||
self
|
||||
}
|
||||
|
||||
@@ -895,7 +910,6 @@ impl TestCodexBuilder {
|
||||
let thread_manager = ThreadManager::new(
|
||||
&config,
|
||||
startup,
|
||||
self.apps_tools_cache.clone(),
|
||||
SessionSource::Exec,
|
||||
Arc::clone(&environment_manager),
|
||||
Arc::new(extensions.build()),
|
||||
@@ -905,7 +919,6 @@ impl TestCodexBuilder {
|
||||
self.agent_graph_store.clone().or_else(|| {
|
||||
codex_core::local_agent_graph_store_from_state_db(state_db.as_ref())
|
||||
}),
|
||||
/*attestation_provider*/ None,
|
||||
/*external_time_provider*/ self.external_time_provider.clone(),
|
||||
);
|
||||
let thread_manager = match self.thread_manager_configurer.take() {
|
||||
@@ -1022,8 +1035,8 @@ impl TestCodexBuilder {
|
||||
for hook in self.pre_build_hooks.drain(..) {
|
||||
hook(home.path());
|
||||
}
|
||||
let mut config = if let Some(cloud_config_bundle) = self.cloud_config_bundle.take() {
|
||||
load_default_config_for_test_with_cloud_config_bundle(home, cloud_config_bundle).await
|
||||
let mut config = if let Some(managed_config) = self.managed_config.take() {
|
||||
load_default_config_for_test_with_managed_config(home, managed_config).await
|
||||
} else {
|
||||
load_default_config_for_test(home).await
|
||||
};
|
||||
@@ -1055,6 +1068,15 @@ impl TestCodexBuilder {
|
||||
for mutator in mutators {
|
||||
mutator(&mut config);
|
||||
}
|
||||
// Apply after config mutators so tests that replace the provider still get catalog
|
||||
// discovery from the provider they selected.
|
||||
if self.catalog_discovery && config.model_provider.model_catalog_url.is_none() {
|
||||
config.model_provider.model_catalog_url = config
|
||||
.model_provider
|
||||
.base_url
|
||||
.as_deref()
|
||||
.map(|base_url| format!("{}/models", base_url.trim_end_matches('/')).into());
|
||||
}
|
||||
ensure_test_model_catalog(&mut config)?;
|
||||
|
||||
Ok((config, cwd))
|
||||
@@ -1554,7 +1576,6 @@ fn function_call_output<'a>(bodies: &'a [Value], call_id: &str) -> &'a Value {
|
||||
|
||||
pub fn test_codex() -> TestCodexBuilder {
|
||||
TestCodexBuilder {
|
||||
apps_tools_cache: Default::default(),
|
||||
thread_manager_configurer: None,
|
||||
config_mutators: vec![Box::new(|config| {
|
||||
config
|
||||
@@ -1571,7 +1592,7 @@ pub fn test_codex() -> TestCodexBuilder {
|
||||
pre_build_hooks: vec![],
|
||||
workspace_setups: vec![],
|
||||
home: None,
|
||||
cloud_config_bundle: None,
|
||||
managed_config: None,
|
||||
user_shell_override: None,
|
||||
exec_server_url: None,
|
||||
extensions: empty_extension_registry(),
|
||||
@@ -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