Replace closed MCP connections during reconciliation (#34957)

## Why

MCP connection reconciliation can otherwise reuse a client after its service or
underlying transport has stopped.

## What changed

- Add `RmcpClient::is_closed` to report closed client, service, and transport
  states.
- Exclude closed clients when selecting a reusable MCP connection so
  reconciliation starts a replacement.

## Testing

- Add a reconciliation test that disconnects an in-process MCP transport and
  verifies that its connection is replaced.

GitOrigin-RevId: 366a85c9959dbe1763923d7e33a4ecf52d9c3c6a
This commit is contained in:
jif authored and copyberry committed 2026-07-23 15:29:10 +00:00
1 parent e19e65317a
commit 34b935e3e5
3 files changed
+119

No files matched your search

@@ -90,6 +90,9 @@ impl McpServerConnection {
return None;
}
let client = self.client.client().await.ok()?;
if client.client.is_closed().await {
return None;
}
let Ok(desired_credentials) = desired.oauth_credentials() else {
return Some(client);
};