mirror of
https://github.com/openai/codex.git
synced 2026-11-13 14:46:14 +00:00
Keep MCP tool calls bound to their thread (#36355)
## Why Threads can configure the same MCP server name with different runtimes. Tool calls must use the runtime associated with the thread that issued the call. ## What changed - Route MCP readiness checks and call preparation through the invoking session. - Add regression coverage that alternates calls between two threads and verifies that each thread continues using its own MCP server process and configuration. GitOrigin-RevId: 5735f7b29a579f545351385ab01a575e35ead01e
This commit is contained in:
1 parent
35eab50501
commit
c4f2746c43
4 files changed
+169
-14
No files matched your search
@@ -140,16 +140,7 @@ pub(crate) async fn handle_mcp_tool_call(
|
||||
arguments: arguments_value.clone(),
|
||||
};
|
||||
|
||||
sess.refresh_mcp_if_dirty().await;
|
||||
let current_binding = sess
|
||||
.services
|
||||
.mcp_runtime
|
||||
.current_binding_for_call(&server)
|
||||
.await;
|
||||
let Some(prepared_call) = current_binding
|
||||
.as_ref()
|
||||
.and_then(|binding| binding.prepare_call(&server, &tool_name))
|
||||
else {
|
||||
let Some(prepared_call) = sess.prepare_mcp_call(&server, &tool_name).await else {
|
||||
let item_metadata =
|
||||
McpToolCallItemMetadata::from_tool_metadata(&server, /*metadata*/ None);
|
||||
let result = notify_mcp_tool_call_skip(
|
||||
|
||||
Reference in new issue
Block a user