Skip to content

Revert "feat(guardrails): implement team-based isolation guardrails mgmnt" - #20393

Merged
1 commit merged into
litellm_oss_staging_02_03_2026from
revert-19889-feat/own-team-guardrail-mgmnt
Feb 4, 2026
Merged

Revert "feat(guardrails): implement team-based isolation guardrails mgmnt"#20393
1 commit merged into
litellm_oss_staging_02_03_2026from
revert-19889-feat/own-team-guardrail-mgmnt

Conversation

@ghost

@ghost ghost commented Feb 4, 2026

Copy link
Copy Markdown

Reverts #19889

@vercel

vercel Bot commented Feb 4, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
litellm Building Building Preview, Comment Feb 4, 2026 4:55am

Request Review

@ghost
ghost merged commit ca34b4e into litellm_oss_staging_02_03_2026 Feb 4, 2026
3 of 4 checks passed
@ghost
ghost deleted the revert-19889-feat/own-team-guardrail-mgmnt branch February 4, 2026 04:59
@greptile-apps

greptile-apps Bot commented Feb 4, 2026

Copy link
Copy Markdown
Contributor

Greptile Overview

Greptile Summary

This PR reverts PR #19889 which implemented team-based isolation for guardrails management. The revert removes team-specific guardrail configuration capabilities and returns to a global guardrails-only model.

Key changes reverted:

  • Removed team_id field from guardrails database schema
  • Removed allow_team_guardrail_config permission flag from teams
  • Removed team-based access control from guardrail CRUD endpoints
  • Deleted team isolation tests and simplified guardrail endpoint tests
  • Removed UI components for team guardrail configuration

Critical issue found:

  • The revert is incomplete - litellm-proxy-extras/litellm_proxy_extras/schema.prisma still contains the team_id field in LiteLLM_GuardrailsTable and allow_team_guardrail_config in both LiteLLM_TeamTable and LiteLLM_DeletedTeamTable. This creates a schema mismatch between the main schema files and the proxy extras schema.

Confidence Score: 2/5

  • PR has schema inconsistencies that will cause database issues
  • Incomplete revert with schema mismatch in litellm-proxy-extras will cause database migration and runtime issues
  • litellm-proxy-extras/litellm_proxy_extras/schema.prisma requires immediate attention to remove leftover team-based guardrail fields

Important Files Changed

Filename Overview
litellm/proxy/guardrails/guardrail_endpoints.py Removed team-based isolation logic, moved CreateGuardrailRequest/UpdateGuardrailRequest back to local classes, removed team_id filtering
litellm/proxy/guardrails/guardrail_registry.py Removed team_id parameter from add_guardrail_to_db, update_guardrail_in_db, delete_guardrail_from_db and get_all_guardrails_from_db
litellm/proxy/schema.prisma Removed team_id from LiteLLM_GuardrailsTable and allow_team_guardrail_config from TeamTable/DeletedTeamTable
schema.prisma Removed team_id from LiteLLM_GuardrailsTable and allow_team_guardrail_config from TeamTable/DeletedTeamTable
litellm-proxy-extras/litellm_proxy_extras/schema.prisma Schema file not updated by revert - still contains team_id in GuardrailsTable and allow_team_guardrail_config in TeamTable/DeletedTeamTable

Sequence Diagram

sequenceDiagram
    participant User
    participant GuardrailEndpoint as Guardrail Endpoints
    participant GuardrailRegistry as Guardrail Registry
    participant Database as Prisma DB
    
    Note over User,Database: Before Revert (With Team Isolation)
    User->>GuardrailEndpoint: POST /guardrails (with team_id)
    GuardrailEndpoint->>GuardrailEndpoint: Check team permissions
    GuardrailEndpoint->>Database: Verify allow_team_guardrail_config
    Database-->>GuardrailEndpoint: Return team config
    GuardrailEndpoint->>GuardrailRegistry: add_guardrail_to_db(guardrail, team_id)
    GuardrailRegistry->>Database: INSERT with team_id
    Database-->>GuardrailRegistry: Success
    GuardrailRegistry-->>GuardrailEndpoint: Guardrail created
    GuardrailEndpoint-->>User: 200 OK
    
    Note over User,Database: After Revert (Global Only)
    User->>GuardrailEndpoint: POST /guardrails
    GuardrailEndpoint->>GuardrailRegistry: add_guardrail_to_db(guardrail)
    GuardrailRegistry->>Database: INSERT (no team_id)
    Database-->>GuardrailRegistry: Success
    GuardrailRegistry-->>GuardrailEndpoint: Guardrail created
    GuardrailEndpoint-->>User: 200 OK
    
    Note over User,Database: List Guardrails - Before vs After
    User->>GuardrailEndpoint: GET /v2/guardrails/list
    alt Before: Team-filtered
        GuardrailEndpoint->>Database: SELECT WHERE team_id = user.team_id
    else After: Global view
        GuardrailEndpoint->>Database: SELECT * (no team filter)
    end
    Database-->>GuardrailEndpoint: Guardrails list
    GuardrailEndpoint-->>User: Return guardrails
Loading

@greptile-apps greptile-apps 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.

5 files reviewed, 3 comments

Edit Code Review Agent Settings | Greptile

@greptile-apps

greptile-apps Bot commented Feb 4, 2026

Copy link
Copy Markdown
Contributor
Additional Comments (3)

litellm-proxy-extras/litellm_proxy_extras/schema.prisma
revert missed removing team_id field from LiteLLM_GuardrailsTable

  guardrail_info Json?
  created_at DateTime @default(now())
Prompt To Fix With AI
This is a comment left during a code review.
Path: litellm-proxy-extras/litellm_proxy_extras/schema.prisma
Line: 779:779

Comment:
revert missed removing `team_id` field from `LiteLLM_GuardrailsTable`

```suggestion
  guardrail_info Json?
  created_at DateTime @default(now())
```

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

litellm-proxy-extras/litellm_proxy_extras/schema.prisma
revert missed removing allow_team_guardrail_config field from LiteLLM_TeamTable

    model_id Int? @unique // id for LiteLLM_ModelTable -> stores team-level model aliases
    litellm_organization_table LiteLLM_OrganizationTable?   @relation(fields: [organization_id], references: [organization_id])
Prompt To Fix With AI
This is a comment left during a code review.
Path: litellm-proxy-extras/litellm_proxy_extras/schema.prisma
Line: 132:132

Comment:
revert missed removing `allow_team_guardrail_config` field from `LiteLLM_TeamTable`

```suggestion
    model_id Int? @unique // id for LiteLLM_ModelTable -> stores team-level model aliases
    litellm_organization_table LiteLLM_OrganizationTable?   @relation(fields: [organization_id], references: [organization_id])
```

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

litellm-proxy-extras/litellm_proxy_extras/schema.prisma
revert missed removing allow_team_guardrail_config field from LiteLLM_DeletedTeamTable

    model_id                Int?     // id for LiteLLM_ModelTable -> stores team-level model aliases
    
Prompt To Fix With AI
This is a comment left during a code review.
Path: litellm-proxy-extras/litellm_proxy_extras/schema.prisma
Line: 164:164

Comment:
revert missed removing `allow_team_guardrail_config` field from `LiteLLM_DeletedTeamTable`

```suggestion
    model_id                Int?     // id for LiteLLM_ModelTable -> stores team-level model aliases
    
```

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

fzowl pushed a commit to fzowl/litellm that referenced this pull request Jun 24, 2026
This pull request was closed.
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.

0 participants