The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test(mcp): a stdio command found later on PATH keeps the child's PATH order
kshitijk4poor76d6798b4b4b
diff --git a/tests/tools/test_mcp_tool_issue_948.py b/tests/tools/test_mcp_tool_issue_948.pyindex ced0dda4e5b..cf4ce059145 100644--- a/tests/tools/test_mcp_tool_issue_948.py+++ b/tests/tools/test_mcp_tool_issue_948.py@@ -4,6 +4,7 @@ import sysfrom types import SimpleNamespacefrom unittest.mock import AsyncMock, MagicMock, patch+import pytestfrom tools.mcp_tool import MCPServerTask, _MCP_AVAILABLEfrom tools.mcp_tool_errors import _format_connect_error@@ -177,6 +178,26 @@ def test_resolve_stdio_command_uvx_unchanged_when_already_on_path():assert command == resolved_path[email protected]("posix")+def test_resolve_stdio_command_keeps_the_child_path_order(tmp_path):+ """A command found later on the child's PATH must not pull its directory ahead of+ earlier entries: the child's other bare lookups (node, python3, git) follow the PATH+ order the user, or pm.activate(), chose. Hoisting it (#124792) handed a brew+ command's children brew's node/python3/git instead of the pinned store copies."""+ first, middle, later = tmp_path / "first", tmp_path / "middle", tmp_path / "later"+ for directory in (first, middle, later):+ directory.mkdir()+ tool = later / "mytool"+ tool.write_text("#!/bin/sh\nexit 0\n", encoding="utf-8")+ tool.chmod(0o755)+ path = os.pathsep.join([str(first), str(middle), str(later)])++ command, env = _resolve_stdio_command("mytool", {"PATH": path})++ assert command == str(tool)+ assert env["PATH"] == path++def test_resolve_stdio_command_skips_unknown_commands():"""Bare command names outside the npx/npm/node/uv/uvx launcher set must NOTbe matched against the fallback paths — that would rewrite ``command: