Honor explicit plugin mentions during MCP startup (#42406)

## Why

Selected plugin MCP servers may be skipped after the optional startup grace
period. When a user explicitly mentions a plugin or MCP server, the turn should
continue waiting so the requested tools are available to the model.

## What changed

- Track explicitly mentioned plugin IDs and MCP servers across later samples,
  steered input, and same-turn restarts.
- Require matching selected-plugin MCP servers to finish startup before
  capturing the tool catalog, while leaving unmentioned servers optional.
- Match `plugin://` identities independently of display names and ignore
  targeting query parameters such as `app` and `browserFamily`.

## Testing

Added coverage for linked and structured plugin mentions, direct and batched
capability discovery, delayed environment attachment, steering, and same-turn
restarts.

GitOrigin-RevId: c509ef8df45df1a7edb0da6afdb2682dc53a4de8
This commit is contained in:
Matthew Zeng authored and copyberry committed 2026-09-03 01:33:32 +00:00
1 parent b7f710273e
commit 460b63e5f4
14 files changed
+617 -106

No files matched your search

+2 -1
View File
@@ -329,6 +329,7 @@ impl Session {
turn_context: &TurnContext,
selected_capability_roots: &[ResolvedSelectedCapabilityRoot],
required_servers: &[String],
required_plugins: &HashSet<String>,
) -> Arc<codex_mcp::McpBinding> {
let ready_selected_capability_roots =
Self::ready_selected_capability_roots(selected_capability_roots);
@@ -365,7 +366,7 @@ impl Session {
if let Some(binding) = self
.services
.mcp_runtime
.current_binding_with_required_servers(&required_servers)
.current_binding_with_requirements(&required_servers, required_plugins)
.await
{
return binding;