test(e2e): poll MCP tools across multi-worker lag - #35042
test(e2e): poll MCP tools across multi-worker lag#35042mubashir1osmani wants to merge 4 commits into
Conversation
Multi-worker reloads put MCP servers in the registry from the DB but do not re-run tools/list on every process. Gating call_tool on tool_name_to_mcp_server_name_mapping made cold workers 500 with Tool not found after another worker had already listed the tool. Treat a registry match on server id/name/alias as enough; upstream rejects unknown tools
Greptile SummaryThis PR updates the MCP end-to-end harness to tolerate transient multi-worker registry misses
Confidence Score: 3/5The PR is not yet safe to merge because the previously reported normalized-identifier collision can still route calls to the wrong MCP server Distinct servers can coexist under raw stable IDs while the call resolver collapses space and underscore variants into the same normalized lookup key, selecting the first matching registry entry Files Needing Attention: litellm/proxy/_experimental/mcp_server/mcp_server_manager.py; litellm/proxy/_experimental/mcp_server/utils.py
|
| Filename | Overview |
|---|---|
| tests/e2e/mcp/mcp_client.py | Adds bounded polling for transient MCP tool or server not-found responses |
| tests/e2e/mcp/test_mcp_access_group_e2e.py | Waits for server registration before exercising access-group selection |
| tests/e2e/mcp/test_mcp_datadog_e2e.py | Uses registration and tool-call polling in the Datadog round-trip test |
| tests/e2e/mcp/test_mcp_key_access_e2e.py | Uses polling helpers for permitted and denied MCP tool calls |
Reviews (2): Last reviewed commit: "merge litellm_internal_staging into lite..." | Re-trigger Greptile
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
…-worker lag Stage multi-worker gateways only load MCP servers and tool maps on the process that handled the request. Poll until the server is listed, the tool appears on tools/list, and tools/call is not a cold-worker 500 so key-access and Datadog MCP e2e stop racing the LB
…l map" This reverts commit 8b56e51.
Resolve e2e MCP conflicts by keeping staging await_registered/await_tool and layering await_call_tool / await_call_tool_denied for multi-worker lag
|
Greptile's 3/5 note about normalized ID collision in mcp_server_manager.py is stale. That product change was reverted. Current net diff is tests/e2e/mcp only (poll helpers). No registry-normalize path is modified in this PR |
|
@greptile-apps the pr has e2e tests only. it brings a timeout to make the mcp tools available across pods before they are called in the tests |
|
The implementation looks correct. The polling logic in all three helpers is sound:
The test-side cleanup is also clean: One minor thing worth confirming: This is a clean, targeted fix for multi-worker test flakiness with no production code changes. LGTM. |
|
Closing: reopened as a same-repo PR from BerriAI/litellm (not the fork). See the replacement PR linked above. |
Summary
Stage multi-worker MCP e2e raced cold workers that 500 Tool not found after tools/list already worked on another process. The harness now polls until the server is listed, tools/list shows the tool, and tools/call is not a cold-worker not-found miss (and until 403 access_denied for the ungranted key path)
No product changes. Diff is tests/e2e/mcp only
Linear ticket
Test plan