Honor layered configuration when loading plugins (#40954)

## What changed

- Resolve plugin activation, MCP server policy, and marketplace definitions from the effective configuration stack, including system settings and trusted project overrides.
- Load plugin skills independently for each working directory passed to `skills/list`.
- Exclude project configuration from catalog requests whose `cwds` are omitted or empty.
- Cache up to eight loaded plugin configurations with least-recently-used eviction so requests for different working directories can reuse their results.

## Testing

- Cover layered plugin and MCP policy across trusted and untrusted projects.
- Cover per-directory skill and plugin catalog results, cache reuse and eviction, and system-defined marketplaces.

GitOrigin-RevId: cb68b2b1bdab1da48e05ca7562bc05014431fc71
This commit is contained in:
willwang-openai authored and copyberry committed 2026-08-26 19:02:02 +00:00
1 parent 7276d67081
commit 6ac012a0d4
18 files changed
+490 -132

No files matched your search

@@ -0,0 +1,17 @@
use super::*;
impl PluginRequestProcessor {
pub(super) async fn load_catalog_config(
&self,
cwds: &[AbsolutePathBuf],
) -> Result<Config, JSONRPCErrorError> {
if cwds.is_empty() {
self.config_manager
.load_non_project_config()
.await
.map_err(|err| internal_error(format!("failed to reload config: {err}")))
} else {
self.load_latest_config(/*fallback_cwd*/ None).await
}
}
}
@@ -42,7 +42,9 @@ impl PluginRequestProcessor {
return Ok(empty_response());
}
let config = self.load_latest_config(/*fallback_cwd*/ None).await?;
let config = self
.load_catalog_config(cwds.as_deref().unwrap_or_default())
.await?;
if !config.features.enabled(Feature::Plugins) {
return Ok(empty_response());
}