Skip to content

Conversation

@krrishdholakia
Copy link
Contributor

Title

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
  • I have added a screenshot of my new test passing locally
  • 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

Type

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

Changes

@vercel
Copy link

vercel bot commented Oct 23, 2025

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

Project Deployment Preview Comments Updated (UTC)
litellm Ready Ready Preview Comment Oct 25, 2025 7:10pm

@krrishdholakia krrishdholakia merged commit 1543891 into main Oct 25, 2025
10 of 13 checks passed
@krrishdholakia krrishdholakia changed the title Litellm dev 10 18 2025 p1 Responses API - support tags in metadata Oct 25, 2025
@krrishdholakia krrishdholakia deleted the litellm_dev_10_18_2025_p1 branch October 25, 2025 19:08
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

This is the final PR Bugbot will review for you during this billing cycle

Your free Bugbot reviews will reset on November 25

Details

You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

elif litellm_metadata.get("tags", []):
request_tags = litellm_metadata.get("tags", [])
else:
request_tags = []
Copy link

Choose a reason for hiding this comment

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

Bug: Refactored Code Lacks Type Validation for Tags

The refactored _get_request_tags function no longer validates that tags is actually a list before using it. The old implementation checked isinstance(metadata.get("tags", []), list) to ensure type safety, but the new code directly assigns metadata.get("tags", []) or litellm_metadata.get("tags", []) without validation. If tags is set to a non-list value (e.g., a string or dict), this could cause runtime errors when the code later tries to extend request_tags with user_agent_tags or additional_header_tags (line 4474-4476), since extend() expects an iterable.

Fix in Cursor Fix in Web

elif litellm_metadata.get("tags", []):
request_tags = litellm_metadata.get("tags", [])
else:
request_tags = []
Copy link

Choose a reason for hiding this comment

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

Bug: Metadata Tag Priority Violation

The new logic for _get_request_tags violates the stated priority that "metadata should take priority" over "litellm_metadata". When metadata["tags"] exists but is an empty list [], the condition if metadata.get("tags", []): evaluates to False (since empty lists are falsy), causing the code to fall through and potentially use tags from litellm_metadata instead. The correct behavior should be to use metadata's tags (even if empty) when they exist, and only fall back to litellm_metadata when metadata doesn't have a "tags" key at all. This should be changed to check for key existence: if "tags" in metadata: instead of if metadata.get("tags", []):.

Fix in Cursor Fix in Web

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.

2 participants