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
+13
View File
@@ -1357,6 +1357,19 @@ async fn remote_plugin_listing_replaces_local_curated_catalog() -> Result<()> {
sample@openai-curated-remote installed, enabled 1.2.3 b1234567-89ab-4cde-8f01-234567890abc
");
let config_path = fixture.home.path().join(CONFIG_TOML_FILE);
let mut config = std::fs::read_to_string(&config_path)?;
config.push_str(&format!("\n[plugins.\"{PLUGIN_KEY}\"]\nenabled = false\n"));
std::fs::write(config_path, config)?;
let mut expected: Value = serde_json::from_str(&listed)?;
expected["installed"][0]["enabled"] = json!(false);
let disabled = fixture
.success(&["plugin", "list", "--available", "--json"])
.await?;
assert_eq!(serde_json::from_str::<Value>(&disabled)?, expected);
let table = fixture.success(&["plugin", "list"]).await?;
assert!(table.contains("installed, disabled"), "{table}");
fixture.server.reset().await;
let listed = fixture
.success(&["plugin", "list", "-m", "openai-curated", "--json"])