Honor per-repository plugin configuration in catalog requests (#41208)

## What changed

- Load the effective plugin configuration for every requested `cwd` in
  `plugin/list` and `plugin/installed`.
- Combine local marketplaces in request order, keeping the first source for
  duplicates while merging installed and enabled state across repositories.
- Report invalid project configurations through `marketplaceLoadErrors` without
  dropping valid local catalogs or globally enabled remote catalogs.
- Use the combined marketplace context for forced and background cache refreshes,
  while keeping remote plugin feature gating request-wide.

## Testing

- Cover distinct and duplicate marketplaces, cross-repository enabled state,
  invalid project configuration, local cache refresh, and global versus
  project-local feature flags.

GitOrigin-RevId: 53c8e0e9c760dc2b969ab10d0e63fb439673c230
This commit is contained in:
willwang-openai authored and copyberry committed 2026-08-27 21:10:10 +00:00
1 parent 19321435b1
commit c4c51c56e4
8 files changed
+802 -208

No files matched your search

@@ -1,4 +1,11 @@
use super::*;
use codex_core::config::ConfigOverrides;
use codex_core_plugins::PluginMarketplaceContext;
use codex_core_plugins::PluginMarketplaceScope;
use codex_core_plugins::marketplace::MarketplaceListError;
use futures::StreamExt;
const CONFIG_LOAD_CONCURRENCY: usize = 5;
impl PluginRequestProcessor {
pub(super) async fn load_catalog_config(
@@ -14,4 +21,62 @@ impl PluginRequestProcessor {
self.load_latest_config(/*fallback_cwd*/ None).await
}
}
pub(super) async fn load_marketplace_context(
&self,
cwds: Vec<AbsolutePathBuf>,
catalog_config: &Config,
) -> PluginMarketplaceContext {
let global_config = catalog_config.plugins_config_input();
if cwds.is_empty() {
return PluginMarketplaceContext {
global_config: global_config.clone(),
scopes: vec![PluginMarketplaceScope {
cwd: None,
config: global_config,
}],
load_errors: Vec::new(),
};
}
let outcomes = futures::stream::iter(cwds)
.map(|cwd| async move {
match self
.config_manager
.load_with_overrides(
/*request_overrides*/ None,
ConfigOverrides {
cwd: Some(cwd.to_path_buf()),
..Default::default()
},
)
.await
{
Ok(config) => Ok(PluginMarketplaceScope {
cwd: Some(cwd),
config: config.plugins_config_input(),
}),
Err(err) => Err(MarketplaceListError {
path: cwd,
message: format!("failed to reload config: {err}"),
}),
}
})
.buffered(CONFIG_LOAD_CONCURRENCY)
.collect::<Vec<_>>()
.await;
let mut scopes = Vec::new();
let mut load_errors = Vec::new();
for outcome in outcomes {
match outcome {
Ok(scope) => scopes.push(scope),
Err(error) => load_errors.push(error),
}
}
PluginMarketplaceContext {
global_config,
scopes,
load_errors,
}
}
}