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:
@@ -7,9 +7,6 @@ use crate::mcp_tool_exposure::SharedMcpDefinitions;
|
||||
use codex_config::DEFAULT_MCP_SERVER_ENVIRONMENT_ID;
|
||||
use codex_config::McpServerConfig;
|
||||
use codex_config::types::PluginsConfigToml;
|
||||
use codex_connectors::ConnectorRuntimeManager;
|
||||
use codex_connectors::PluginConnectorSource;
|
||||
use codex_core_plugins::PluginIdentity as CatalogPluginIdentity;
|
||||
use codex_core_plugins::PluginsManager;
|
||||
use codex_exec_server::ExecutorCapabilityDiscoverySnapshot;
|
||||
use codex_exec_server::ExecutorCapabilityDiscoveryV2Snapshot;
|
||||
@@ -23,23 +20,19 @@ use codex_extension_api::SelectedPluginIdentity;
|
||||
use codex_extension_api::SelectedPluginSnapshot;
|
||||
use codex_features::Feature;
|
||||
use codex_login::CodexAuth;
|
||||
use codex_mcp::CODEX_APPS_MCP_SERVER_NAME;
|
||||
use codex_mcp::EffectiveMcpServer;
|
||||
use codex_mcp::McpConfig;
|
||||
use codex_mcp::McpEnvironmentAuthority;
|
||||
use codex_mcp::McpPluginAttribution;
|
||||
use codex_mcp::McpServerRegistration;
|
||||
use codex_mcp::McpToolCatalogCache;
|
||||
use codex_mcp::ToolInfo;
|
||||
use codex_mcp::configured_mcp_servers;
|
||||
use codex_mcp::effective_mcp_servers;
|
||||
use codex_plugin::AppConnectorId;
|
||||
use codex_protocol::capabilities::SelectedCapabilityRoot;
|
||||
use codex_protocol::protocol::EnvironmentConfigState;
|
||||
use codex_protocol::protocol::SessionSource;
|
||||
use codex_protocol::protocol::TurnEnvironmentSelection;
|
||||
|
||||
const LEGACY_CODEX_APPS_REGISTRATION_ID: &str = "legacy_codex_apps";
|
||||
|
||||
/// Thread-local policy that excludes all MCP servers, including runtime contributions.
|
||||
/// Insert into `StartThreadOptions::thread_extension_init` before starting the thread.
|
||||
@@ -112,10 +105,8 @@ pub struct McpManager {
|
||||
connection_pool: codex_mcp::McpConnectionPool,
|
||||
plugins_manager: Arc<PluginsManager>,
|
||||
extensions: Arc<ExtensionRegistry<Config>>,
|
||||
codex_apps_tools_cache: ConnectorRuntimeManager<ToolInfo>,
|
||||
tool_catalog_cache: McpToolCatalogCache,
|
||||
shared_definitions: Arc<SharedMcpDefinitions>,
|
||||
ema_state: Arc<codex_mcp::EmaState>,
|
||||
}
|
||||
|
||||
impl McpManager {
|
||||
@@ -123,7 +114,6 @@ impl McpManager {
|
||||
Self::new_with_extensions(
|
||||
plugins_manager,
|
||||
codex_extension_api::empty_extension_registry(),
|
||||
ConnectorRuntimeManager::default(),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -131,25 +121,18 @@ impl McpManager {
|
||||
pub fn new_with_extensions(
|
||||
plugins_manager: Arc<PluginsManager>,
|
||||
extensions: Arc<ExtensionRegistry<Config>>,
|
||||
codex_apps_tools_cache: ConnectorRuntimeManager<ToolInfo>,
|
||||
) -> Self {
|
||||
Self {
|
||||
connection_pool: codex_mcp::McpConnectionPool::default(),
|
||||
plugins_manager,
|
||||
extensions,
|
||||
codex_apps_tools_cache,
|
||||
tool_catalog_cache: McpToolCatalogCache::default(),
|
||||
shared_definitions: Arc::new(SharedMcpDefinitions::default()),
|
||||
ema_state: Arc::default(),
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn for_plugins_manager(&self, plugins_manager: Arc<PluginsManager>) -> Self {
|
||||
let mut manager = Self::new_with_extensions(
|
||||
plugins_manager,
|
||||
Arc::clone(&self.extensions),
|
||||
ConnectorRuntimeManager::default(),
|
||||
);
|
||||
let mut manager = Self::new_with_extensions(plugins_manager, Arc::clone(&self.extensions));
|
||||
manager.connection_pool = self.connection_pool.clone();
|
||||
manager
|
||||
}
|
||||
@@ -162,28 +145,6 @@ impl McpManager {
|
||||
self.plugins_manager.auth_manager()
|
||||
}
|
||||
|
||||
pub fn runtime_auth_for_config(
|
||||
&self,
|
||||
config: &Config,
|
||||
) -> Option<(
|
||||
codex_runtime_agent_instance::RuntimeAuthSlot,
|
||||
codex_features::RuntimeAuthMode,
|
||||
)> {
|
||||
config
|
||||
.features
|
||||
.enabled(Feature::RuntimeAgentInstances)
|
||||
.then(|| {
|
||||
(
|
||||
self.plugins_manager.runtime_auth_slot(),
|
||||
config.runtime_auth_mode,
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
pub fn codex_apps_tools_cache(&self) -> ConnectorRuntimeManager<ToolInfo> {
|
||||
self.codex_apps_tools_cache.clone()
|
||||
}
|
||||
|
||||
pub fn tool_catalog_cache(&self) -> McpToolCatalogCache {
|
||||
self.tool_catalog_cache.clone()
|
||||
}
|
||||
@@ -281,18 +242,6 @@ impl McpManager {
|
||||
});
|
||||
}
|
||||
}
|
||||
if context.config().features.enabled(Feature::Plugins) {
|
||||
for plugin_id in contributor.hosted_plugin_ids(context) {
|
||||
if !disabled_plugin_ids.contains(&plugin_id) {
|
||||
selected.plugins.push(SelectedPluginIdentity {
|
||||
selected_root_id: None,
|
||||
plugin_id: CatalogPluginIdentity::Remote {
|
||||
remote_plugin_id: plugin_id,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
selected
|
||||
}
|
||||
@@ -310,7 +259,6 @@ impl McpManager {
|
||||
{
|
||||
let mut mcp_config = config.to_mcp_config_with_loaded_plugins(&Default::default(), []);
|
||||
mcp_config.mcp_server_catalog = Default::default();
|
||||
mcp_config.apps_enabled = false;
|
||||
return McpRuntimeProjection {
|
||||
config: mcp_config,
|
||||
plugins_available: false,
|
||||
@@ -318,7 +266,6 @@ impl McpManager {
|
||||
};
|
||||
}
|
||||
let plugins_config = &config.plugins;
|
||||
let mut selected_plugin_connector_sources = Vec::new();
|
||||
let mut selected_plugin_registrations = Vec::new();
|
||||
let mut selected_plugins = Vec::new();
|
||||
let mut disabled_plugin_roots = Vec::new();
|
||||
@@ -374,18 +321,6 @@ impl McpManager {
|
||||
);
|
||||
}
|
||||
}
|
||||
// Disabled plugins still tell Apps which connectors to hide.
|
||||
if config.features.enabled(Feature::Plugins)
|
||||
&& !contribution.connector_ids.is_empty()
|
||||
{
|
||||
selected_plugin_connector_sources.push(
|
||||
PluginConnectorSource::from_connector_ids(
|
||||
plugin_id,
|
||||
contribution.plugin_display_name,
|
||||
contribution.connector_ids.into_iter().map(AppConnectorId),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
for contribution in contributor.contribute(context).await {
|
||||
@@ -415,45 +350,6 @@ impl McpManager {
|
||||
.with_protocol_mode(protocol_mode),
|
||||
)));
|
||||
}
|
||||
McpServerContribution::HostedApps {
|
||||
config,
|
||||
protocol_mode,
|
||||
} => {
|
||||
let mut registration = McpServerRegistration::from_hosted_apps(
|
||||
contributor.id(),
|
||||
contribution_order,
|
||||
*config,
|
||||
);
|
||||
if let Some(protocol_mode) = protocol_mode {
|
||||
registration = registration.with_protocol_mode(protocol_mode);
|
||||
}
|
||||
overlays.push(OrderedMcpOverlay::Set(Box::new(registration)));
|
||||
}
|
||||
McpServerContribution::HostedPluginConnectors {
|
||||
plugin_id,
|
||||
plugin_display_name,
|
||||
connector_ids,
|
||||
} => {
|
||||
if config.features.enabled(Feature::Plugins) {
|
||||
if !disabled_plugin_ids.contains(&plugin_id) {
|
||||
selected_plugins.push(SelectedPluginIdentity {
|
||||
selected_root_id: None,
|
||||
plugin_id: CatalogPluginIdentity::Remote {
|
||||
remote_plugin_id: plugin_id.clone(),
|
||||
},
|
||||
});
|
||||
}
|
||||
if !connector_ids.is_empty() {
|
||||
selected_plugin_connector_sources.push(
|
||||
PluginConnectorSource::from_connector_ids(
|
||||
plugin_id,
|
||||
plugin_display_name,
|
||||
connector_ids.into_iter().map(AppConnectorId),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
McpServerContribution::Remove { name } => {
|
||||
overlays.push(OrderedMcpOverlay::Remove {
|
||||
contributor_id: contributor.id(),
|
||||
@@ -470,30 +366,12 @@ impl McpManager {
|
||||
.plugins_manager
|
||||
.plugins_for_config(&config.plugins_config_input())
|
||||
.await;
|
||||
let host_plugin_connector_sources = loaded_plugins
|
||||
.capability_summaries()
|
||||
.iter()
|
||||
.map(PluginConnectorSource::from);
|
||||
let connector_snapshot = if config.features.enabled(Feature::Plugins) {
|
||||
self.plugins_manager.connector_snapshot(
|
||||
host_plugin_connector_sources.chain(selected_plugin_connector_sources),
|
||||
disabled_plugin_ids,
|
||||
)
|
||||
} else {
|
||||
Default::default()
|
||||
};
|
||||
let loaded_plugins = loaded_plugins.without_plugins(disabled_plugin_ids);
|
||||
let plugins_available =
|
||||
!selected_plugins.is_empty() || !loaded_plugins.capability_summaries().is_empty();
|
||||
let mut mcp_config = config
|
||||
.to_mcp_config_with_loaded_plugins(&loaded_plugins, selected_plugin_registrations);
|
||||
mcp_config.ema_state = Arc::clone(&self.ema_state);
|
||||
let mut catalog = mcp_config.mcp_server_catalog.to_builder();
|
||||
// aKode never registers the ChatGPT-hosted apps MCP server.
|
||||
catalog.remove_compatibility(
|
||||
CODEX_APPS_MCP_SERVER_NAME.to_string(),
|
||||
LEGACY_CODEX_APPS_REGISTRATION_ID,
|
||||
);
|
||||
|
||||
for overlay in overlays {
|
||||
match overlay {
|
||||
@@ -517,7 +395,6 @@ impl McpManager {
|
||||
);
|
||||
}
|
||||
mcp_config.mcp_server_catalog = catalog;
|
||||
mcp_config.connector_snapshot = connector_snapshot;
|
||||
McpRuntimeProjection {
|
||||
config: mcp_config,
|
||||
plugins_available,
|
||||
@@ -575,3 +452,17 @@ fn available_plugin_roots(context: McpServerContributionContext<'_, Config>) ->
|
||||
}
|
||||
roots
|
||||
}
|
||||
|
||||
/// Selects the reviewer for MCP tool approvals and elicitations. Managed requirements that force
|
||||
/// automatic review for the active model take precedence over the configured default.
|
||||
pub(crate) fn mcp_approvals_reviewer_from_layers(
|
||||
config_layer_stack: &codex_config::ConfigLayerStack,
|
||||
default_reviewer: codex_config::types::ApprovalsReviewer,
|
||||
model: Option<&str>,
|
||||
) -> codex_config::types::ApprovalsReviewer {
|
||||
let requirements = config_layer_stack.requirements();
|
||||
if model.is_some_and(|model| requirements.auto_review_required_for_model(model)) {
|
||||
return codex_config::types::ApprovalsReviewer::AutoReview;
|
||||
}
|
||||
default_reviewer
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user