mirror of
https://github.com/openai/codex.git
synced 2026-11-22 23:00:42 +00:00
Prewarm MCP servers during cloud catalog refresh (#62876)
## Why A slow cloud skill lookup can delay MCP startup even after the plugin catalog is ready. If the refresh is canceled while waiting for skills, it can miss the chance to prewarm those servers before the first turn. ## What changed Queue MCP prewarm as soon as plugin discovery changes or clears the catalog. Skill discovery alone leaves the MCP server set unchanged. At the end of the refresh, queue a retry for eligible MCP startup failures. If discovery is canceled, check for those failures the next time the catalog lock is acquired. Reuse pending handshakes and leave authentication failures and Apps-managed reconnects to their existing recovery paths. ## Testing Add regression tests for first-turn tool availability after cancellation, startup recovery with cloud plugins disabled, and a single retry for a persistent startup failure. GitOrigin-RevId: f92162d1629358953d8810d20244e55f07416a01
This commit is contained in:
@@ -64,6 +64,7 @@ pub use turn_input::TurnInputContext;
|
||||
pub use turn_input::TurnInputEnvironment;
|
||||
pub use turn_lifecycle::CatalogRefreshInput;
|
||||
pub use turn_lifecycle::CloudCatalogRefreshInput;
|
||||
pub use turn_lifecycle::CloudCatalogRefreshOutcome;
|
||||
pub use turn_lifecycle::TurnAbortInput;
|
||||
pub use turn_lifecycle::TurnErrorInput;
|
||||
pub use turn_lifecycle::TurnStartInput;
|
||||
@@ -249,16 +250,16 @@ pub trait TurnLifecycleContributor: Send + Sync {
|
||||
}
|
||||
|
||||
/// Publishes cloud catalogs after explicit invalidation, without requiring a turn.
|
||||
/// Core marks MCP dirty after publication. Accepted complete or partial catalogs
|
||||
/// replace the previous result; failed or superseded discovery returns an error.
|
||||
/// Report whether MCP needs updating so Core can start clients while other
|
||||
/// providers are still running.
|
||||
/// Core invalidates resource keys before calling. MCP-backed catalogs record
|
||||
/// the new key only on acceptance, keeping failed or cancelled refreshes stale.
|
||||
/// Called under the same per-thread catalog lock as step preparation.
|
||||
fn refresh_cloud_catalog<'a>(
|
||||
&'a self,
|
||||
_input: CloudCatalogRefreshInput<'a>,
|
||||
) -> ExtensionFuture<'a, Result<(), String>> {
|
||||
Box::pin(async { Ok(()) })
|
||||
) -> ExtensionFuture<'a, CloudCatalogRefreshOutcome> {
|
||||
Box::pin(async { CloudCatalogRefreshOutcome::UNCHANGED })
|
||||
}
|
||||
|
||||
/// Observes a completed item without changing it or delaying streamed deltas.
|
||||
|
||||
@@ -58,6 +58,21 @@ impl<'a> From<CatalogRefreshInput<'a>> for CloudCatalogRefreshInput<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Result of explicit discovery and its effect on the thread's MCP servers.
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct CloudCatalogRefreshOutcome {
|
||||
pub result: Result<(), String>,
|
||||
/// Also true when discovery failed after clearing a stale plugin catalog.
|
||||
pub needs_mcp_refresh: bool,
|
||||
}
|
||||
|
||||
impl CloudCatalogRefreshOutcome {
|
||||
pub const UNCHANGED: Self = Self {
|
||||
result: Ok(()),
|
||||
needs_mcp_refresh: false,
|
||||
};
|
||||
}
|
||||
|
||||
/// Input supplied when the host completes a turn.
|
||||
pub struct TurnStopInput<'a> {
|
||||
/// Store scoped to the host session runtime.
|
||||
|
||||
@@ -59,6 +59,7 @@ pub use contributors::ApprovalDecisionInput;
|
||||
pub use contributors::ApprovalReviewContributor;
|
||||
pub use contributors::CatalogRefreshInput;
|
||||
pub use contributors::CloudCatalogRefreshInput;
|
||||
pub use contributors::CloudCatalogRefreshOutcome;
|
||||
pub use contributors::CodeModeCellTiming;
|
||||
pub use contributors::CommandStartInput;
|
||||
pub use contributors::ConfigContributor;
|
||||
|
||||
Reference in New Issue
Block a user