Reuse stable MCP bindings across sampling steps (#37101)

## What changed

- Cache an `McpBinding` on each published MCP runtime once server startup has
  settled and the tool catalog revision is stable.
- Reuse the cached binding while the catalog revision remains unchanged, and
  rebuild it after a runtime publish or catalog change.
- Treat terminal failures from optional servers as stable, while continuing to
  wait for required servers and reconnecting Codex Apps servers.

## Testing

- Cover binding reuse within one published runtime and invalidation after a
  republish.
- Cover stability checks for pending, failed optional, required, and
  reconnected servers.

GitOrigin-RevId: 783a6b04897f6c484a6d56fd9cee542814041759
This commit is contained in:
jif authored and copyberry committed 2026-08-05 14:04:39 +00:00
1 parent 5c44f11064
commit 952e87d3f2
6 files changed
+174 -14

No files matched your search

+1 -1
View File
@@ -598,7 +598,7 @@ impl McpConnectionSet {
let Some(view) = self.servers.get(server_name) else {
return false;
};
view.connection.client().await.is_ok()
view.connection.client.ready_transport().is_some() || view.connection.client().await.is_ok()
}
/// Stop all MCP clients owned by this manager and terminate stdio server processes.