mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Replace Sites migration state with a runtime compatibility guard (#46108)
## Why Older Desktop clients can still provide bundled Sites to an independently updated SSH app-server. A cached remote Sites install must take precedence, even when disabled, while a missing remote bundle must preserve the bundled fallback. ## What changed - Remove persisted bundled-plugin exclusions, Sites migration checks, and the migration wait when loading local plugin configuration. - Suppress `sites@openai-bundled` during plugin loading when the remote global catalog is active and a cached remote Sites install is available. - Remove exclusion-based catalog filtering and read/install guards, and simplify `install_plugin` to accept `ConfigLayerStack`. ## Testing Expand the agent-turn Sites test to cover enabled remote precedence, disabled remote suppression of bundled Sites, and fallback when the remote bundle is missing. GitOrigin-RevId: e2758596e5493ccee051cdfbf6b4afbe4f98948c
This commit is contained in:
1 parent
77c1feb00e
commit
108e6a6dbe
15 files changed
+41
-727
No files matched your search
@@ -1,5 +1,3 @@
|
||||
#[path = "bundled_plugin_exclusions.rs"]
|
||||
mod bundled_plugin_exclusions;
|
||||
#[path = "remote_mutations.rs"]
|
||||
mod remote_mutations;
|
||||
pub use remote_mutations::RemotePluginInstallOutcome;
|
||||
@@ -540,8 +538,6 @@ pub struct PluginsManager {
|
||||
skill_root_loader: Arc<dyn SkillRootLoader<PluginSkillRoot>>,
|
||||
tool_suggest_metadata_cache: ToolSuggestMetadataCache,
|
||||
remote_installed_plugins_cache: RwLock<RemoteInstalledPluginsCache>,
|
||||
// TODO(sites-migration): Remove this throttle together with the bundled Sites migration.
|
||||
sites_migration_checked_at: Mutex<Option<(PathBuf, Instant)>>,
|
||||
remote_installed_plugin_bundle_sync_gate: Arc<Semaphore>,
|
||||
remote_installed_plugins_cache_refresh_state: RwLock<RemoteInstalledPluginsCacheRefreshState>,
|
||||
remote_catalog_cache_refresh_state: RwLock<RemoteCatalogCacheRefreshState>,
|
||||
@@ -597,8 +593,6 @@ struct PluginLoadCacheKey {
|
||||
skill_config_rules: SkillConfigRules,
|
||||
remote_global_catalog_active: bool,
|
||||
auth_identity: Option<RemoteInstalledPluginsAuthIdentity>,
|
||||
// TODO(sites-migration): Remove once bundled Sites no longer needs scoped exclusions.
|
||||
excluded_plugin_ids: BTreeSet<String>,
|
||||
}
|
||||
|
||||
impl PluginLoadCacheKey {
|
||||
@@ -607,7 +601,6 @@ impl PluginLoadCacheKey {
|
||||
codex_home: &Path,
|
||||
remote_global_catalog_active: bool,
|
||||
auth_identity: RemoteInstalledPluginsAuthIdentity,
|
||||
excluded_plugin_ids: BTreeSet<String>,
|
||||
) -> Self {
|
||||
Self {
|
||||
configured_plugins: configured_plugins_from_stack(
|
||||
@@ -618,7 +611,6 @@ impl PluginLoadCacheKey {
|
||||
remote_global_catalog_active,
|
||||
// Local curated loads are auth-independent; only remote snapshots vary by account.
|
||||
auth_identity: remote_global_catalog_active.then_some(auth_identity),
|
||||
excluded_plugin_ids,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -680,7 +672,6 @@ impl PluginsManager {
|
||||
skill_root_loader,
|
||||
tool_suggest_metadata_cache: ToolSuggestMetadataCache::new(),
|
||||
remote_installed_plugins_cache: RwLock::new(RemoteInstalledPluginsCache::default()),
|
||||
sites_migration_checked_at: Mutex::new(None),
|
||||
remote_installed_plugin_bundle_sync_gate,
|
||||
remote_installed_plugins_cache_refresh_state: RwLock::new(
|
||||
RemoteInstalledPluginsCacheRefreshState::default(),
|
||||
@@ -759,7 +750,6 @@ impl PluginsManager {
|
||||
self.codex_home.as_path(),
|
||||
self.remote_global_catalog_active(config),
|
||||
RemoteInstalledPluginsAuthIdentity::from_auth(auth.as_ref()),
|
||||
self.excluded_bundled_plugin_ids(config),
|
||||
);
|
||||
self.loaded_plugins_cache
|
||||
.lock()
|
||||
@@ -795,12 +785,11 @@ impl PluginsManager {
|
||||
let auth = self.auth_manager.auth_cached();
|
||||
let auth_mode = auth.as_ref().map(CodexAuth::api_auth_mode);
|
||||
let auth_identity = RemoteInstalledPluginsAuthIdentity::from_auth(auth.as_ref());
|
||||
let mut cache_key = PluginLoadCacheKey::from_config(
|
||||
let cache_key = PluginLoadCacheKey::from_config(
|
||||
config,
|
||||
self.codex_home.as_path(),
|
||||
remote_global_catalog_active,
|
||||
auth_identity.clone(),
|
||||
self.excluded_bundled_plugin_ids(config),
|
||||
);
|
||||
if let Some(plugins) = self.cached_loaded_plugins(&cache_key) {
|
||||
let outcome = self.resolve_loaded_plugins_for_auth(plugins, auth_mode);
|
||||
@@ -833,8 +822,6 @@ impl PluginsManager {
|
||||
}
|
||||
continue;
|
||||
}
|
||||
// Migration may have changed the effective exclusion while this load was queued.
|
||||
cache_key.excluded_plugin_ids = self.excluded_bundled_plugin_ids(config);
|
||||
if let Some(plugins) = self.cached_loaded_plugins(&cache_key) {
|
||||
let outcome = self.resolve_loaded_plugins_for_auth(plugins, auth_mode);
|
||||
if *auth_change_receiver.borrow() == auth_revision {
|
||||
@@ -858,7 +845,6 @@ impl PluginsManager {
|
||||
self.restriction_product,
|
||||
remote_global_catalog_active,
|
||||
self.skill_root_loader.as_ref(),
|
||||
&cache_key.excluded_plugin_ids,
|
||||
)
|
||||
.await;
|
||||
loaded_cache_metrics::record_duration(
|
||||
@@ -975,7 +961,6 @@ impl PluginsManager {
|
||||
load_plugin_hooks_from_layer_stack(
|
||||
config_layer_stack,
|
||||
self.remote_installed_plugin_configs(),
|
||||
&self.excluded_bundled_plugin_ids(config),
|
||||
&self.store,
|
||||
target_curated_marketplace,
|
||||
self.remote_global_catalog_active(config),
|
||||
@@ -1288,7 +1273,6 @@ impl PluginsManager {
|
||||
generation,
|
||||
plugins,
|
||||
auth,
|
||||
&config.chatgpt_base_url,
|
||||
RemoteInstalledPluginsCachePublication::Refresh,
|
||||
) else {
|
||||
let auth_identity = RemoteInstalledPluginsAuthIdentity::from_auth(auth);
|
||||
@@ -1392,7 +1376,6 @@ impl PluginsManager {
|
||||
generation: u64,
|
||||
plugins: Vec<RemoteInstalledPlugin>,
|
||||
auth: Option<&CodexAuth>,
|
||||
service_base_url: &str,
|
||||
publication: RemoteInstalledPluginsCachePublication,
|
||||
) -> Option<bool> {
|
||||
let auth_identity = RemoteInstalledPluginsAuthIdentity::from_auth(auth);
|
||||
@@ -1425,11 +1408,8 @@ impl PluginsManager {
|
||||
cache.reconciliation_generation = None;
|
||||
cache.generation = cache.generation.wrapping_add(1);
|
||||
}
|
||||
// TODO(sites-migration): Remove exclusion publication once bundled Sites is retired.
|
||||
let exclusion_changed = self.update_sites_exclusion(service_base_url, auth, &plugins);
|
||||
let needs_effective_plugins_refresh = (is_reconcile
|
||||
&& std::mem::take(&mut cache.needs_effective_plugins_refresh))
|
||||
|| exclusion_changed;
|
||||
let needs_effective_plugins_refresh =
|
||||
is_reconcile && std::mem::take(&mut cache.needs_effective_plugins_refresh);
|
||||
if cache.plugins.as_ref() == Some(&plugins) {
|
||||
drop(cache);
|
||||
if needs_effective_plugins_refresh {
|
||||
@@ -1453,7 +1433,6 @@ impl PluginsManager {
|
||||
generation,
|
||||
plugins,
|
||||
auth.as_ref(),
|
||||
"",
|
||||
RemoteInstalledPluginsCachePublication::Refresh,
|
||||
)
|
||||
.expect("test cache generation should remain current")
|
||||
@@ -1738,7 +1717,6 @@ impl PluginsManager {
|
||||
generation,
|
||||
result.installed_plugins,
|
||||
auth,
|
||||
&config.chatgpt_base_url,
|
||||
RemoteInstalledPluginsCachePublication::Reconcile,
|
||||
) else {
|
||||
return Err(RemoteInstalledPluginBundleSyncError::Superseded);
|
||||
@@ -2039,10 +2017,10 @@ impl PluginsManager {
|
||||
|
||||
pub async fn install_plugin(
|
||||
&self,
|
||||
config: &PluginsConfigInput,
|
||||
config_layer_stack: &ConfigLayerStack,
|
||||
request: PluginInstallRequest,
|
||||
) -> Result<PluginInstallOutcome, PluginInstallError> {
|
||||
let resolved = self.resolve_installable_plugin(config, &request)?;
|
||||
let resolved = self.resolve_installable_plugin(config_layer_stack, &request)?;
|
||||
let plugin_id = resolved.plugin_id.clone();
|
||||
match self.install_resolved_plugin(resolved).await {
|
||||
Ok(outcome) => Ok(outcome),
|
||||
@@ -2060,7 +2038,7 @@ impl PluginsManager {
|
||||
|
||||
fn resolve_installable_plugin(
|
||||
&self,
|
||||
config: &PluginsConfigInput,
|
||||
config_layer_stack: &ConfigLayerStack,
|
||||
request: &PluginInstallRequest,
|
||||
) -> Result<ResolvedMarketplacePlugin, PluginInstallError> {
|
||||
let resolved = match find_installable_marketplace_plugin(
|
||||
@@ -2074,15 +2052,6 @@ impl PluginsManager {
|
||||
return Err(err.into());
|
||||
}
|
||||
};
|
||||
if self.bundled_sites_is_hidden(config, &resolved.plugin_id.as_key()) {
|
||||
let err = MarketplaceError::PluginNotFound {
|
||||
plugin_name: resolved.plugin_id.plugin_name,
|
||||
marketplace_name: resolved.plugin_id.marketplace_name,
|
||||
};
|
||||
self.track_plugin_install_resolution_failed(&err);
|
||||
return Err(err.into());
|
||||
}
|
||||
let config_layer_stack = &config.config_layer_stack;
|
||||
if let Err(message) =
|
||||
MarketplacePolicy::from_requirements(config_layer_stack.requirements())
|
||||
.validate_install(
|
||||
@@ -2108,7 +2077,7 @@ impl PluginsManager {
|
||||
auth: Option<&CodexAuth>,
|
||||
request: PluginInstallRequest,
|
||||
) -> Result<PluginInstallOutcome, PluginInstallError> {
|
||||
let resolved = self.resolve_installable_plugin(config, &request)?;
|
||||
let resolved = self.resolve_installable_plugin(&config.config_layer_stack, &request)?;
|
||||
let plugin_id = resolved.plugin_id.as_key();
|
||||
// This only forwards the backend mutation before the local install flow.
|
||||
if let Err(err) = crate::remote_legacy::enable_remote_plugin(
|
||||
@@ -2395,7 +2364,6 @@ impl PluginsManager {
|
||||
include_openai_curated: bool,
|
||||
plugin_states: &ConfiguredPluginStates,
|
||||
) -> Result<ConfiguredMarketplaceListOutcome, MarketplaceError> {
|
||||
let excluded_plugin_ids = self.excluded_bundled_plugin_ids(config);
|
||||
let marketplace_roots =
|
||||
self.marketplace_roots(config, additional_roots, include_openai_curated);
|
||||
let marketplace_outcome = self.list_marketplaces_with_policy(config, &marketplace_roots)?;
|
||||
@@ -2410,9 +2378,6 @@ impl PluginsManager {
|
||||
.into_iter()
|
||||
.filter_map(|plugin| {
|
||||
let plugin_key = format!("{}@{marketplace_name}", plugin.name);
|
||||
if excluded_plugin_ids.contains(&plugin_key) {
|
||||
return None;
|
||||
}
|
||||
if !seen_plugin_keys.insert(plugin_key.clone()) {
|
||||
return None;
|
||||
}
|
||||
@@ -2526,12 +2491,6 @@ impl PluginsManager {
|
||||
}
|
||||
|
||||
let plugin = find_marketplace_plugin(&request.marketplace_path, &request.plugin_name)?;
|
||||
if self.bundled_sites_is_hidden(config, &plugin.plugin_id.as_key()) {
|
||||
return Err(MarketplaceError::PluginNotFound {
|
||||
plugin_name: plugin.plugin_id.plugin_name,
|
||||
marketplace_name: plugin.plugin_id.marketplace_name,
|
||||
});
|
||||
}
|
||||
MarketplacePolicy::from_requirements(config.config_layer_stack.requirements())
|
||||
.validate_install(
|
||||
&config.config_layer_stack,
|
||||
@@ -3347,7 +3306,6 @@ impl PluginsManager {
|
||||
request.generation,
|
||||
plugins,
|
||||
request.auth.as_ref(),
|
||||
&request.service_config.chatgpt_base_url,
|
||||
RemoteInstalledPluginsCachePublication::Refresh,
|
||||
) else {
|
||||
continue;
|
||||
|
||||
Reference in new issue
Block a user