[codex] Prune stale curated plugin caches (#26934)

Curated plugin startup refresh now removes cached plugins whose names no
longer appear in the raw openai-curated marketplace. This prevents users
with the old standalone Google Sheets plugin selected locally from
continuing to load its stale cache after the curated repo drops it.

Existing config is left untouched, and plugins still present in the
marketplace continue to refresh from local curated sources.

Validation:
- `just fmt`
- `just test -p codex-core-plugins`
- `git diff --check`
This commit is contained in:
xl-openai authored and GitHub committed 2026-06-08 14:46:59 -07:00
1 parent b89d91f6ff
commit daf76a57d2
3 files changed
+65 -18

No files matched your search

@@ -3039,6 +3039,33 @@ fn refresh_curated_plugin_cache_reinstalls_missing_configured_plugin_with_curren
);
}
#[test]
fn refresh_curated_plugin_cache_removes_cache_for_plugin_removed_from_marketplace() {
let tmp = tempfile::tempdir().unwrap();
let curated_root = curated_plugins_repo_path(tmp.path());
write_openai_curated_marketplace(&curated_root, &[]);
let plugin_id = PluginId::new(
"google-sheets".to_string(),
OPENAI_CURATED_MARKETPLACE_NAME.to_string(),
)
.unwrap();
let plugin_cache_root = tmp
.path()
.join("plugins/cache/openai-curated/google-sheets");
write_plugin(
&tmp.path().join("plugins/cache/openai-curated"),
&format!("google-sheets/{TEST_CURATED_PLUGIN_CACHE_VERSION}"),
"google-sheets",
);
assert!(
refresh_curated_plugin_cache(tmp.path(), TEST_CURATED_PLUGIN_SHA, &[plugin_id])
.expect("cache refresh should remove stale configured plugin")
);
assert!(!plugin_cache_root.exists());
}
#[test]
fn curated_plugin_ids_from_config_keys_reads_latest_codex_home_user_config() {
let tmp = tempfile::tempdir().unwrap();