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
+8
View File
@@ -331,6 +331,13 @@ pub(crate) async fn test_config() -> Config {
Config::load_from_base_config_with_overrides(
ConfigToml {
model: Some("gpt-5.5".to_string()),
features: Some(
BTreeMap::from([
(Feature::ToolSuggest.key().to_string(), false),
(Feature::RecommendedPlugins.key().to_string(), false),
])
.into(),
),
..Default::default()
},
ConfigOverrides::default(),
@@ -1890,6 +1897,7 @@ impl Config {
self.http_client_factory(),
self.apps_mcp_product_sku.clone(),
)
.with_plugin_recommendations_enabled(self.features.plugin_recommendations_enabled())
.with_runtime_auth_mode(
(self.features.enabled(Feature::RuntimeAgentInstances)
&& codex_runtime_agent_instance::is_openai_api_url(&self.chatgpt_base_url))
+10 -2
View File
@@ -17,6 +17,7 @@ use codex_core::config::ConfigBuilder;
use codex_core::config::ConfigOverrides;
pub use codex_core::test_support::TestCodexResponsesRequestKind;
pub use codex_core::test_support::responses_metadata;
use codex_features::Feature;
use codex_utils_absolute_path::AbsolutePathBuf;
pub use codex_utils_absolute_path::test_support::PathBufExt;
pub use codex_utils_absolute_path::test_support::PathExt;
@@ -213,14 +214,21 @@ pub async fn load_default_config_for_test_with_cloud_config_bundle(
codex_home: &TempDir,
cloud_config_bundle: CloudConfigBundleLoader,
) -> Config {
ConfigBuilder::default()
let mut config = ConfigBuilder::default()
.loader_overrides(LoaderOverrides::without_managed_config_for_tests())
.codex_home(codex_home.path().to_path_buf())
.harness_overrides(default_test_overrides())
.cloud_config_bundle(cloud_config_bundle)
.build()
.await
.expect("defaults for test should always succeed")
.expect("defaults for test should always succeed");
for feature in [Feature::ToolSuggest, Feature::RecommendedPlugins] {
config
.features
.disable(feature)
.expect("test config should allow disabling plugin recommendations");
}
config
}
pub fn managed_network_requirements_loader() -> CloudConfigBundleLoader {
@@ -2,9 +2,9 @@
#![cfg(test)]
use anyhow::Result;
use codex_core::config::ConfigBuilder;
use codex_login::CodexAuth;
use codex_models_manager::bundled_models_response;
use core_test_support::load_default_config_for_test;
use core_test_support::responses;
use core_test_support::test_codex::test_codex;
use pretty_assertions::assert_eq;
@@ -49,10 +49,7 @@ model_catalog_url = "https://chatgpt.com/backend-api/codex/models"
inference.uri(),
),
)?;
let mut loaded = ConfigBuilder::default()
.codex_home(home.path().to_path_buf())
.build()
.await?;
let mut loaded = load_default_config_for_test(&home).await;
assert_eq!(
loaded
.model_provider