diff --git a/codex-rs/core/src/config/config_tests.rs b/codex-rs/core/src/config/config_tests.rs index 9fc8c2643f..664730805a 100644 --- a/codex-rs/core/src/config/config_tests.rs +++ b/codex-rs/core/src/config/config_tests.rs @@ -8769,6 +8769,58 @@ path = "/custom/mcp" Ok(()) } +#[tokio::test] +async fn config_defaults_enabled_apps_mcp_path_override_to_plugin_service() -> std::io::Result<()> { + let codex_home = TempDir::new()?; + let toml = r#" +model = "gpt-5.4" + +[features] +apps_mcp_path_override = true +"#; + let cfg: ConfigToml = + toml::from_str(toml).expect("TOML deserialization should succeed for apps MCP feature"); + + let config = Config::load_from_base_config_with_overrides( + cfg, + ConfigOverrides::default(), + codex_home.abs(), + ) + .await?; + + assert!(config.features.enabled(Feature::AppsMcpPathOverride)); + assert_eq!(config.apps_mcp_path_override.as_deref(), Some("/ps/mcp")); + Ok(()) +} + +#[tokio::test] +async fn config_preserves_explicit_apps_mcp_path_override_path() -> std::io::Result<()> { + let codex_home = TempDir::new()?; + let toml = r#" +model = "gpt-5.4" + +[features.apps_mcp_path_override] +enabled = true +path = "/custom/mcp" +"#; + let cfg: ConfigToml = + toml::from_str(toml).expect("TOML deserialization should succeed for apps MCP feature"); + + let config = Config::load_from_base_config_with_overrides( + cfg, + ConfigOverrides::default(), + codex_home.abs(), + ) + .await?; + + assert_eq!( + config.apps_mcp_path_override.as_deref(), + Some("/custom/mcp") + ); + assert!(config.features.enabled(Feature::AppsMcpPathOverride)); + Ok(()) +} + #[tokio::test] async fn config_loads_mcp_oauth_callback_url_from_toml() -> std::io::Result<()> { let codex_home = TempDir::new()?; diff --git a/codex-rs/core/src/config/mod.rs b/codex-rs/core/src/config/mod.rs index 3b4e674446..2071e1ed25 100644 --- a/codex-rs/core/src/config/mod.rs +++ b/codex-rs/core/src/config/mod.rs @@ -2615,6 +2615,7 @@ impl Config { .and_then(|config| config.path.as_ref()) .or_else(|| base.and_then(|config| config.path.as_ref())) .cloned() + .or_else(|| Some("/ps/mcp".to_string())) } else { None };