Centralize thread MCP connections in McpRuntime (#33889)

## What changed

- Add a thread-owned `McpRuntime` that atomically publishes connection-set
  replacements and owns shutdown.
- Route `McpResourceClient` snapshots and cache keys through that runtime so
  extension clients observe refreshed MCP servers.
- Keep model-step configuration snapshots separate from ownership of live MCP
  connections.

## Testing

- Add coverage that captures an extension's session resource client, refreshes
  the MCP server configuration, and verifies that the existing client sees the
  newly published server.

GitOrigin-RevId: 351b2e25594b8eb6b91e50ff8d06b7d49768ae1c
This commit is contained in:
jif authored and copyberry committed 2026-07-17 18:43:14 +00:00
1 parent b99cc315fd
commit f24e695470
10 files changed
+203 -67

No files matched your search

+1 -5
View File
@@ -607,11 +607,7 @@ async fn shutdown_session_runtime(sess: &Arc<Session>) {
if let Err(err) = sess.services.code_mode_service.shutdown().await {
warn!("failed to shutdown code mode session: {err}");
}
sess.services
.latest_mcp_runtime()
.manager_arc()
.shutdown()
.await;
sess.services.mcp_runtime.shutdown().await;
sess.guardian_review_session.shutdown().await;
}