Relax remote plugin sync gate (#22594)

## Summary
- Allow remote installed-plugin cache refresh to start whenever plugins
are enabled.
- Allow remote installed-plugin bundle sync to start whenever plugins
are enabled.
- Remove the extra local `remote_plugin_enabled` guard from those
background sync paths.

## Context
Server-side installed plugin state and optional bundle URL behavior are
owned by plugin-service `/public/plugins/installed`, so these local sync
paths only need the overall plugin enablement gate.

## Test plan
- `just fmt`
- `cargo test -p codex-core-plugins`
This commit is contained in:
xli-oai
2026-05-14 03:38:30 +00:00
committed by GitHub
parent 35451ba79c
commit 9797296564
5 changed files with 88 additions and 36 deletions
+22 -31
View File
@@ -494,7 +494,7 @@ impl PluginsManager {
let outcome = load_plugins_from_layer_stack(
&config.config_layer_stack,
self.remote_installed_plugin_configs(config),
self.remote_installed_plugin_configs(),
&self.store,
self.restriction_product,
plugin_hooks_enabled,
@@ -542,7 +542,7 @@ impl PluginsManager {
}
load_plugins_from_layer_stack(
config_layer_stack,
self.remote_installed_plugin_configs(config),
self.remote_installed_plugin_configs(),
&self.store,
self.restriction_product,
plugin_hooks_feature_enabled,
@@ -585,14 +585,7 @@ impl PluginsManager {
}
}
fn remote_installed_plugin_configs(
&self,
config: &PluginsConfigInput,
) -> HashMap<String, PluginConfig> {
if !config.remote_plugin_enabled {
return HashMap::new();
}
fn remote_installed_plugin_configs(&self) -> HashMap<String, PluginConfig> {
let cache = match self.remote_installed_plugins_cache.read() {
Ok(cache) => cache,
Err(err) => err.into_inner(),
@@ -667,7 +660,7 @@ impl PluginsManager {
notify: RemoteInstalledPluginsCacheRefreshNotify,
on_effective_plugins_changed: Option<Arc<dyn Fn() + Send + Sync + 'static>>,
) {
if !config.plugins_enabled || !config.remote_plugin_enabled {
if !config.plugins_enabled {
return;
}
@@ -687,7 +680,7 @@ impl PluginsManager {
auth: Option<CodexAuth>,
on_effective_plugins_changed: Option<Arc<dyn Fn() + Send + Sync + 'static>>,
) {
if !config.plugins_enabled || !config.remote_plugin_enabled {
if !config.plugins_enabled {
return;
}
@@ -1504,25 +1497,23 @@ impl PluginsManager {
auth_manager.clone(),
);
if config.remote_plugin_enabled {
let config = config.clone();
let manager = Arc::clone(self);
let auth_manager = auth_manager.clone();
let on_effective_plugins_changed = on_effective_plugins_changed.clone();
tokio::spawn(async move {
let auth = auth_manager.auth().await;
manager.maybe_start_remote_installed_plugins_cache_refresh(
&config,
auth.clone(),
on_effective_plugins_changed.clone(),
);
manager.maybe_start_remote_installed_plugin_bundle_sync(
&config,
auth,
on_effective_plugins_changed,
);
});
}
let config_for_remote_sync = config.clone();
let manager = Arc::clone(self);
let auth_manager_for_remote_sync = auth_manager.clone();
let on_effective_plugins_changed = on_effective_plugins_changed.clone();
tokio::spawn(async move {
let auth = auth_manager_for_remote_sync.auth().await;
manager.maybe_start_remote_installed_plugins_cache_refresh(
&config_for_remote_sync,
auth.clone(),
on_effective_plugins_changed.clone(),
);
manager.maybe_start_remote_installed_plugin_bundle_sync(
&config_for_remote_sync,
auth,
on_effective_plugins_changed,
);
});
let config = config.clone();
let manager = Arc::clone(self);
+1 -2
View File
@@ -331,7 +331,7 @@ approval_mode = "approve"
}
#[tokio::test]
async fn remote_installed_cache_adds_plugin_skill_roots_without_marketplace_config() {
async fn remote_installed_cache_adds_plugin_skill_roots_without_remote_plugin_flag() {
let codex_home = TempDir::new().unwrap();
let plugin_base = codex_home
.path()
@@ -341,7 +341,6 @@ async fn remote_installed_cache_adds_plugin_skill_roots_without_marketplace_conf
&codex_home.path().join(CONFIG_TOML_FILE),
r#"[features]
plugins = true
remote_plugin = true
"#,
);