Skip to content

fix(ci): restore loadscope on the mcp-interactions shard so its MCP subscription cases do not race across workers - #46783

Merged
mateo-berri merged 1 commit into
mainfrom
litellm_ci_heal_mcp_interactions_loadscope
Oct 15, 2026
Merged

mateo-berri merged 1 commit into
mainfrom
litellm_ci_heal_mcp_interactions_loadscope

Conversation

@mateo-berri

@mateo-berri mateo-berri commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

TLDR

Problem this solves:

How it solves it:

User Flow

Before: every push to main gets a red mcp-interactions check from a race between test cases

  1. A commit lands on main and the Unit Tests workflow starts the mcp-interactions shard
  2. Its 44 MCP subscription cases are spread over 4 workers and run several proxies at once
  3. Pytest reports 1 failed, 43 passed on the first attempt and 2 failed, 42 passed on the rerun

After: the same push runs those cases on one worker and the check goes green

  1. A commit lands on main and the Unit Tests workflow starts the mcp-interactions shard
  2. The 44 cases run back to back on one worker, as they did inside mcp-elicitation before
  3. Pytest reports 44 passed inside the 20 minute step budget

Why it broke

#46770 (litellm_mcp_elicitation_shard_dist) and #46773 both fixed the mcp-elicitation timeout, and landed 4 minutes apart. #46770 changed that entry's dist: loadscope to dist: load. #46773 split tests/integration/mcp/test_interactions.py into a new mcp-interactions entry right below it. The squash merge of #46773 kept #46770's dist: load line, but it now sits under mcp-interactions, so mcp-elicitation is back on loadscope and the integration module is on load

With load, the 44 cases ran 10 to 12 per worker. The failing ids were test_modern_subscription_delivers_changes_between_calls_and_refreshes_tools[tools-legacy-both], then [prompts-legacy-both] and [resources-legacy] on the rerun. Each failed on the upstream MCP server double logging anyio.ClosedResourceError then RuntimeError: Unexpected ASGI message 'http.response.start' sent, after response already completed. The same race showed up locally when these cases ran with --dist load while #46773 was being written, which is why #46773 kept loadscope. In #46773's own CI the shard ran all 44 cases on one worker and passed

mcp-elicitation is green on main at bb26e6d (job 116712254761), so this PR touches only the mcp-interactions entry

Screenshots / Proof of Fix

The proof is this PR's own CI at the tip, against the red main runs linked in the TLDR

Job Main (bb26e6d, dist: load) This PR (878528e, dist: loadscope)
mcp-interactions 1 failed, 43 passed in 479.68s, rerun 2 failed, 42 passed in 457.28s, cases spread over gw0 to gw3 job 116721084405, 44 passed in 1058.34s, all 44 on gw0, step took 17m 47s
mcp-elicitation job 116712254761, green job 116721084585, 2731 passed in 522.33s

The diff only touches .github/workflows/test-unit.yml, so no proxy code path changes and there is nothing to curl. All 87 checks are green at the tip

Type

🚄 Infrastructure
✅ Test

Pre-Submission checklist

  • I have added meaningful tests
  • The handful of test files covering my change pass locally, e.g. uv run pytest tests/unit/<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
  • My PR passes all required CI/CD checks (e.g., lint, schema.d.ts sync check, etc.)
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • Every automated review on my PR's latest commit has finished, and I have addressed or replied to each of its findings before requesting a maintainer review

Caveats (if any)

Medium

Final Attestation

  • The tests check the right things, including the edge cases, and regressions in the respective real-world customer use-cases are not possible after this PR

  • 878528e passes /live-pr-risk

Link to Devin session: https://app.devin.ai/sessions/db431364252141718b3b09064477ee4d
Open in Devin Desktop: https://app.devin.ai/desktop/session/db431364252141718b3b09064477ee4d?variant=devin
Requested by: @mateo-berri


Note

Low Risk
Workflow-only change to pytest parallelization; no runtime or application code is modified.

Overview
Restores loadscope pytest-xdist distribution on the mcp-interactions unit-test shard in .github/workflows/test-unit.yml, replacing load.

That shard runs tests/integration/mcp/test_interactions.py with four workers. Under load, subscription integration cases were split across workers and could run several MCP proxies at once, causing flaky ASGI/ClosedResourceError failures on main. loadscope keeps each test module on a single worker so those cases run serially within the module, matching how the shard was green before a merge accidentally left load on this entry.

Reviewed by Cursor Bugbot for commit 878528e. Bugbot is set up for automated code reviews on this repo. Configure here.

…ubscription cases do not race across workers

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@greptile-apps

greptile-apps Bot commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Automatic reviews are disabled for this repository.

@mateo-berri

Copy link
Copy Markdown
Contributor Author

@litereview code-review

@mateo-berri

Copy link
Copy Markdown
Contributor Author

bugbot run

@litereview

litereview Bot commented Oct 15, 2026

Copy link
Copy Markdown

✅ code-review

5/5 · Ready for human review

Scope: full · Full PR review.

Completed · Some checks not run.

No correctness findings. The one-line change puts mcp-interactions back on dist: loadscope. tests/integration/mcp/test_interactions.py holds only module-level test functions, so loadscope keeps the whole module on one xdist worker. That matches the serial run that #46773 showed passing, and mcp-elicitation keeps its existing loadscope setting.

Checks and execution details
  • Passed · Real testing evidence (required): Not applicable: no LLM translation changes in the scoped paths. The PR changes only .github/workflows/test-unit.yml.
  • Passed · Workflow matrix inspection (optional): In the head checkout, .github/workflows/test-unit.yml lines 583-592 set dist: loadscope for the mcp-interactions entry. The mcp-elicitation entry at line 581 also uses loadscope. Line 1030 passes the value through as DIST: ${{ matrix.dist }}. tests/integration/mcp/test_interactions.py has no test classes, only module-level def test_* functions, so loadscope schedules the module on one worker.
  • Not run · CI run of mcp-interactions shard at head (optional): I could not access CI results for 878528e from the sandbox, and the PR lists this result as pending. I did not run the 14-minute integration shard locally.

View review · Reviewed 878528e19366

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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 878528e. Configure here.

@codecov

codecov Bot commented Oct 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@mateo-berri

Copy link
Copy Markdown
Contributor Author

@litellm-stampbot

@mateo-berri
mateo-berri enabled auto-merge (squash) October 15, 2026 23:34
@litellm-stampbot

Copy link
Copy Markdown

litellm-stampbot: risk low

Approved at 878528e.

Rules (stampbot/risk_rules.yml):

  • low: no rule flagged it

Judge (gpt-6-luna): low, probability of high 0.00 (high at or above 0.90)

  • risk: low (probability of high 0.00)

Pushes do not re-run this check. Comment @litellm-stampbot again to re-check the new head.

@litellm-stampbot litellm-stampbot Bot added the risk:low Small, isolated, low-risk change label Oct 15, 2026

@kerry-berri kerry-berri left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Low risk by rule and by judgement at 878528e

@mateo-berri
mateo-berri merged commit b907975 into main Oct 15, 2026
90 of 91 checks passed
@mateo-berri
mateo-berri deleted the litellm_ci_heal_mcp_interactions_loadscope branch October 15, 2026 23:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:low Small, isolated, low-risk change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants