Honor explicit plugin disablement without a global default (#63468)

## Why

Without `plugins._default`, the activation policy ignored a plugin's explicit `enabled = false`. The CLI also reported remote plugin enablement directly from the marketplace, so its output could disagree with the effective state.

## What changed

Apply per-plugin enablement before falling back to `plugins._default.enabled`. The `codex plugin list` command now applies that policy to remote plugins, so an installed plugin can appear as disabled while retaining its installation and account settings. Plugins disabled at their source stay disabled.

## Testing

Cover explicit disablement without a global default in config and remote plugin loading tests, and check that the CLI reports the plugin as installed and disabled in both JSON and table output.

GitOrigin-RevId: ab9f5a5b36150d7350c2d11a8421f9e14524a1ad
This commit is contained in:
Matthew Zeng
2026-11-23 23:39:54 +00:00
committed by copyberry
parent 56bb44c05c
commit d4af2452f7
6 changed files with 30 additions and 24 deletions
+2 -5
View File
@@ -1389,9 +1389,6 @@ async fn remote_installed_plugin_preserves_configured_mcp_server_policy() {
r#"[features]
plugins = true
[plugins."linear@openai-curated-remote"]
enabled = false
[plugins."linear@openai-curated-remote".mcp_servers.linear]
enabled = false
default_tools_approval_mode = "approve"
@@ -3447,11 +3444,11 @@ async fn plugin_defaults_resolve_remote_enablement_and_separate_cache_entries()
"[plugins._default]\nenabled = false\n[plugins.\"sample@openai-curated-remote\".mcp_servers.example]\ndefault_tools_approval_mode = 'approve'",
Vec::new(),
),
// Without the new default, legacy remote account enablement still wins.
(
"[plugins.\"sample@openai-curated-remote\"]\nenabled = false",
vec![other, sample],
vec![other],
),
("", vec![other, sample]),
] {
write_file(&config_path, policy);
let config = load_config(codex_home.path(), codex_home.path()).await;