mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Honor thread-level plugin exclusions across runtime capabilities (#44655)
## What changed - Apply `disabled_plugin_ids` to plugin skills, recommendations, hooks, and MCP servers without modifying shared plugin state. - Activate selection changes when the next task starts, keeping pending settings from changing the active runtime. - Hide app tools contributed only by disabled plugins from model tool catalogs and search. Preserve connectors shared with enabled plugins and existing direct Apps RPC behavior. - Include plugin identity in MCP approval keys and use that identity when persisting plugin tool approvals. ## Testing Add regression coverage for disabling and re-enabling plugin skills and tools, deferred activation of settings, shared connector ownership, selected plugin servers, executor hooks, and plugin-specific approval keys and persistence. GitOrigin-RevId: 1153ff6aa7ab6953d50e838da05203904ecd2956
This commit is contained in:
1 parent
5c94936b56
commit
8570091e14
27 files changed
+565
-171
No files matched your search
@@ -36,7 +36,7 @@ use crate::elicitation::ElicitationRequestManager;
|
||||
use crate::elicitation::ElicitationRequestRouter;
|
||||
use crate::event_stream::EventStreamConnectionSettings;
|
||||
use crate::mcp::CODEX_APPS_MCP_SERVER_NAME;
|
||||
use crate::mcp::ToolPluginProvenance;
|
||||
use crate::mcp::ToolPluginContext;
|
||||
use crate::pagination::MAX_CODEX_APPS_TOOL_CATALOG_ITEMS;
|
||||
use crate::pagination::MAX_MCP_CATALOG_ITEMS;
|
||||
use crate::rmcp_client::AsyncManagedClient;
|
||||
@@ -170,14 +170,14 @@ struct McpServerView {
|
||||
impl McpServerView {
|
||||
async fn listed_tools(
|
||||
&self,
|
||||
tool_plugin_provenance: &ToolPluginProvenance,
|
||||
tool_plugin_context: &ToolPluginContext,
|
||||
) -> Result<Vec<ToolInfo>, StartupOutcomeError> {
|
||||
let tools = self.connection.client.listed_tools().await?;
|
||||
let tools = filter_tools(tools, &self.tool_filter);
|
||||
Ok(if self.connection.client.is_codex_apps_mcp_server {
|
||||
prepare_codex_apps_tools_for_model(tools, tool_plugin_provenance)
|
||||
prepare_codex_apps_tools_for_model(tools, tool_plugin_context)
|
||||
} else {
|
||||
prepare_regular_mcp_tools_for_model(tools, tool_plugin_provenance)
|
||||
prepare_regular_mcp_tools_for_model(tools, tool_plugin_context)
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -189,7 +189,7 @@ pub(crate) struct McpConnectionSet {
|
||||
disabled_servers: Vec<String>,
|
||||
required_servers: Vec<String>,
|
||||
optional_startup_deadline: OnceLock<tokio::time::Instant>,
|
||||
tool_plugin_provenance: Arc<ToolPluginProvenance>,
|
||||
tool_plugin_context: Arc<ToolPluginContext>,
|
||||
prefix_mcp_tool_names: bool,
|
||||
non_prefixed_mcp_tool_servers: Vec<String>,
|
||||
elicitation_requests: ElicitationRequestManager,
|
||||
@@ -234,7 +234,7 @@ impl McpConnectionSet {
|
||||
let default_protocol_mode = config.protocol_mode;
|
||||
let host_owned_apps_protocol_mode = config.host_owned_apps_protocol_mode;
|
||||
let client_elicitation_capability = config.client_elicitation_capability.clone();
|
||||
let tool_plugin_provenance = crate::mcp::tool_plugin_provenance(&config);
|
||||
let tool_plugin_context = crate::mcp::tool_plugin_context(&config);
|
||||
let auth = auth.as_ref();
|
||||
let mut servers = HashMap::new();
|
||||
let mut event_stream_connection = None;
|
||||
@@ -272,7 +272,7 @@ impl McpConnectionSet {
|
||||
elicitation_router,
|
||||
)
|
||||
};
|
||||
let tool_plugin_provenance = Arc::new(tool_plugin_provenance);
|
||||
let tool_plugin_context = Arc::new(tool_plugin_context);
|
||||
let startup_submit_id = submit_id;
|
||||
let static_chatgpt_auth_provider = auth
|
||||
.filter(|auth| auth.uses_codex_backend())
|
||||
@@ -601,7 +601,7 @@ impl McpConnectionSet {
|
||||
catalog_item_limit,
|
||||
);
|
||||
let defer_startup = allow_deferred_startup
|
||||
&& !tool_plugin_provenance.is_selected_plugin_mcp_server(&server_name)
|
||||
&& !tool_plugin_context.is_selected_plugin_mcp_server(&server_name)
|
||||
&& async_managed_client
|
||||
.tool_catalog_cache_context
|
||||
.as_ref()
|
||||
@@ -755,7 +755,7 @@ impl McpConnectionSet {
|
||||
disabled_servers,
|
||||
required_servers,
|
||||
optional_startup_deadline: OnceLock::new(),
|
||||
tool_plugin_provenance,
|
||||
tool_plugin_context,
|
||||
prefix_mcp_tool_names,
|
||||
non_prefixed_mcp_tool_servers,
|
||||
elicitation_requests: elicitation_requests.clone(),
|
||||
@@ -813,7 +813,7 @@ impl McpConnectionSet {
|
||||
disabled_servers: Vec::new(),
|
||||
required_servers: Vec::new(),
|
||||
optional_startup_deadline: OnceLock::new(),
|
||||
tool_plugin_provenance: Arc::new(ToolPluginProvenance::default()),
|
||||
tool_plugin_context: Arc::new(ToolPluginContext::default()),
|
||||
prefix_mcp_tool_names,
|
||||
non_prefixed_mcp_tool_servers: Vec::new(),
|
||||
elicitation_requests: ElicitationRequestManager::default(),
|
||||
@@ -915,12 +915,12 @@ impl McpConnectionSet {
|
||||
}
|
||||
|
||||
pub fn plugin_id_for_mcp_server_name(&self, server_name: &str) -> Option<&str> {
|
||||
self.tool_plugin_provenance
|
||||
self.tool_plugin_context
|
||||
.plugin_id_for_mcp_server_name(server_name)
|
||||
}
|
||||
|
||||
pub fn is_selected_plugin_mcp_server(&self, server_name: &str) -> bool {
|
||||
self.tool_plugin_provenance
|
||||
self.tool_plugin_context
|
||||
.is_selected_plugin_mcp_server(server_name)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user