mirror of
https://github.com/openai/codex.git
synced 2026-11-14 06:48:26 +00:00
Reuse MCP bindings while cached servers remain dormant (#44121)
## Why Dormant MCP servers with usable cached tool catalogs prevented binding reuse, causing each model step to capture a new binding even when the catalog was unchanged. ## What changed Track dormant catalog revisions alongside ready client revisions so bindings can be reused until the catalog changes or the server starts. Explicit server and plugin requirements still trigger binding capture and startup. Check cached catalog availability without cloning tool definitions. ## Testing Extend the lazy-startup integration test to verify that two model steps share one binding while the server stays dormant, and that starting the server invalidates that binding. GitOrigin-RevId: ef0469a85000f84a928946c24350e3bda1522fb5
This commit is contained in:
1 parent
9e868bd9dc
commit
20f109eadb
6 files changed
+160
-20
No files matched your search
@@ -46,8 +46,8 @@ use tokio_util::sync::CancellationToken;
|
||||
|
||||
use crate::McpConfig;
|
||||
use crate::binding::McpBinding;
|
||||
use crate::client_tool_catalog::ClientToolCatalogRevision;
|
||||
use crate::client_tool_catalog::CodexAppsToolSnapshot;
|
||||
use crate::connection_manager::BindingCatalogRevision;
|
||||
use crate::connection_manager::McpConnectionSet;
|
||||
use crate::elicitation::ElicitationLifecycle;
|
||||
use crate::elicitation::ElicitationRequestRouter;
|
||||
@@ -119,7 +119,7 @@ struct PublishedMcpRuntime {
|
||||
}
|
||||
|
||||
struct CachedMcpBinding {
|
||||
catalog_revisions: HashMap<String, ClientToolCatalogRevision>,
|
||||
catalog_revisions: HashMap<String, BindingCatalogRevision>,
|
||||
binding: Arc<McpBinding>,
|
||||
}
|
||||
|
||||
@@ -363,7 +363,10 @@ impl McpRuntime {
|
||||
required_plugins: &HashSet<String>,
|
||||
) -> Option<Arc<McpBinding>> {
|
||||
let config = Arc::clone(current.config.as_ref()?);
|
||||
let stable_catalog_revisions = current.connections.stable_catalog_revisions().await;
|
||||
let stable_catalog_revisions = current
|
||||
.connections
|
||||
.stable_catalog_revisions(required_servers, required_plugins)
|
||||
.await;
|
||||
if let Some(catalog_revisions) = &stable_catalog_revisions {
|
||||
let cached = current
|
||||
.cached_binding
|
||||
@@ -390,7 +393,7 @@ impl McpRuntime {
|
||||
if let Some(catalog_revisions) = stable_catalog_revisions
|
||||
&& current
|
||||
.connections
|
||||
.stable_catalog_revisions()
|
||||
.stable_catalog_revisions(required_servers, required_plugins)
|
||||
.await
|
||||
.as_ref()
|
||||
== Some(&catalog_revisions)
|
||||
|
||||
Reference in new issue
Block a user