Repository navigation
test(e2e-ui): check the MCP Tools tab against the upstream's own tools/list - #42397
Conversation
…s/list DeepWiki renamed ask_question to ask_wiki_question, and the spec hardcoded the old name, so e2e_ui_testing went red on main for something that is not a litellm regression. The spec now asks the upstream server for its tool list with the official MCP TypeScript SDK and expects the tab to show exactly those cards, so a vendor rename cannot turn the job red again.
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
|
|
|
||
| test("MCP Tools tab lists the tools the upstream server advertises", async ({ page }) => { | ||
| const upstreamTools = await listUpstreamToolNames(MCP_SERVER_URL); | ||
| expect(upstreamTools).toContain(TOOL_NAME); |
There was a problem hiding this comment.
This assertion pins a third-party tool name, violating the requirement that tests fail only when LiteLLM changes. Remove it before merging
| expect(upstreamTools).toContain(TOOL_NAME); |
Context Used: AGENTS.md (source)
Knowledge Base Used: Harden E2E tests against cache and network flakiness
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
There was a problem hiding this comment.
AGENTS.md permits a cited, dated outside fact; the call-tool test needs one known tool, and this guard fails first, naming the stale pin
There was a problem hiding this comment.
That’s a valid exception. Given the cited, dated upstream fact and the call-tool test’s need for a stable schema (repoName), keeping expect(upstreamTools).toContain(TOOL_NAME) is appropriate: a vendor rename fails explicitly before the UI assertions instead of producing a misleading failure from an unavailable pinned tool. I’m withdrawing the suggestion to remove it.
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 2942b36. Configure here.
TLDR
Problem this solves:
e2e_ui_testinghas been red on main since 2026-09-22 00:09Zask_questiontool toask_wiki_questionmcpTools.spec.tshardcoded the old name, so every PR fails that jobHow it solves it:
User Flow
Before: an engineer opens a PR that touches nothing near MCP and the required
e2e_ui_testingcheck fails on DeepWiki's tool renamelitellm_branch and open a PR againstmaine2e_ui_testing: it boots a proxy, adds an MCP server pointing athttps://mcp.deepwiki.com/mcpthrough http://localhost:4000/ui/?page=mcp-servers, and opens its MCP Tools tabask_wiki_question,read_wiki_contents, andread_wiki_structure, which is what DeepWiki advertises todayask_question, so the job reports1 failed, 153 passedwithexpect(locator).toBeVisible() failed ... /^ask_question$/atmcpTools.spec.ts:45After: the same job learns DeepWiki's current tool names first, so it stays green through a rename
litellm_branch and open a PR againstmaine2e_ui_testing: it boots a proxy, adds an MCP server pointing athttps://mcp.deepwiki.com/mcpthrough http://localhost:4000/ui/?page=mcp-servers, and opens its MCP Tools tabask_wiki_question,read_wiki_contents, andread_wiki_structure, which is what DeepWiki advertises todaytools/listrequest tohttps://mcp.deepwiki.com/mcpand gets those same three names backread_wiki_structurenarrows the list to that one card154 passedand the PR's checks are green; the next DeepWiki rename changes what the spec expects instead of failing itRelevant issues
Affected release
Linear ticket
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
uv run pytest tests/test_litellm/<your_test_file>.py -v. Leave the suites (make test-unit-*,make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more@greptileaito re-request a review after pushing changes)Delays in PR merge?
If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).
Screenshots / Proof of Fix
Both legs run the spec the way
tests/e2e/ui/run_e2e.shand thee2e_ui_testingjob do: a proxy ontests/e2e/ui/fixtures/config.ymlwith a fresh Postgres database,LITELLM_MASTER_KEY=sk-1234,LITELLM_DANGEROUSLY_PERMIT_WEAK_OR_UNSET_MASTER_KEY=true,DISABLE_SCHEMA_UPDATE=true,SERVER_ROOT_PATH="", andPROXY_LOGOUT_URL=https://www.example.com, the mock LLM and mock Presidio servers,seed.sqlapplied, thennpx playwright test --config playwright.config.ts --reporter=listfromtests/e2e/uiagainst that proxy. The spec talks to the real DeepWiki server athttps://mcp.deepwiki.com/mcp, no mocksWhat DeepWiki advertises at the time of both runs:
Before (b833e1f)
npx playwright test --config playwright.config.ts --reporter=list tests/mcp/mcpTools.spec.tserror-context.mdfor the failure shows the tab renderedheading "ask_wiki_question" [level=4],heading "read_wiki_contents" [level=4], andheading "read_wiki_structure" [level=4]: the proxy and the UI are right, only the spec's expectation is stale. This is the same failure as CircleCI job 2198876 on main (9fad216030)After (2942b36)
npx playwright test --config playwright.config.ts --reporter=list tests/mcp/, which covers the changed spec and the two sibling specs that share the edited helper module:npm cidoes on a cache miss (Node 24.19.0, npm 11.17.0, same asinstall_node):npm ci --no-audit --no-fundin a clean directory holding onlypackage.jsonandpackage-lock.jsonexits 0 andnode_modules/@modelcontextprotocol/sdkis at 1.30.0.npx tsc --noEmit -p tsconfig.jsonintests/e2e/uiexits 0 at this tipType
✅ Test
Caveats (if any)
read_wiki_structure, still turnse2e_ui_testingred. Left as is: the call-tool test needs one tool with a known input schema, so one pin is unavoidable; the spec cites where and when that name was read, checks it is still advertised before touching the UI so a stale pin fails with its own message, and its header documents the outage trade-off with theE2E_SKIP_EXTERNAL_MCP=1opt-outtests/e2e/ui/package-lock.jsongains the MCP SDK's dependency tree (96 packages added, 2 replaced; dev-only, nothing in the shipped litellm package), and the first CI run after merge pays a fullnpm cibecause the cache key includes that lockfile. Left as is: the official SDK does the MCP initialize handshake and session headers correctly, where a hand-rolled fetch would re-implement themci/circleci: unitjob is red at this tip (job 2199795) on two timing assertions this PR cannot reach, since it touches no Python:test_scan_message_stays_linear_on_adversarial_credential_lines[assignment-flood], red on main in each of the last 6 scheduled runs (2199603, 2198895, 2198768, 2196558, 2196428, 2196379), andtest_async_log_success_event_counts_the_prompt_off_the_event_loop, which asserts the event loop stalls under a threshold and lost to runner load once. No main commit after the merge base (b833e1f) touches either test. Left as is: the merge gate is the required GitHub Actions checks, all green, and a rerun would only resample the same fleet-wide redQA runbook
tests/e2e/ui/tests/mcp/mcpTools.spec.ts› MCP Tools › MCP Tools tab lists the tools the upstream server advertises - the MCP Tools tab shows one card per tool DeepWiki currently advertises, no more and no fewer, and the search box narrows to a single cardcurl -sS -X POST https://mcp.deepwiki.com/mcp -H 'Content-Type: application/json' -H 'Accept: application/json, text/event-stream' -d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'and note thenameof every entry underresult.tools(today:ask_wiki_question,read_wiki_contents,read_wiki_structure)https://mcp.deepwiki.com/mcp, authentication None, then click Add MCP Server and expect the "MCP Server created successfully" toastread_wiki_structureinto the "Search tools..." box and expect exactly one card,read_wiki_structure, to remainFinal Attestation