Skip to content

test: model the team membership lookup in MCP DCR admission fixtures and assert decisions call types per route - #45917

Merged
mateo-berri merged 1 commit into
mainfrom
litellm_circleci_heal_mcp_decisions
Oct 11, 2026
Merged

mateo-berri merged 1 commit into
mainfrom
litellm_circleci_heal_mcp_decisions

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

TLDR

Problem this solves:

How it solves it:

Failing test ids on main

tests/unit/proxy/_experimental/mcp_server/auth/test_user_api_key_auth_mcp.py::TestMCPDcrBridgeDelegateAdmission (8 tests, starting with test_admit_helper_returns_new_headers_without_mutating_input) in job [mcp-integration 2256256]([REDACTED SECRET]/gh/BerriAI/litellm/2256256). Culprit is 5325c4a (#43887), which made run_centralized_common_checks await get_team_membership. The fixtures replace user_api_key_cache with a sync MagicMock, so awaiting async_get_cache raises TypeError and the admission gate fails closed with 401 Invalid or expired credential. The fixtures now patch get_team_membership to return no membership row, the same way they already patch get_team_object and get_project_object

tests/integration/providers/test_databricks_decisions_wire.py::test_an_openai_format_request_at_v1_decisions_reaches_the_serving_endpoint_as_system_one and tests/integration/providers/test_strands_decider_agentcore_wire.py::test_an_arn_deployment_answers_on_every_decisions_route_signed_for_bedrock_agentcore in job [integration-providers 2256241]([REDACTED SECRET]/gh/BerriAI/litellm/2256241). Culprit is 25d9b05 (#45846). Its description says /v1/systemone rows become asystemone while /v1/decisions rows stay adecisions, and the endpoint code does exactly that, but the PR also flipped these two assertions for requests sent to /v1/decisions and /decisions. The ARN test now derives the expected call type per route, still with strict row equality

User Flow

Before: a maintainer reading the scheduled CircleCI run on main sees these jobs red on every run

  1. They open the latest scheduled integration workflow on main
  2. mcp-integration shows 8 failures with 401 Invalid or expired credential
  3. integration-providers shows the two decisions tests expecting asystemone on /v1/decisions

After: the same jobs report only the deferred failures listed under Caveats

  1. They open the CircleCI pipeline run on this branch
  2. mcp-integration passes
  3. The two decisions tests pass in integration-providers

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • 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
  • I have received a Greptile Confidence Score of at least 4/5 before requesting a maintainer review (Greptile reviews automatically once the PR is opened; only comment @greptileai to 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

This is a test-only fix, so the proof is the previously red CircleCI jobs on this branch

Before (541e3ed)

  1. Scheduled main pipeline 91130 has mcp-integration and integration-providers red for the tests above

After (2596cd9)

  1. Branch pipeline 91137 at this tip, failed jobs rerun once
  2. [mcp-integration 2256633]([REDACTED SECRET]/gh/BerriAI/litellm/2256633) and integration-mcp pass, all 8 TestMCPDcrBridgeDelegateAdmission tests green
  3. In [integration-providers 2256733]([REDACTED SECRET]/gh/BerriAI/litellm/2256733) both decisions call type tests pass, the job stays red only on the deferred tests below
  4. Every job green on main pipeline 91130 is green here after the rerun

Type

✅ Test

Caveats (if any)

Medium

  • Deferred, equally red on main pipeline 91130 and outside this fix
  • Flakes seen on this branch only, each in files this diff does not touch, left to the deflake automation
    • test_concurrent_team_model_tpm_requests_reserve_tokens_before_reaching_the_provider 429 race
    • test_intent_without_model_blocked_transcript_reports_a_violation_on_the_whisper_default upstream realtime 403
    • extensions chaos tests test_K1_policy_edge_restart_mid_burst_keeps_output_observation_fail_open and test_passthrough_worker_sigkill_leaves_sibling_serving_and_logging

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
  • 2596cd9 passes /live-pr-risk

Link to Devin session: https://app.devin.ai/sessions/48f595ff47a1467486dbfd4b6696ca32
Open in Devin Desktop: https://app.devin.ai/desktop/session/48f595ff47a1467486dbfd4b6696ca32?variant=devin


Note

Low Risk
Test-only updates to fixtures and assertions; production behavior is unchanged.

Overview
This PR aligns integration and unit test expectations with current production behavior after recent auth and spend-logging changes—no application code is modified.

Decisions wire tests now expect spend-log call_type adecisions for OpenAI-format routes (/v1/decisions, /decisions) and keep asystemone for system-one routes. The Databricks test updates a single assertion; the Strands AgentCore test adds a path→call-type map and checks spend rows per route instead of assuming asystemone for every response.

MCP DCR admission fixtures stub get_team_membership to return no membership row (alongside existing prisma/cache mocks), so centralized admission checks no longer hit an un-awaitable MagicMock cache and fail with 401.

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

…and assert decisions call types per route

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

Copy link
Copy Markdown
Contributor Author

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

@mateo-berri

Copy link
Copy Markdown
Contributor

bugbot run

@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 2596cd9. Configure here.

@codecov

codecov Bot commented Oct 11, 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

@greptileai

@mateo-berri mateo-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.

LGTM

@mateo-berri
mateo-berri merged commit 5390199 into main Oct 11, 2026
134 of 140 checks passed
@mateo-berri
mateo-berri deleted the litellm_circleci_heal_mcp_decisions branch October 11, 2026 05:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant