Respect config layers when removing plugin marketplaces (#40683)

## Why

Removing a base-user marketplace must not delete a snapshot that is still
referenced by another enabled configuration layer.

## What changed

- Load the current configuration stack for marketplace commands in the CLI and
  app server.
- Reject removal when a matching marketplace is defined by another enabled
  layer, and identify the configuration source that must be updated instead.
- Allow cleanup of an installed marketplace snapshot even when no base-user
  entry exists.

## Testing

Cover project, enterprise-managed, system, and session-flag configurations, as
well as snapshot-only removal through the CLI and app server.

GitOrigin-RevId: 4f0853a40c2b5fae0410696b79eee4284239c7a9
This commit is contained in:
willwang-openai
2026-08-25 19:38:39 +00:00
committed by copyberry
parent f1a6f7c9b3
commit a6e63f9f32
7 changed files with 253 additions and 47 deletions
@@ -51,8 +51,10 @@ impl MarketplaceRequestProcessor {
&self,
params: MarketplaceRemoveParams,
) -> Result<MarketplaceRemoveResponse, JSONRPCErrorError> {
let config = self.load_latest_config(/*fallback_cwd*/ None).await?;
remove_marketplace(
self.config.codex_home.to_path_buf(),
config.codex_home.to_path_buf(),
config.config_layer_stack,
CoreMarketplaceRemoveRequest {
marketplace_name: params.marketplace_name,
},