Gate plugin recommendation cache warming on feature flags (#60721)

## Why

Background plugin cache refreshes fetched recommendations even when plugin recommendations were disabled.

## What changed

Pass the effective recommendation feature state into `PluginsConfigInput` and skip recommendation cache warming unless apps, plugins, and either `tool_suggest` or `recommended_plugins` are enabled. Installed-plugin cache refreshes continue independently.

Disable `tool_suggest` and `recommended_plugins` by default in core and app-server test helpers, with explicit overrides for recommendation tests.

## Testing

Update cache-warming and external-login recommendation tests to opt in explicitly. Update config RPC assertions to verify the test helpers' session flag overrides.

GitOrigin-RevId: dc04e2847c94e2b15842fcd95cc0cf1f104e1fac
This commit is contained in:
Alex Daley
2026-11-11 05:38:52 +00:00
committed by copyberry
parent 5228d94a27
commit fe2f185208
13 changed files with 104 additions and 89 deletions
+11
View File
@@ -175,6 +175,7 @@ pub struct PluginsConfigInput {
pub remote_plugin_enabled: bool,
pub chatgpt_base_url: String,
pub product_sku: Option<String>,
plugin_recommendations_enabled: bool,
http_client_factory: HttpClientFactory,
remote_http_clients: Arc<OnceLock<Arc<dyn HttpClientSelector>>>,
runtime_http_clients: Arc<OnceLock<Arc<dyn HttpClientSelector>>>,
@@ -203,12 +204,18 @@ impl PluginsConfigInput {
chatgpt_base_url,
http_client_factory,
product_sku,
plugin_recommendations_enabled: false,
remote_http_clients: Arc::new(OnceLock::new()),
runtime_http_clients: Arc::new(OnceLock::new()),
runtime_auth_mode: None,
}
}
pub fn with_plugin_recommendations_enabled(mut self, enabled: bool) -> Self {
self.plugin_recommendations_enabled = enabled;
self
}
pub fn with_runtime_auth_mode(mut self, mode: Option<RuntimeAuthMode>) -> Self {
self.runtime_auth_mode = mode;
self
@@ -1699,6 +1706,10 @@ impl PluginsManager {
EffectivePluginsChange::default(),
);
if !config.plugin_recommendations_enabled {
return;
}
let manager = Arc::clone(self);
let config = config.clone();
tokio::spawn(async move {
+3 -1
View File
@@ -6151,7 +6151,9 @@ plugins = true
.mount(&server)
.await;
let mut config = load_config(tmp.path(), tmp.path()).await;
let mut config = load_config(tmp.path(), tmp.path())
.await
.with_plugin_recommendations_enabled(/*enabled*/ true);
config.chatgpt_base_url = server.uri();
let manager = std::sync::Arc::new(test_plugins_manager(tmp.path().to_path_buf()));
let auth = CodexAuth::create_dummy_chatgpt_auth_for_testing();