Skip to content

Conversation

@dtikhonov
Copy link

Title

Fix tag management to preserve encrypted fields in litellm_params

Relevant issues

None previously filed that I could find.

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
image

Type

🐛 Bug Fix

Changes

The _add_tag_to_deployment function was directly modifying the deployment's litellm_params in memory and writing it back to the database, which caused encrypted API keys and other sensitive fields to be lost. This fix retrieves the model from the database first, preserves all existing fields including encrypted ones, adds only the new tag to the tags array, and updates the database with the modified params while keeping encrypted fields intact.

Added comprehensive unit tests covering preservation of encrypted fields, handling of both string and dict litellm_params formats, duplicate tag prevention, and error handling for missing models.

The _add_tag_to_deployment function was directly modifying the
deployment's litellm_params in memory and writing it back to the
database, which caused encrypted API keys and other sensitive fields
to be lost. This fix retrieves the model from the database first,
preserves all existing fields including encrypted ones, adds only the
new tag to the tags array, and updates the database with the modified
params while keeping encrypted fields intact.

Added comprehensive unit tests covering preservation of encrypted
fields, handling of both string and dict litellm_params formats,
duplicate tag prevention, and error handling for missing models.

Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@vercel
Copy link

vercel bot commented Dec 4, 2025

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

Project Deployment Preview Comments Updated (UTC)
litellm Ready Ready Preview Comment Dec 4, 2025 3:27pm

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