mirror of
https://github.com/openai/codex.git
synced 2026-10-23 18:08:45 +00:00
Fix enterprise MCP credential selection and reauthentication (#55859)
## What changed - Prefer an eligible account grant over saved enterprise credentials, with a fallback to saved enterprise sign-in during initial connection if the account grant is rejected. - Remember rejected account grants per enterprise MCP registration across threads and report authentication failures as requiring reauthentication. Keep administrator configuration errors distinct from sign-in failures. - Compare account grants independently of access and ID token rotation, recheck the latest identity eligibility after exchange, and retry once when the refresh grant changes. - Make MCP authentication status reflect usable account grants, saved enterprise credentials, and completed connection failures. ## Testing Extend regression coverage for enterprise sign-in failures and recovery, MCP authentication status, account grant identity across token refreshes, and retries after transient credential failures. GitOrigin-RevId: eeac65f668d5d2d55e9d8bf4547fbcbdd6a6c42d
This commit is contained in:
@@ -1878,6 +1878,7 @@ impl Config {
|
||||
requires_read_only_mcp_tools: false,
|
||||
codex_home: self.codex_home.to_path_buf(),
|
||||
mcp_enterprise_managed_auth: self.mcp_enterprise_managed_auth.clone(),
|
||||
ema_state: Default::default(),
|
||||
mcp_ema_cancellation: self.config_layer_stack.mcp_ema_cancellation().clone(),
|
||||
xaa_enabled: self.features.enabled(Feature::UseXaa)
|
||||
&& self.mcp_enterprise_managed_auth.is_some(),
|
||||
|
||||
@@ -116,6 +116,7 @@ pub struct McpManager {
|
||||
codex_apps_tools_cache: ConnectorRuntimeManager<ToolInfo>,
|
||||
tool_catalog_cache: McpToolCatalogCache,
|
||||
shared_definitions: Arc<SharedMcpDefinitions>,
|
||||
ema_state: Arc<codex_mcp::EmaState>,
|
||||
}
|
||||
|
||||
impl McpManager {
|
||||
@@ -139,6 +140,7 @@ impl McpManager {
|
||||
codex_apps_tools_cache,
|
||||
tool_catalog_cache: McpToolCatalogCache::default(),
|
||||
shared_definitions: Arc::new(SharedMcpDefinitions::default()),
|
||||
ema_state: Arc::default(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -457,6 +459,7 @@ impl McpManager {
|
||||
!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();
|
||||
// Isolated sessions do not inherit the implicit Apps connection.
|
||||
if mcp_config.apps_enabled
|
||||
|
||||
Reference in New Issue
Block a user