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:
@@ -4,8 +4,6 @@ use std::ffi::OsString;
|
||||
use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::auth::McpAuthProvider;
|
||||
use crate::mcp::CODEX_APPS_MCP_SERVER_NAME;
|
||||
use crate::runtime::McpRuntimeContext;
|
||||
use codex_config::AppToolApproval;
|
||||
use codex_config::McpServerAuth;
|
||||
@@ -14,9 +12,7 @@ use codex_config::McpServerOAuthConfig;
|
||||
use codex_config::McpServerTransportConfig;
|
||||
use codex_config::types::AuthKeyringBackendKind;
|
||||
use codex_config::types::OAuthCredentialsStoreMode;
|
||||
use codex_connectors::ConnectorRuntimeContextKey;
|
||||
use codex_exec_server::Environment;
|
||||
use codex_login::CodexAuth;
|
||||
use codex_protocol::mcp::ClientMcpExtensions;
|
||||
use codex_rmcp_client::McpOAuthRefreshMode;
|
||||
use codex_rmcp_client::McpProtocolMode;
|
||||
@@ -87,16 +83,9 @@ impl EffectiveMcpServer {
|
||||
|
||||
/// Checks whether Core can discover the protocol of a local stdio server.
|
||||
///
|
||||
/// The reserved `codex_apps` server has a per-chat catalog. Servers with runtime or
|
||||
/// enterprise-managed credentials need that chat's authentication state.
|
||||
pub(crate) fn can_discover_local_stdio(
|
||||
&self,
|
||||
server_name: &str,
|
||||
runtime_auth_provider: Option<&McpAuthProvider>,
|
||||
) -> bool {
|
||||
server_name != CODEX_APPS_MCP_SERVER_NAME
|
||||
&& self.config.is_local_environment()
|
||||
&& runtime_auth_provider.is_none()
|
||||
/// Servers that selected the removed enterprise-managed authorization never start.
|
||||
pub(crate) fn can_discover_local_stdio(&self) -> bool {
|
||||
self.config.is_local_environment()
|
||||
&& !matches!(self.config.auth, McpServerAuth::EmaAuth)
|
||||
&& self
|
||||
.stdio_protocol_mode(McpProtocolMode::DiscoverLocalStdio)
|
||||
@@ -176,10 +165,6 @@ pub(crate) struct McpServerConnectionIdentity {
|
||||
resolved_environment: Result<Option<Arc<Environment>>, String>,
|
||||
local_stdio_fallback_cwd: Option<PathBuf>,
|
||||
referenced_environment_variables: Vec<(String, Option<OsString>)>,
|
||||
runtime_auth: Option<CodexAuth>,
|
||||
runtime_auth_token: Option<String>,
|
||||
runtime_auth_mode: Option<codex_features::RuntimeAuthMode>,
|
||||
codex_apps_cache_identity: Option<(PathBuf, ConnectorRuntimeContextKey)>,
|
||||
client_elicitation_capability: ElicitationCapability,
|
||||
client_mcp_extensions: ClientMcpExtensions,
|
||||
agent_plugin: bool,
|
||||
@@ -197,11 +182,7 @@ impl McpServerConnectionIdentity {
|
||||
oauth_refresh_mode: McpOAuthRefreshMode,
|
||||
resolved_environment: &Result<Option<Arc<Environment>>, String>,
|
||||
runtime_context: &McpRuntimeContext,
|
||||
runtime_auth_provider: Option<&McpAuthProvider>,
|
||||
runtime_auth_mode: Option<codex_features::RuntimeAuthMode>,
|
||||
auth: Option<&CodexAuth>,
|
||||
codex_apps_cache_identity: Option<(PathBuf, ConnectorRuntimeContextKey)>,
|
||||
client_elicitation_capability: ElicitationCapability,
|
||||
client_elicitation_capability: ElicitationCapability,
|
||||
client_mcp_extensions: ClientMcpExtensions,
|
||||
previous_identity: Option<&Self>,
|
||||
) -> Self {
|
||||
@@ -211,8 +192,7 @@ impl McpServerConnectionIdentity {
|
||||
.bytes()
|
||||
.all(|byte| byte == b'\t' || (byte >= b' ' && byte != 0x7f))
|
||||
};
|
||||
let stored_oauth_url = if runtime_auth_provider.is_none()
|
||||
&& !matches!(config.auth, McpServerAuth::EmaAuth)
|
||||
let stored_oauth_url = if !matches!(config.auth, McpServerAuth::EmaAuth)
|
||||
&& (!matches!(config.auth, McpServerAuth::ChatGpt) || config.is_local_environment())
|
||||
{
|
||||
match &config.transport {
|
||||
@@ -282,8 +262,6 @@ impl McpServerConnectionIdentity {
|
||||
McpCredentialPolicy::HostFallbackAllowed => referenced_environment_variables(config),
|
||||
McpCredentialPolicy::ExecutorOnly => Vec::new(),
|
||||
};
|
||||
let runtime_auth = runtime_auth_provider.and(auth).cloned();
|
||||
let runtime_auth_token = runtime_auth.as_ref().and_then(|auth| auth.get_token().ok());
|
||||
let oauth_store_was_contended = oauth_credentials
|
||||
.as_ref()
|
||||
.ok()
|
||||
@@ -306,10 +284,6 @@ impl McpServerConnectionIdentity {
|
||||
resolved_environment: resolved_environment.clone(),
|
||||
local_stdio_fallback_cwd,
|
||||
referenced_environment_variables,
|
||||
runtime_auth,
|
||||
runtime_auth_token,
|
||||
runtime_auth_mode,
|
||||
codex_apps_cache_identity,
|
||||
client_elicitation_capability,
|
||||
client_mcp_extensions,
|
||||
agent_plugin: server.is_agent_plugin(),
|
||||
@@ -318,19 +292,6 @@ impl McpServerConnectionIdentity {
|
||||
}
|
||||
|
||||
pub(crate) fn has_same_connection_config(&self, other: &Self) -> bool {
|
||||
let same_runtime_auth = match (&self.runtime_auth, &other.runtime_auth) {
|
||||
(Some(CodexAuth::AgentIdentity(left)), Some(CodexAuth::AgentIdentity(right))) => {
|
||||
left.record() == right.record()
|
||||
}
|
||||
(Some(left), Some(right)) => {
|
||||
left == right
|
||||
&& left.get_account_id() == right.get_account_id()
|
||||
&& left.get_chatgpt_user_id() == right.get_chatgpt_user_id()
|
||||
&& left.is_fedramp_account() == right.is_fedramp_account()
|
||||
}
|
||||
(None, None) => true,
|
||||
(Some(_), None) | (None, Some(_)) => false,
|
||||
};
|
||||
self.auth == other.auth
|
||||
&& self.credential_policy == other.credential_policy
|
||||
&& self.transport == other.transport
|
||||
@@ -346,10 +307,6 @@ impl McpServerConnectionIdentity {
|
||||
&& same_resolved_environment(&self.resolved_environment, &other.resolved_environment)
|
||||
&& self.local_stdio_fallback_cwd == other.local_stdio_fallback_cwd
|
||||
&& self.referenced_environment_variables == other.referenced_environment_variables
|
||||
&& same_runtime_auth
|
||||
&& self.runtime_auth_token == other.runtime_auth_token
|
||||
&& self.runtime_auth_mode == other.runtime_auth_mode
|
||||
&& self.codex_apps_cache_identity == other.codex_apps_cache_identity
|
||||
&& self.client_elicitation_capability == other.client_elicitation_capability
|
||||
&& self.client_mcp_extensions == other.client_mcp_extensions
|
||||
&& self.agent_plugin == other.agent_plugin
|
||||
|
||||
Reference in New Issue
Block a user