Propagate deferred environment capability roots to MCP (#33427)

## What changed

- Let deferred environments provide selected capability roots with their ready signal.
- Validate that those roots have unique, non-empty IDs, belong to the registering environment, and stay within the root limit.
- Include roots from ready turn environments when resolving MCP contributions, and refresh the MCP runtime when the selected root set changes.
- Expose the exact ready root set to MCP contributors so executor plugins become available with their environment.

## Testing

- Cover ready-root propagation, validation failures, replacement isolation, reconnection, and MCP plugin availability refresh.

GitOrigin-RevId: ec3498aab1164824025094e96a9b1063b7b731ad
This commit is contained in:
jif authored and copyberry committed 2026-07-15 21:07:43 +00:00
1 parent 1c4af96394
commit 79177c3e20
16 files changed
+333 -106

No files matched your search

+4 -4
View File
@@ -111,14 +111,14 @@ impl SessionServices {
config: Arc<McpConfig>,
plugins_available: bool,
runtime_context: McpRuntimeContext,
available_environment_ids: Vec<String>,
ready_selected_capability_roots: Vec<SelectedCapabilityRoot>,
manager: McpConnectionManager,
) -> Result<()> {
let runtime = self.publish_mcp_runtime(
config,
plugins_available,
runtime_context,
available_environment_ids,
ready_selected_capability_roots,
manager,
);
runtime.manager().validate_required_servers().await
@@ -129,7 +129,7 @@ impl SessionServices {
config: Arc<McpConfig>,
plugins_available: bool,
runtime_context: McpRuntimeContext,
available_environment_ids: Vec<String>,
ready_selected_capability_roots: Vec<SelectedCapabilityRoot>,
manager: McpConnectionManager,
) -> Arc<McpRuntimeSnapshot> {
let manager = Arc::new(manager);
@@ -141,7 +141,7 @@ impl SessionServices {
plugins_available,
manager,
runtime_context,
available_environment_ids,
ready_selected_capability_roots,
));
self.mcp_runtime.store(Some(Arc::clone(&runtime)));
runtime