mirror of
https://github.com/openai/codex.git
synced 2026-11-08 00:36:31 +00:00
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:
1 parent
e44bd9b64d
commit
5ce04789fb
6 files changed
+162
-1
No files matched your search
@@ -157,6 +157,61 @@ async fn selected_plugin_package_is_contributed_without_servers_or_connectors()
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn managed_plugins_requirement_disables_selected_executor_plugin_capabilities() -> TestResult
|
||||
{
|
||||
let codex_home = tempfile::tempdir()?;
|
||||
let plugin_root = tempfile::tempdir()?;
|
||||
std::fs::create_dir_all(plugin_root.path().join(".codex-plugin"))?;
|
||||
std::fs::write(
|
||||
plugin_root.path().join(".codex-plugin/plugin.json"),
|
||||
r#"{"name":"selected-root","interface":{"displayName":"Selected Root"}}"#,
|
||||
)?;
|
||||
std::fs::write(
|
||||
plugin_root.path().join(".mcp.json"),
|
||||
r#"{"mcpServers":{"probe":{"command":"probe-command"}}}"#,
|
||||
)?;
|
||||
let mut config = ConfigBuilder::default()
|
||||
.codex_home(codex_home.path().to_path_buf())
|
||||
.fallback_cwd(Some(codex_home.path().to_path_buf()))
|
||||
.cloud_config_bundle(
|
||||
CloudConfigBundleFixture::loader_with_enterprise_requirement(
|
||||
r#"
|
||||
[features]
|
||||
plugins = false
|
||||
"#,
|
||||
),
|
||||
)
|
||||
.build()
|
||||
.await?;
|
||||
assert!(!config.features.enabled(Feature::Plugins));
|
||||
|
||||
let direct = raw_selected_plugin_contributions(&config, plugin_root.path()).await?;
|
||||
assert!(
|
||||
matches!(
|
||||
direct.as_slice(),
|
||||
[McpServerContribution::SelectedPluginPackage { selected_root_id, .. }]
|
||||
if selected_root_id == "selected-root"
|
||||
),
|
||||
"managed Plugins disable should preserve only the direct selected-root identity"
|
||||
);
|
||||
|
||||
config
|
||||
.features
|
||||
.enable(Feature::ExecutorCapabilityDiscovery)
|
||||
.expect("test config should allow feature update");
|
||||
let discovered = raw_selected_plugin_contributions(&config, plugin_root.path()).await?;
|
||||
assert!(
|
||||
matches!(
|
||||
discovered.as_slice(),
|
||||
[McpServerContribution::SelectedPluginPackage { selected_root_id, .. }]
|
||||
if selected_root_id == "selected-root"
|
||||
),
|
||||
"managed Plugins disable should preserve only the discovered selected-root identity"
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn high_level_discovery_matches_the_existing_plugin_provider() -> TestResult {
|
||||
let codex_home = tempfile::tempdir()?;
|
||||
|
||||
Reference in new issue
Block a user