Simplify plugin MCP approval policy tests (#63614)

## What changed

Use a manifest default of `writes` and a user override of `prompt`
in the plugin manager test to verify that the user setting takes
precedence. Remove the standalone tool-call approval test and keep
the regression test that checks a per-tool override after the plugin
cache has been warmed.

GitOrigin-RevId: 667e613729e47507030308646d5adc5b5794e2c2
This commit is contained in:
jif
2026-11-24 11:19:24 +00:00
committed by copyberry
parent abc92e6bd4
commit 1f43c02f3f
2 changed files with 3 additions and 43 deletions
+3 -3
View File
@@ -1316,7 +1316,7 @@ async fn load_plugins_applies_plugin_mcp_server_policy() {
"sample": {
"type": "http",
"url": "https://sample.example/mcp",
"default_tools_approval_mode": "prompt",
"default_tools_approval_mode": "writes",
"enabled_tools": ["read", "search"],
"tools": {
"search": { "approval_mode": "prompt", "output_token_limit": 8000 }
@@ -1334,7 +1334,7 @@ enabled = true
[plugins."sample@test".mcp_servers.sample]
enabled = false
default_tools_approval_mode = "approve"
default_tools_approval_mode = "prompt"
enabled_tools = ["search"]
disabled_tools = ["delete"]
@@ -1353,7 +1353,7 @@ output_token_limit = 12000
assert!(!server.enabled);
assert_eq!(
server.default_tools_approval_mode,
Some(AppToolApproval::Approve)
Some(AppToolApproval::Prompt)
);
assert_eq!(server.enabled_tools, Some(vec!["search".to_string()]));
assert_eq!(server.disabled_tools, Some(vec!["delete".to_string()]));
-40
View File
@@ -2820,46 +2820,6 @@ async fn persist_custom_mcp_tool_approval_writes_tool_override() {
assert!(contents.contains("[mcp_servers.docs.tools.search]"));
}
#[tokio::test]
async fn custom_mcp_tool_approval_mode_uses_plugin_mcp_policy() {
let (session, mut turn_context) = make_session_and_context().await;
let codex_home = session.codex_home().await;
write_sample_plugin_mcp(codex_home.as_path());
std::fs::write(
codex_home.join(CONFIG_TOML_FILE),
r#"
[features]
plugins = true
[plugins."sample@test"]
enabled = true
[plugins."sample@test".mcp_servers.sample]
default_tools_approval_mode = "prompt"
[plugins."sample@test".mcp_servers.sample.tools.search]
approval_mode = "approve"
"#,
)
.expect("seed config");
let config = ConfigBuilder::default()
.codex_home(codex_home.to_path_buf())
.build()
.await
.expect("load config");
turn_context.config = Arc::new(config);
session.services.plugins_manager.clear_cache();
assert_eq!(
custom_mcp_tool_approval_mode(&session, &turn_context, "sample", "read").await,
AppToolApproval::Prompt
);
assert_eq!(
custom_mcp_tool_approval_mode(&session, &turn_context, "sample", "search").await,
AppToolApproval::Approve
);
}
#[tokio::test]
async fn custom_mcp_tool_approval_mode_uses_updated_plugin_mcp_policy_after_cache_warm() {
let (session, mut turn_context) = make_session_and_context().await;