Honor managed plugin disablement for executor capabilities (#40640)

## Why

Selected executor plugin roots could still expose capabilities when managed
requirements disabled the `plugins` feature.

## What changed

- Suppress MCP servers, skills, apps, and connectors from selected executor
  plugins when `plugins` is disabled, while preserving the selected-root
  identity used to filter those capabilities.
- Apply the policy consistently to direct selected-root discovery and batched
  executor capability discovery.

## Testing

- Add contributor-level and app-server coverage that verifies disabled plugin
  capabilities are absent and their MCP servers never start.

GitOrigin-RevId: e30bd8a936c4b0e083908b89a65f4d02e01747de
This commit is contained in:
hefuc-oai authored and copyberry committed 2026-08-25 16:47:13 +00:00
1 parent e44bd9b64d
commit 5ce04789fb
6 files changed
+162 -1

No files matched your search

+8
View File
@@ -17,6 +17,7 @@ use codex_extension_api::McpServerContribution;
use codex_extension_api::McpServerContributionContext;
use codex_extension_api::SelectedPluginIdentity;
use codex_extension_api::SelectedPluginSnapshot;
use codex_features::Feature;
use codex_login::CodexAuth;
use codex_mcp::CODEX_APPS_MCP_SERVER_NAME;
use codex_mcp::EffectiveMcpServer;
@@ -160,6 +161,7 @@ impl McpManager {
let mut selected_plugin_connector_sources = Vec::new();
let mut selected_plugin_registrations = Vec::new();
let mut selected_plugins = Vec::new();
let mut disabled_plugin_roots = Vec::new();
let mut overlays = Vec::new();
// A contributor can emit multiple ordered actions, so order each action globally rather
// than enumerating contributors.
@@ -200,6 +202,11 @@ impl McpManager {
*config,
),
),
McpServerContribution::SelectedPluginPackage {
selected_root_id, ..
} if !config.features.enabled(Feature::Plugins) => {
disabled_plugin_roots.push(selected_root_id);
}
McpServerContribution::SelectedPluginPackage {
selected_root_id,
plugin_id,
@@ -322,6 +329,7 @@ impl McpManager {
plugins_available,
selected_plugins: SelectedPluginSnapshot {
plugins: selected_plugins,
disabled_plugin_roots,
},
}
}