Strengthen Agent Plugin MCP environment overlay tests (#40410)

## What changed

- Cover forwarding a legacy `env_vars` entry when the portable MCP server has no `env` map.
- Use the test workspace variable instead of `PATH` in the stdio round-trip test, keeping overlay forwarding distinct from portable environment expansion.

GitOrigin-RevId: c5cfb333e553581fc856d43a04e5be0abd9f65ef
This commit is contained in:
jif
2026-08-24 14:37:48 +00:00
committed by copyberry
parent 77b30a21e1
commit cd25b81c65
2 changed files with 7 additions and 12 deletions
+3 -5
View File
@@ -116,7 +116,7 @@ async fn agent_plugin_codex_mcp_overlay_only_forwards_matching_stdio_server_env_
}
#[tokio::test]
async fn agent_plugin_codex_mcp_overlay_supports_inline_legacy_servers() {
async fn agent_plugin_codex_mcp_overlay_supports_inline_legacy_servers_without_portable_env() {
let temp_dir = TempDir::new().expect("tempdir");
let plugin_root = temp_dir.path().join("plugin");
write_file(
@@ -130,8 +130,7 @@ async fn agent_plugin_codex_mcp_overlay_supports_inline_legacy_servers() {
"mcpServers": {
"shared": {
"type": "stdio",
"command": "portable-server",
"env": {"TOKEN": "${TOKEN}"}
"command": "portable-server"
}
}
}"#,
@@ -139,13 +138,12 @@ async fn agent_plugin_codex_mcp_overlay_supports_inline_legacy_servers() {
let mut expected = load_plugin_mcp_servers(&plugin_root, /*auth_mode*/ None).await;
let Some(McpServerConfig {
transport: McpServerTransportConfig::Stdio { env, env_vars, .. },
transport: McpServerTransportConfig::Stdio { env_vars, .. },
..
}) = expected.get_mut("shared")
else {
panic!("expected portable stdio server");
};
env.as_mut().expect("portable environment").remove("TOKEN");
env_vars.push("TOKEN".into());
write_file(