Skip to content

[Fix] CICD 26/02/26 - #22151

Merged
Sameerlite merged 23 commits into
mainfrom
litellm_fix_cicd_26_02
Feb 26, 2026
Merged

[Fix] CICD 26/02/26#22151
Sameerlite merged 23 commits into
mainfrom
litellm_fix_cicd_26_02

Conversation

@Sameerlite

Copy link
Copy Markdown
Contributor

Relevant issues

Pre-Submission checklist

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

  • I have Added testing in the tests/litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem
  • I have requested a Greptile review by commenting @greptileai and received a Confidence Score of at least 4/5 before requesting a maintainer review

CI (LiteLLM team)

CI status guideline:

  • 50-55 passing tests: main is stable with minor issues.
  • 45-49 passing tests: acceptable but needs attention
  • <= 40 passing tests: unstable; be careful with your merges and assess the risk.
  • Branch creation CI run
    Link:

  • CI run for the last commit
    Link:

  • Merge / cherry-pick CI run
    Links:

Type

🆕 New Feature
🐛 Bug Fix
🧹 Refactoring
📖 Documentation
🚄 Infrastructure
✅ Test

Changes

@vercel

vercel Bot commented Feb 26, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
litellm Ready Ready Preview, Comment Feb 26, 2026 7:53am

Request Review

@greptile-apps

greptile-apps Bot commented Feb 26, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

CI/CD fix PR that addresses type-checking issues, resolves merge conflicts, fixes test flakiness, and tightens guardrail exception matching.

  • Type-safety improvements: Added cast() calls across multiple files (realtime_streaming.py, router.py, ai_usage_chat.py, user_api_key_auth_mcp.py) and switched to setattr() for usage assignment in Bedrock Qwen2/Qwen3 transformations to satisfy type checkers
  • Import cleanup: Reformatted multi-line imports in _types.py to one-per-line style, removed unused MCPAuth import, consolidated duplicate Usage imports in Bedrock transformations
  • Bug fix in http_parsing_utils.py: Added defensive null-check for request.state before accessing _cached_headers, preventing AttributeError when request objects lack a state attribute. Corresponding test mock updated.
  • Type narrowing in db_spend_update_writer.py: Changed payload_copy parameter type from dict to SpendLogsPayload, matching the actual return type of get_logging_payload()
  • Merge conflict resolution in ToolPolicies.tsx: Removed git merge conflict markers (<<<<<<<, =======, >>>>>>>) that were previously committed to main
  • Test fixes: Added **kwargs to health check mock, added request_duration_ms to GCS pub/sub ignored keys, added state attribute to mock request
  • Guardrail policy update: Narrowed exception phrases in MAS transparency/explainability policy — this is a behavioral change that may increase false positives on legitimate queries

Confidence Score: 4/5

  • This PR is safe to merge — mostly type-checking fixes and test stabilization with one behavioral change in guardrail exceptions worth verifying.
  • The vast majority of changes are non-behavioral: import reformatting, type casts, merge conflict resolution, and test fixture updates. The one behavioral change (narrowing guardrail exceptions) is intentional but could cause false positives. The defensive null-check in http_parsing_utils.py is a genuine bug fix with matching test coverage.
  • Pay close attention to litellm/proxy/guardrails/guardrail_hooks/litellm_content_filter/policy_templates/sg_mas_transparency_explainability.yaml — the narrowed exception phrases change blocking behavior.

Important Files Changed

Filename Overview
litellm/litellm_core_utils/realtime_streaming.py Added cast import and applied type casts to satisfy type checkers — no behavioral change.
litellm/llms/bedrock/chat/invoke_transformations/amazon_qwen3_transformation.py Same changes as qwen2: consolidated duplicate Usage import and used setattr for usage assignment for type safety.
litellm/proxy/_types.py Reformatted imports (line-per-import style), removed unused MCPAuth import, and cleaned up backslash-continuation imports. No behavioral changes.
litellm/proxy/common_utils/http_parsing_utils.py Fixed potential AttributeError by safely checking request.state existence before accessing _cached_headers. Defensive null-check prevents crashes when request objects lack a state attribute.
litellm/proxy/db/db_spend_update_writer.py Tightened payload_copy parameter type from dict to SpendLogsPayload, matching the actual type returned by get_logging_payload().
litellm/proxy/guardrails/guardrail_hooks/litellm_content_filter/policy_templates/sg_mas_transparency_explainability.yaml Narrowed guardrail exception phrases: "explainability" → "improve/add explainability", "audit trail" → "with/add audit trail". This tightens when the guardrail is bypassed, which may cause false positives on legitimate queries.
tests/pass_through_unit_tests/test_pass_through_unit_tests.py Added state attribute to MockRequest to match the defensive null-check added to _safe_get_request_headers.
ui/litellm-dashboard/src/components/ToolPolicies.tsx Resolved git merge conflict markers that were previously committed to main — removed <<<<<<< cursor/..., =======, and >>>>>>> main markers and duplicate code blocks.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Incoming Request] --> B{request.state exists?}
    B -->|Yes| C{_cached_headers set?}
    B -->|No| D[Read request.headers]
    C -->|Yes| E[Return cached headers]
    C -->|No| D
    D --> F{state is not None?}
    F -->|Yes| G[Cache headers on state]
    F -->|No| H[Skip caching]
    G --> I[Return headers]
    H --> I

    J[Guardrail Check] --> K{Exception substring in text?}
    K -->|Old: 'explainability' matched| L[Skip block - broad match]
    K -->|New: 'improve explainability' only| M[Narrower match - may block more]
    M --> N{Identifier + block word found?}
    N -->|Yes| O[Block request]
    N -->|No| P[Allow request]
Loading

Last reviewed commit: f8e0b37

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

14 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Comment on lines +72 to +77
- "improve explainability"
- "add explainability"
- "interpretability"
- "model card"
- "audit trail"
- "with audit trail"
- "add audit trail"

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.

Narrowed exceptions may cause false positives

The exception matching uses substring matching (if exception in text_lower). Previously, "explainability" would match any text containing that word (e.g., "discuss explainability requirements"). Now, only "improve explainability" and "add explainability" will match, so a query like "what are the explainability requirements for this model?" would no longer be exempted and could be incorrectly blocked.

Similarly, "audit trail" previously matched "ensure we have an audit trail", but now only "with audit trail" and "add audit trail" will match—missing phrasings like "ensure audit trail compliance".

Was this intentional tightening? If so, consider adding more exception variants (e.g., "ensure explainability", "require explainability", "maintain audit trail", "ensure audit trail") to avoid blocking legitimate compliance-focused queries.

@Sameerlite
Sameerlite merged commit 4d68151 into main Feb 26, 2026
65 of 82 checks passed
@ishaan-berri
ishaan-berri deleted the litellm_fix_cicd_26_02 branch March 26, 2026 22:29
fzowl pushed a commit to fzowl/litellm that referenced this pull request Jun 24, 2026
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