Lightweight coding agent that runs in your terminal
Rust
Remove redundant Codex Apps cache guard (#29575)
Ahmed Ibrahim83c4934e45d2
diff --git a/codex-rs/codex-mcp/src/codex_apps.rs b/codex-rs/codex-mcp/src/codex_apps.rsindex 53b546b8a0..437e750de8 100644--- a/codex-rs/codex-mcp/src/codex_apps.rs+++ b/codex-rs/codex-mcp/src/codex_apps.rs@@ -8,7 +8,6 @@use std::path::PathBuf;use std::time::Instant;-use crate::mcp::CODEX_APPS_MCP_SERVER_NAME;use crate::runtime::emit_duration;use crate::tools::MCP_TOOLS_CACHE_WRITE_DURATION_METRIC;use crate::tools::ToolInfo;@@ -125,16 +124,11 @@ pub(crate) fn normalize_codex_apps_callable_namespace(}}-pub(crate) fn write_cached_codex_apps_tools_if_needed(- server_name: &str,+pub(crate) fn write_codex_apps_tools_cache(cache_context: Option<&CodexAppsToolsCacheContext>,server_info: &McpServerInfo,tools: &[ToolInfo],) {- if server_name != CODEX_APPS_MCP_SERVER_NAME {- return;- }-if let Some(cache_context) = cache_context {let cache_write_start = Instant::now();write_cached_codex_apps_tools(cache_context, tools);diff --git a/codex-rs/codex-mcp/src/connection_manager.rs b/codex-rs/codex-mcp/src/connection_manager.rsindex a881e865d2..be27843071 100644--- a/codex-rs/codex-mcp/src/connection_manager.rs+++ b/codex-rs/codex-mcp/src/connection_manager.rs@@ -16,7 +16,7 @@ use std::time::Instant;use crate::McpAuthStatusEntry;use crate::codex_apps::CodexAppsToolsCacheContext;use crate::codex_apps::CodexAppsToolsCacheKey;-use crate::codex_apps::write_cached_codex_apps_tools_if_needed;+use crate::codex_apps::write_codex_apps_tools_cache;use crate::elicitation::ElicitationRequestManager;use crate::elicitation::ElicitationReviewerHandle;use crate::mcp::CODEX_APPS_MCP_SERVER_NAME;@@ -521,8 +521,7 @@ impl McpConnectionManager {&[],);- write_cached_codex_apps_tools_if_needed(- CODEX_APPS_MCP_SERVER_NAME,+ write_codex_apps_tools_cache(managed_client.codex_apps_tools_cache_context.as_ref(),&managed_client.server_info,&tools,diff --git a/codex-rs/codex-mcp/src/connection_manager_tests.rs b/codex-rs/codex-mcp/src/connection_manager_tests.rsindex 05b3917027..4556973928 100644--- a/codex-rs/codex-mcp/src/connection_manager_tests.rs+++ b/codex-rs/codex-mcp/src/connection_manager_tests.rs@@ -5,7 +5,7 @@ use crate::codex_apps::load_startup_cached_codex_apps_server_info;use crate::codex_apps::load_startup_cached_codex_apps_tools_snapshot;use crate::codex_apps::read_cached_codex_apps_tools;use crate::codex_apps::write_cached_codex_apps_tools;-use crate::codex_apps::write_cached_codex_apps_tools_if_needed;+use crate::codex_apps::write_codex_apps_tools_cache;use crate::declared_openai_file_input_param_names;use crate::elicitation::ElicitationRequestManager;use crate::elicitation::elicitation_is_rejected_by_policy;@@ -704,12 +704,7 @@ fn startup_cached_codex_apps_tools_loads_from_disk_cache() {"calendar_search",)];let server_info = create_test_server_info("Codex Apps");- write_cached_codex_apps_tools_if_needed(- CODEX_APPS_MCP_SERVER_NAME,- Some(&cache_context),- &server_info,- &cached_tools,- );+ write_codex_apps_tools_cache(Some(&cache_context), &server_info, &cached_tools);let startup_tools = load_startup_cached_codex_apps_tools_snapshot(Some(&cache_context)).expect("expected startup snapshot to load from cache");@@ -758,8 +753,7 @@ fn codex_apps_server_info_cache_survives_legacy_tools_cache_write() {Some("user-one"),);let server_info = create_test_server_info("Codex Apps");- write_cached_codex_apps_tools_if_needed(- CODEX_APPS_MCP_SERVER_NAME,+ write_codex_apps_tools_cache(Some(&cache_context),&server_info,&[create_test_tool(diff --git a/codex-rs/codex-mcp/src/rmcp_client.rs b/codex-rs/codex-mcp/src/rmcp_client.rsindex f8173b6003..f9cc6a5e81 100644--- a/codex-rs/codex-mcp/src/rmcp_client.rs+++ b/codex-rs/codex-mcp/src/rmcp_client.rs@@ -25,7 +25,7 @@ use crate::codex_apps::load_startup_cached_codex_apps_tools_snapshot;use crate::codex_apps::normalize_codex_apps_callable_name;use crate::codex_apps::normalize_codex_apps_callable_namespace;use crate::codex_apps::normalize_codex_apps_tool_title;-use crate::codex_apps::write_cached_codex_apps_tools_if_needed;+use crate::codex_apps::write_codex_apps_tools_cache;use crate::elicitation::ElicitationRequestManager;use crate::mcp::CODEX_APPS_MCP_SERVER_NAME;use crate::mcp::ToolPluginProvenance;@@ -581,8 +581,7 @@ async fn start_server_task();let server_info = mcp_server_info_from_implementation(initialize_result.server_info);let codex_apps_tools_cache_context = if is_codex_apps_mcp_server {- write_cached_codex_apps_tools_if_needed(- &server_name,+ write_codex_apps_tools_cache(codex_apps_tools_cache_context.as_ref(),&server_info,&tools,