mirror of
https://github.com/openai/codex.git
synced 2026-11-21 15:10:25 +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
@@ -1374,6 +1374,7 @@ const MCP_TOOL_APPROVAL_CANCEL: &str = "Cancel";
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize)]
|
||||
struct McpToolApprovalKey {
|
||||
server: String,
|
||||
plugin_id: Option<String>,
|
||||
connector_id: Option<String>,
|
||||
link_id: Option<String>,
|
||||
tool_name: String,
|
||||
@@ -1642,6 +1643,7 @@ fn session_mcp_tool_approval_key(
|
||||
|
||||
Some(McpToolApprovalKey {
|
||||
server: invocation.server.clone(),
|
||||
plugin_id: metadata.and_then(|metadata| metadata.plugin_id.clone()),
|
||||
connector_id,
|
||||
link_id: metadata.and_then(|metadata| metadata.link_id.clone()),
|
||||
tool_name: invocation.tool.clone(),
|
||||
@@ -2154,7 +2156,13 @@ async fn maybe_persist_mcp_tool_approval(
|
||||
};
|
||||
persist_codex_app_tool_approval(&turn_context.config, &connector_id, &tool_name).await
|
||||
} else {
|
||||
persist_non_app_mcp_tool_approval(sess, &turn_context.config, &key.server, &tool_name).await
|
||||
persist_non_app_mcp_tool_approval(
|
||||
&turn_context.config,
|
||||
&key.server,
|
||||
&tool_name,
|
||||
key.plugin_id.as_deref(),
|
||||
)
|
||||
.await
|
||||
};
|
||||
|
||||
if let Err(err) = persist_result {
|
||||
@@ -2207,33 +2215,22 @@ async fn persist_custom_mcp_tool_approval(
|
||||
}
|
||||
|
||||
async fn persist_non_app_mcp_tool_approval(
|
||||
sess: &Session,
|
||||
config: &Config,
|
||||
server: &str,
|
||||
tool_name: &str,
|
||||
plugin_id: Option<&str>,
|
||||
) -> anyhow::Result<()> {
|
||||
if let Some(config_edits_builder) = custom_mcp_tool_approval_config_builder(config, server)? {
|
||||
return persist_custom_mcp_tool_approval_with(config_edits_builder, server, tool_name)
|
||||
.await;
|
||||
}
|
||||
|
||||
let plugin_config_name = sess
|
||||
.services
|
||||
.plugins_manager
|
||||
.plugins_for_config(&config.plugins_config_input())
|
||||
.await
|
||||
.plugins()
|
||||
.iter()
|
||||
.filter(|plugin| plugin.is_active())
|
||||
.find(|plugin| plugin.mcp_servers.contains_key(server))
|
||||
.map(|plugin| plugin.config_name.clone());
|
||||
|
||||
if let Some(plugin_config_name) = plugin_config_name {
|
||||
if let Some(plugin_id) = plugin_id {
|
||||
return ConfigEditsBuilder::for_config(config)
|
||||
.with_edits([ConfigEdit::SetPath {
|
||||
segments: vec![
|
||||
"plugins".to_string(),
|
||||
plugin_config_name,
|
||||
plugin_id.to_string(),
|
||||
"mcp_servers".to_string(),
|
||||
server.to_string(),
|
||||
"tools".to_string(),
|
||||
|
||||
Reference in new issue
Block a user