Files
codex/codex-rs/ext/mcp/src/plugin_providers.rs
T
Anthony Tafoya 394dadb93d Add turn-start cloud plugin discovery to the MCP extension (#46572)
## What changed

- Support an optional cloud provider alongside executor plugins, refreshing its thread-scoped catalog at each regular turn when plugins are enabled.
- Use cloud connector metadata for app attribution without starting cloud-declared MCP servers.
- Scope cached catalogs to authentication and Apps availability. Retain the previous catalog on discovery failure within the same scope, clear stale catalogs on auth changes, and reject results completed under outdated credentials.
- Add a cancellable regular-task startup phase that reconciles MCP before discovery and reapplies contributor state afterward without invalidating resource caches.

## Testing

Add regression coverage for per-turn refresh, empty catalogs, discovery failures, plugin disabling, auth changes during discovery, MCP reconciliation and cancellation, and cloud app attribution alongside executor MCP tools.

GitOrigin-RevId: 8469eb109ea316e21cbc4122c52ad8000caeef03
2026-09-19 02:07:58 +00:00

28 lines
896 B
Rust

//! Host-assembled plugin sources; discovery results belong to the active thread, not this registry.
use codex_core_plugins::ExecutorPluginProvider;
use codex_core_plugins::PluginProvider;
use std::sync::Arc;
/// Cloud discovery is optional and never replaces executor plugin support.
pub struct PluginProviders {
// CCA owns and supplies the cloud provider implementation.
pub(crate) cloud: Option<Arc<dyn PluginProvider>>,
// Keep concrete access to resolve_bound so loaders retain the exact executor filesystem.
pub(crate) executor: Arc<ExecutorPluginProvider>,
}
impl PluginProviders {
pub fn new(executor: Arc<ExecutorPluginProvider>) -> Self {
Self {
cloud: None,
executor,
}
}
pub fn with_cloud_provider(mut self, provider: Arc<dyn PluginProvider>) -> Self {
self.cloud = Some(provider);
self
}
}