Skip to content

Revert "Litellm tuesday cicd release"#20330

Merged
Sameerlite merged 1 commit intomainfrom
revert-20328-litellm_tuesday_cicd_release
Feb 3, 2026
Merged

Revert "Litellm tuesday cicd release"#20330
Sameerlite merged 1 commit intomainfrom
revert-20328-litellm_tuesday_cicd_release

Conversation

@Sameerlite
Copy link
Collaborator

Reverts #20328

@vercel
Copy link

vercel bot commented Feb 3, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
litellm Building Building Preview, Comment Feb 3, 2026 8:59am

Request Review

@Sameerlite Sameerlite merged commit 80acd4c into main Feb 3, 2026
7 of 11 checks passed
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 3, 2026

Greptile Overview

Greptile Summary

This PR reverts #20328, restoring three main changes:

1. Database Performance Improvements

  • Re-adds three indexes on LiteLLM_VerificationToken table for user_id/team_id, team_id, and budget_reset_at/expires columns
  • Includes proper migration SQL and schema updates across all three prisma schema files

2. Access Group Filtering (Issue #18333 Fix)

  • Re-introduces filter_deployments_by_access_groups() to prevent cross-team load balancing when teams have models with the same name in different access groups
  • Adds get_access_groups_from_models() helper to extract access group names from model lists
  • Integrates filtering into the router's deployment selection pipeline

3. MCP Test Cleanup

  • Removes conditional skip for semantic-router dependency in tests
  • Simplifies test setup by removing _build_router() calls
  • Removes 4 MCP semantic filter environment variable docs

Key Issues:

  • The access group filtering implementation calls llm_router.get_model_access_groups() on every request in litellm_pre_call_utils.py:1031, which iterates over the entire model list. This violates the performance guideline about avoiding expensive operations in the critical request path and could cause performance degradation on routers with many models.

Confidence Score: 2/5

  • This PR has a significant performance concern that should be addressed before merging
  • While the revert restores valuable functionality (database indexes and access group filtering), it reintroduces a performance issue where get_model_access_groups() is called on every request, iterating over all models in the router. This violates the custom rule about avoiding expensive operations in the request path and could significantly impact performance for deployments with large model lists.
  • Pay close attention to litellm/proxy/litellm_pre_call_utils.py where the performance-impacting call occurs on every request

Important Files Changed

Filename Overview
litellm/proxy/litellm_pre_call_utils.py Adds llm_router.get_model_access_groups() call on every request, which iterates over model list and may cause performance degradation
litellm/router_utils/common_utils.py Adds filter_deployments_by_access_groups function to fix cross-team loadbalancing issue (#18333), logic looks correct
litellm/router.py Integrates access group filter into deployment selection, simple addition to existing filter chain
litellm-proxy-extras/litellm_proxy_extras/migrations/20260129103648_add_verificationtoken_indexes/migration.sql Adds database indexes on VerificationToken table to improve query performance

Sequence Diagram

sequenceDiagram
    participant Client
    participant Proxy as Proxy (litellm_pre_call_utils)
    participant Router as Router
    participant Filter as filter_deployments_by_access_groups
    participant Deployment as Deployment Selection

    Client->>Proxy: API Request with API Key
    Note over Proxy: add_litellm_data_to_request()
    
    alt llm_router exists
        Proxy->>Router: get_model_access_groups()
        Note over Router: Iterates over ALL models<br/>in model_list (performance concern)
        Router-->>Proxy: model_access_groups dict
        
        Proxy->>Proxy: get_access_groups_from_models()<br/>for key models
        Proxy->>Proxy: get_access_groups_from_models()<br/>for team models
        
        Note over Proxy: Store in metadata:<br/>- user_api_key_allowed_access_groups<br/>- user_api_key_team_allowed_access_groups
    end
    
    Proxy->>Router: Route request
    Note over Router: Get healthy deployments
    Router->>Filter: filter_deployments_by_access_groups()
    
    Note over Filter: Read access groups from metadata<br/>Filter deployments by access_groups
    Filter-->>Router: Filtered deployments
    
    Router->>Deployment: Select from filtered deployments
    Deployment-->>Client: Response
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

4 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Comment on lines +1028 to +1031
if llm_router is not None:
from litellm.proxy.auth.model_checks import get_access_groups_from_models

model_access_groups = llm_router.get_model_access_groups()
Copy link
Contributor

Choose a reason for hiding this comment

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

Calling llm_router.get_model_access_groups() on every request may cause performance issues. This method calls get_model_list() and iterates over all models (line 7530-7542 in router.py), which could be expensive for routers with many models. Consider caching the result or moving this computation outside the critical request path.

Context Used: Rule from dashboard - What: Avoid creating new database requests or Router objects in the critical request path.

Why: Cre... (source)

Prompt To Fix With AI
This is a comment left during a code review.
Path: litellm/proxy/litellm_pre_call_utils.py
Line: 1028:1031

Comment:
Calling `llm_router.get_model_access_groups()` on every request may cause performance issues. This method calls `get_model_list()` and iterates over all models (line 7530-7542 in `router.py`), which could be expensive for routers with many models. Consider caching the result or moving this computation outside the critical request path.

**Context Used:** Rule from `dashboard` - What: Avoid creating new database requests or Router objects in the critical request path.

Why: Cre... ([source](https://app.greptile.com/review/custom-context?memory=0c2a17ad-5f29-423f-a48b-371852ac4169))

How can I resolve this? If you propose a fix, please make it concise.

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