diff --git a/codex-rs/core-plugins/src/loader_tests.rs b/codex-rs/core-plugins/src/loader_tests.rs index 897c840432..7711261ac6 100644 --- a/codex-rs/core-plugins/src/loader_tests.rs +++ b/codex-rs/core-plugins/src/loader_tests.rs @@ -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( diff --git a/codex-rs/core/tests/suite/plugins.rs b/codex-rs/core/tests/suite/plugins.rs index 04b502888b..2e33888a3a 100644 --- a/codex-rs/core/tests/suite/plugins.rs +++ b/codex-rs/core/tests/suite/plugins.rs @@ -716,7 +716,7 @@ async fn agent_plugin_root_mcp_stdio_tool_round_trip_expands_reserved_paths_and_ overlay_call_id, "mcp__agent", "echo", - r#"{"message":"ping","env_var":"PATH"}"#, + r#"{"message":"ping","env_var":"INSTA_WORKSPACE_ROOT"}"#, ), ev_completed("resp-3"), ]), @@ -748,10 +748,7 @@ async fn agent_plugin_root_mcp_stdio_tool_round_trip_expands_reserved_paths_and_ "agent": { "type": "stdio", "command": format!("./{stdio_server_name}"), - "env": { - "MCP_TEST_VALUE": "${PLUGIN_ROOT}|${PLUGIN_DATA}", - "PATH": "${PATH}" - } + "env": {"MCP_TEST_VALUE": "${PLUGIN_ROOT}|${PLUGIN_DATA}"} } } }); @@ -762,7 +759,7 @@ async fn agent_plugin_root_mcp_stdio_tool_round_trip_expands_reserved_paths_and_ std::fs::create_dir_all(plugin_root.join(".codex-plugin"))?; std::fs::write( plugin_root.join(".codex-plugin/plugin.json"), - r#"{"name":"acme.tools","mcpServers":{"agent":{"command":"ignored","env_vars":["PATH"]}}}"#, + r#"{"name":"acme.tools","mcpServers":{"agent":{"command":"ignored","env_vars":["INSTA_WORKSPACE_ROOT"]}}}"#, )?; let mut builder = test_codex().with_home(Arc::clone(&codex_home)); let test_codex = builder.build_with_remote_and_local_env(&server).await?; @@ -824,7 +821,7 @@ async fn agent_plugin_root_mcp_stdio_tool_round_trip_expands_reserved_paths_and_ .as_ref() .and_then(|content| content.get("env")) .and_then(serde_json::Value::as_str), - Some(std::env::var("PATH")?.as_str()) + Some(std::env::var("INSTA_WORKSPACE_ROOT")?.as_str()) ); let requests = mock.requests(); let search_output = requests[1].tool_search_output(search_call_id);