Skip to content

Commit c6498db

Browse files
committed
Honor configured enablement for remote plugins
1 parent 752420b commit c6498db

2 files changed

Lines changed: 39 additions & 2 deletions

File tree

codex-rs/core-plugins/src/loader.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@ fn merge_remote_plugin_config(
320320
mut remote_plugin_config: PluginConfig,
321321
) {
322322
if let Some(configured_plugin) = configured_plugins.get(&plugin_key) {
323+
remote_plugin_config.enabled = configured_plugin.enabled;
323324
remote_plugin_config
324325
.mcp_servers
325326
.clone_from(&configured_plugin.mcp_servers);

codex-rs/core-plugins/src/manager_tests.rs

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,6 +1175,40 @@ output_token_limit = 12000
11751175
);
11761176
}
11771177

1178+
#[tokio::test]
1179+
async fn remote_installed_plugin_preserves_configured_enablement() {
1180+
let codex_home = TempDir::new().unwrap();
1181+
write_cached_plugin(codex_home.path(), REMOTE_GLOBAL_MARKETPLACE_NAME, "linear");
1182+
write_file(
1183+
&codex_home.path().join(CONFIG_TOML_FILE),
1184+
r#"[features]
1185+
plugins = true
1186+
1187+
[plugins."linear@openai-curated-remote"]
1188+
enabled = false
1189+
"#,
1190+
);
1191+
1192+
let config = load_config(codex_home.path(), codex_home.path()).await;
1193+
let manager = test_plugins_manager_with_options(
1194+
codex_home.path().to_path_buf(),
1195+
Some(Product::Codex),
1196+
Some(AuthMode::Chatgpt),
1197+
);
1198+
manager.write_remote_installed_plugins_cache(vec![remote_installed_linear_plugin()]);
1199+
1200+
let outcome = manager.plugins_for_config(&config).await;
1201+
1202+
assert_eq!(
1203+
outcome
1204+
.plugins()
1205+
.iter()
1206+
.map(|plugin| (plugin.config_name.as_str(), plugin.enabled))
1207+
.collect::<Vec<_>>(),
1208+
vec![("linear@openai-curated-remote", false)]
1209+
);
1210+
}
1211+
11781212
#[tokio::test]
11791213
async fn remote_installed_plugin_preserves_configured_mcp_server_policy() {
11801214
let codex_home = TempDir::new().unwrap();
@@ -1199,7 +1233,7 @@ async fn remote_installed_plugin_preserves_configured_mcp_server_policy() {
11991233
plugins = true
12001234
12011235
[plugins."linear@openai-curated-remote"]
1202-
enabled = false
1236+
enabled = true
12031237
12041238
[plugins."linear@openai-curated-remote".mcp_servers.linear]
12051239
enabled = false
@@ -1218,7 +1252,9 @@ approval_mode = "approve"
12181252
Some(Product::Codex),
12191253
Some(AuthMode::Chatgpt),
12201254
);
1221-
manager.write_remote_installed_plugins_cache(vec![remote_installed_linear_plugin()]);
1255+
let mut remote_plugin = remote_installed_linear_plugin();
1256+
remote_plugin.enabled = false;
1257+
manager.write_remote_installed_plugins_cache(vec![remote_plugin]);
12221258

12231259
let outcome = manager.plugins_for_config(&config).await;
12241260
let plugin = outcome

0 commit comments

Comments
 (0)