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:
@@ -1,10 +1,7 @@
|
||||
//! Keep each catalog bound to its provider and auth owner while preserving host cache policy.
|
||||
|
||||
use crate::config::Config;
|
||||
use crate::runtime_auth::RuntimeAuthSlot;
|
||||
use crate::runtime_auth::runtime_for_config;
|
||||
use codex_features::Feature;
|
||||
use codex_features::RuntimeAuthMode;
|
||||
use codex_login::AuthManager;
|
||||
use codex_model_provider::ModelCatalogFactory;
|
||||
use codex_model_provider::ProviderAuthContext;
|
||||
@@ -13,13 +10,11 @@ use codex_models_manager::manager::ModelCatalogSettings;
|
||||
use codex_models_manager::manager::SharedModelsManager;
|
||||
use codex_protocol::openai_models::ModelsResponse;
|
||||
use codex_protocol::protocol::SessionSource;
|
||||
use codex_runtime_agent_instance::RuntimeAuthManager;
|
||||
use std::sync::Arc;
|
||||
|
||||
/// The startup catalog and the credential/runtime owner used to construct it.
|
||||
/// The startup catalog and the credential owner used to construct it.
|
||||
pub struct StartupModels {
|
||||
pub(super) credentials: Arc<AuthManager>,
|
||||
pub(super) runtime_auth: RuntimeAuthSlot,
|
||||
pub(super) installation_id: String,
|
||||
pub(super) catalog: ThreadModelCatalog,
|
||||
}
|
||||
@@ -31,22 +26,14 @@ impl StartupModels {
|
||||
}
|
||||
}
|
||||
|
||||
/// Construct the catalog and runtime owner together using the host's catalog factory.
|
||||
/// Construct the catalog and credential owner together using the host's catalog factory.
|
||||
/// Use `ModelCatalogSettings` for standard provider catalogs with a disk, custom, or no cache.
|
||||
/// Runtime registration remains lazy; this does not register an instance or generate a key.
|
||||
pub fn build_startup_models(
|
||||
config: &Config,
|
||||
credentials: Arc<AuthManager>,
|
||||
installation_id: String,
|
||||
factory: Arc<dyn ModelCatalogFactory>,
|
||||
) -> StartupModels {
|
||||
let runtime_auth = RuntimeAuthSlot::default();
|
||||
let runtime = runtime_for_config(
|
||||
&runtime_auth,
|
||||
config,
|
||||
Arc::clone(&credentials),
|
||||
&installation_id,
|
||||
);
|
||||
let catalog = ThreadModelCatalog::new(
|
||||
config.model_provider.clone(),
|
||||
config.model_catalog.clone(),
|
||||
@@ -54,12 +41,10 @@ pub fn build_startup_models(
|
||||
config.features.enabled(Feature::ApiKeyModelDiscovery),
|
||||
ProviderAuthContext {
|
||||
credentials: Arc::clone(&credentials),
|
||||
runtime_auth: runtime.map(|runtime| (runtime, config.runtime_auth_mode)),
|
||||
},
|
||||
);
|
||||
StartupModels {
|
||||
credentials,
|
||||
runtime_auth,
|
||||
installation_id,
|
||||
catalog,
|
||||
}
|
||||
@@ -71,20 +56,10 @@ pub(super) struct ThreadModelCatalog {
|
||||
catalog: Option<ModelsResponse>,
|
||||
factory: Arc<dyn ModelCatalogFactory>,
|
||||
api_key_model_discovery_default: bool,
|
||||
runtime_mode: Option<RuntimeAuthMode>,
|
||||
}
|
||||
|
||||
pub fn build_models_manager(
|
||||
config: &Config,
|
||||
credentials: Arc<AuthManager>,
|
||||
runtime: Option<Arc<RuntimeAuthManager>>,
|
||||
) -> SharedModelsManager {
|
||||
let auth = ProviderAuthContext {
|
||||
credentials,
|
||||
runtime_auth: runtime
|
||||
.filter(|_| config.features.enabled(Feature::RuntimeAgentInstances))
|
||||
.map(|runtime| (runtime, config.runtime_auth_mode)),
|
||||
};
|
||||
pub fn build_models_manager(config: &Config, credentials: Arc<AuthManager>) -> SharedModelsManager {
|
||||
let auth = ProviderAuthContext { credentials };
|
||||
ModelCatalogSettings::disk(config.codex_home.to_path_buf()).build(
|
||||
auth.model_provider(config.model_provider.clone()),
|
||||
config.model_catalog.clone(),
|
||||
@@ -100,7 +75,6 @@ impl ThreadModelCatalog {
|
||||
api_key_model_discovery_default: bool,
|
||||
auth: ProviderAuthContext,
|
||||
) -> Self {
|
||||
let runtime_mode = auth.runtime_auth.as_ref().map(|(_, mode)| *mode);
|
||||
let manager = factory.build(
|
||||
auth.model_provider(provider.clone()),
|
||||
catalog.clone(),
|
||||
@@ -112,7 +86,6 @@ impl ThreadModelCatalog {
|
||||
catalog,
|
||||
factory,
|
||||
api_key_model_discovery_default,
|
||||
runtime_mode,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,7 +94,6 @@ impl ThreadModelCatalog {
|
||||
&self,
|
||||
config: &Config,
|
||||
credentials: Arc<AuthManager>,
|
||||
runtime: Option<Arc<RuntimeAuthManager>>,
|
||||
same_owner: bool,
|
||||
originator: &str,
|
||||
session_source: &SessionSource,
|
||||
@@ -131,10 +103,7 @@ impl ThreadModelCatalog {
|
||||
.as_ref()
|
||||
.filter(|_| self.matches_catalog_provider(&config.model_provider))
|
||||
});
|
||||
let auth = ProviderAuthContext {
|
||||
credentials,
|
||||
runtime_auth: runtime.map(|runtime| (runtime, config.runtime_auth_mode)),
|
||||
};
|
||||
let auth = ProviderAuthContext { credentials };
|
||||
let manager = self.for_config(config, models, auth, same_owner);
|
||||
let manager = manager.for_originator(originator).unwrap_or(manager);
|
||||
if session_source.is_non_root_agent() {
|
||||
@@ -157,7 +126,6 @@ impl ThreadModelCatalog {
|
||||
let api_key_model_discovery_default =
|
||||
config.features.enabled(Feature::ApiKeyModelDiscovery);
|
||||
if same_owner
|
||||
&& self.runtime_mode == auth.runtime_auth.as_ref().map(|(_, mode)| *mode)
|
||||
&& self.matches_catalog_provider(&config.model_provider)
|
||||
&& self.catalog.as_ref() == models
|
||||
&& self.api_key_model_discovery_default == api_key_model_discovery_default
|
||||
|
||||
Reference in New Issue
Block a user