@@ -10,6 +10,7 @@ use crate::config_loader::load_config_layers_state;
1010use crate :: features:: Feature ;
1111use crate :: features:: FeatureOverrides ;
1212use crate :: features:: Features ;
13+ use codex_utils_absolute_path:: AbsolutePathBuf ;
1314use serde:: Deserialize ;
1415use serde_json:: Map as JsonMap ;
1516use serde_json:: Value as JsonValue ;
@@ -28,7 +29,7 @@ const DEFAULT_MCP_CONFIG_FILE: &str = ".mcp.json";
2829pub struct LoadedPlugin {
2930 pub config_name : String ,
3031 pub manifest_name : Option < String > ,
31- pub root : PathBuf ,
32+ pub root : AbsolutePathBuf ,
3233 pub enabled : bool ,
3334 pub skill_roots : Vec < PathBuf > ,
3435 pub mcp_servers : HashMap < String , McpServerConfig > ,
@@ -86,6 +87,9 @@ impl PluginsManager {
8687 }
8788
8889 pub fn plugins_for_config ( & self , config : & Config ) -> PluginLoadOutcome {
90+ // Plugins are currently global-only. Even when callers pass a session
91+ // config stack that may include cwd/tree/repo/runtime layers, plugin
92+ // configuration is resolved from the user layer only.
8993 if !config. features . enabled ( Feature :: Plugins ) {
9094 let mut cache = match self . cache . write ( ) {
9195 Ok ( cache) => cache,
@@ -275,7 +279,7 @@ fn configured_plugins_from_stack(
275279}
276280
277281fn load_plugin ( config_name : String , plugin : & PluginConfig ) -> LoadedPlugin {
278- let plugin_root = plugin. path . to_path_buf ( ) ;
282+ let plugin_root = plugin. path . clone ( ) ;
279283 let mut loaded_plugin = LoadedPlugin {
280284 config_name,
281285 manifest_name : None ,
@@ -295,16 +299,16 @@ fn load_plugin(config_name: String, plugin: &PluginConfig) -> LoadedPlugin {
295299 return loaded_plugin;
296300 }
297301
298- let Some ( manifest) = load_plugin_manifest ( & plugin_root) else {
302+ let Some ( manifest) = load_plugin_manifest ( plugin_root. as_path ( ) ) else {
299303 loaded_plugin. error = Some ( "missing or invalid .codex-plugin/plugin.json" . to_string ( ) ) ;
300304 return loaded_plugin;
301305 } ;
302306
303- loaded_plugin. manifest_name = Some ( plugin_manifest_name ( & manifest, & plugin_root) ) ;
304- loaded_plugin. skill_roots = default_skill_roots ( & plugin_root) ;
307+ loaded_plugin. manifest_name = Some ( plugin_manifest_name ( & manifest, plugin_root. as_path ( ) ) ) ;
308+ loaded_plugin. skill_roots = default_skill_roots ( plugin_root. as_path ( ) ) ;
305309 let mut mcp_servers = HashMap :: new ( ) ;
306- for mcp_config_path in default_mcp_config_paths ( & plugin_root) {
307- let plugin_mcp = load_mcp_servers_from_file ( & plugin_root, & mcp_config_path) ;
310+ for mcp_config_path in default_mcp_config_paths ( plugin_root. as_path ( ) ) {
311+ let plugin_mcp = load_mcp_servers_from_file ( plugin_root. as_path ( ) , & mcp_config_path) ;
308312 for ( name, config) in plugin_mcp. mcp_servers {
309313 if mcp_servers. insert ( name. clone ( ) , config) . is_some ( ) {
310314 warn ! (
0 commit comments