diff --git a/codex-rs/core/src/external_agent_config.rs b/codex-rs/core/src/external_agent_config.rs index bf86acdeb1..46ddde3b0f 100644 --- a/codex-rs/core/src/external_agent_config.rs +++ b/codex-rs/core/src/external_agent_config.rs @@ -621,7 +621,6 @@ fn collect_enabled_plugins(settings: &JsonValue) -> Vec { } fn configured_plugin_ids(codex_home: &Path) -> io::Result> { - let mut plugin_states = BTreeMap::new(); let config_path = codex_home.join("config.toml"); if !config_path.is_file() { return Ok(HashSet::new()); @@ -638,16 +637,7 @@ fn configured_plugin_ids(codex_home: &Path) -> io::Result> { return Ok(HashSet::new()); }; - for (plugin_id, enabled) in plugins.iter().filter_map(|(plugin_id, plugin_config)| { - plugin_config - .get("enabled") - .and_then(TomlValue::as_bool) - .map(|enabled| (plugin_id, enabled)) - }) { - plugin_states.insert(plugin_id.clone(), enabled); - } - - Ok(plugin_states.into_keys().collect()) + Ok(plugins.keys().cloned().collect()) } fn configured_marketplace_plugins( diff --git a/codex-rs/core/src/external_agent_config_tests.rs b/codex-rs/core/src/external_agent_config_tests.rs index 0ee2da0df8..94c7acc48b 100644 --- a/codex-rs/core/src/external_agent_config_tests.rs +++ b/codex-rs/core/src/external_agent_config_tests.rs @@ -555,6 +555,47 @@ enabled = false assert_eq!(items, Vec::::new()); } +#[test] +fn detect_repo_skips_plugins_without_explicit_enabled_in_codex() { + let root = TempDir::new().expect("create tempdir"); + let claude_home = root.path().join(".claude"); + let codex_home = root.path().join(".codex"); + let repo_root = root.path().join("repo"); + fs::create_dir_all(repo_root.join(".git")).expect("create git dir"); + fs::create_dir_all(repo_root.join(".claude")).expect("create repo claude dir"); + fs::create_dir_all(&codex_home).expect("create codex home"); + fs::write( + repo_root.join(".claude").join("settings.json"), + r#"{ + "enabledPlugins": { + "formatter@acme-tools": true + }, + "extraKnownMarketplaces": { + "acme-tools": { + "source": "acme-corp/claude-plugins" + } + } + }"#, + ) + .expect("write repo settings"); + fs::write( + codex_home.join("config.toml"), + r#" +[plugins."formatter@acme-tools"] +"#, + ) + .expect("write codex config"); + + let items = service_for_paths(claude_home, codex_home) + .detect(ExternalAgentConfigDetectOptions { + include_home: false, + cwds: Some(vec![repo_root]), + }) + .expect("detect"); + + assert_eq!(items, Vec::::new()); +} + #[tokio::test] async fn import_plugins_requires_details() { let (_root, claude_home, codex_home) = fixture_paths();