mirror of
https://github.com/openai/codex.git
synced 2026-12-02 00:31:03 +00:00
## Why Hosts need to refresh cloud plugin and skill catalogs without starting a turn or waiting for step preparation. ## What changed - Add `CodexThread::refresh_cloud_plugins()` and a turn-independent extension callback that bypass cached catalog reuse and failure cooldowns. - Run catalog contributors concurrently while serializing publication with step snapshot capture. Invalidate MCP resource caches before explicit discovery and schedule MCP reconciliation afterward. - Accept complete and partial catalogs, report discovery errors, and keep failed or cancelled refreshes retryable. - Allow hosts to gate cloud plugin discovery through effective configuration. ## Testing Add coverage for discovery before turn admission, catalog replacement and reuse, immediate retry after failure, concurrent contributors, and cancellation-safe publication and invalidation. GitOrigin-RevId: 83e847fcab6562581af2c9e831b1d2a310f2b270
48 lines
1.7 KiB
Rust
48 lines
1.7 KiB
Rust
//! Plugin catalog listing interface and source inputs used to request snapshots.
|
|
|
|
use crate::ExecutorPluginProviderError;
|
|
use crate::PluginCatalog;
|
|
use codex_exec_server::ExecutorCapabilityDiscoveryV2Snapshot;
|
|
use codex_mcp::McpResourceClient;
|
|
use std::future::Future;
|
|
use std::pin::Pin;
|
|
use std::sync::Arc;
|
|
use thiserror::Error;
|
|
|
|
/// Identifiers, MCP client, and executor inventories used to request one catalog snapshot.
|
|
#[derive(Clone, Debug)]
|
|
pub struct PluginListQuery {
|
|
pub thread_id: String,
|
|
/// Absent for explicit discovery before turn admission.
|
|
pub turn_id: Option<String>,
|
|
pub mcp_resources: Option<Arc<McpResourceClient>>,
|
|
/// Already-acquired V2 inventories; empty for cloud listing.
|
|
pub snapshots: Vec<ExecutorCapabilityDiscoveryV2Snapshot>,
|
|
}
|
|
|
|
/// Failure to list plugin metadata.
|
|
#[derive(Debug, Error)]
|
|
pub enum PluginProviderError {
|
|
#[error(transparent)]
|
|
Executor(#[from] ExecutorPluginProviderError),
|
|
#[error("{0}")]
|
|
Message(String),
|
|
}
|
|
|
|
pub type PluginProviderResult<T> = Result<T, PluginProviderError>;
|
|
|
|
pub type PluginProviderFuture<'a, T> =
|
|
Pin<Box<dyn Future<Output = PluginProviderResult<T>> + Send + 'a>>;
|
|
|
|
/// Lists plugin metadata without resolving packages or binding filesystems.
|
|
///
|
|
/// Cloud providers implement `list`; executor listing is not yet supported.
|
|
/// Package access uses [`crate::ExecutorPluginProvider::resolve_bound`] directly.
|
|
pub trait PluginProvider: Send + Sync {
|
|
/// Returns a snapshot; on error, callers retain the previous snapshot.
|
|
/// Providers set `is_partial` when listing omits entries; warnings are diagnostic only.
|
|
fn list(&self, _query: PluginListQuery) -> PluginProviderFuture<'_, PluginCatalog> {
|
|
Box::pin(async { Ok(PluginCatalog::default()) })
|
|
}
|
|
}
|