Skip to content

[litellm-agent] Staging → litellm_internal_staging (5/5/2026) - #27162

Closed
oss-pr-review-agent-shin[bot] wants to merge 0 commit into
litellm_internal_stagingfrom
litellm_agent_oss_staging_05_05_2026
Closed

[litellm-agent] Staging → litellm_internal_staging (5/5/2026)#27162
oss-pr-review-agent-shin[bot] wants to merge 0 commit into
litellm_internal_stagingfrom
litellm_agent_oss_staging_05_05_2026

Conversation

@oss-pr-review-agent-shin

Copy link
Copy Markdown
Contributor

Automated staging PR created by litellm-agent.

This branch collects PRs approved by the agent on 5/5/2026.

@CLAassistant

CLAassistant commented May 5, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 5 committers have signed the CLA.

✅ Chesars
❌ shin-watcher
❌ adickinson72
❌ cursoragent
❌ oss-pr-review-agent-shin[bot]


shin-watcher seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@greptile-apps

greptile-apps Bot commented May 5, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes a tag-overwrite bug in add_litellm_data_to_request: when a caller supplied tags via the x-litellm-tags header or root-level data["tags"] and allow_client_tags=True, the old plain assignment replaced all previously-merged admin/key/team static tags. Replacing it with _merge_tags correctly unions caller and static tags. Two new tests are added, but neither exercises the fixed branch — see inline comment.

Confidence Score: 4/5

Safe to merge — the production fix is correct, with only a test coverage gap.

The code change itself is correct and well-reasoned. Score is 4 (not 5) because the two regression tests don't actually reach the fixed code path, leaving the specific bug unfenced by automated tests.

tests/test_litellm/proxy/test_litellm_pre_call_utils.py — new regression tests should be updated to route tags via the header or root body to cover line 1549.

Important Files Changed

Filename Overview
litellm/proxy/litellm_pre_call_utils.py Replaces plain assignment of caller-supplied tags with _merge_tags, preventing them from overwriting static admin/team/key tags when allow_client_tags=True. Fix is correct and well-commented.
tests/test_litellm/proxy/test_litellm_pre_call_utils.py Adds two regression tests, but neither reaches the fixed branch at line 1549 — both route caller tags through data["metadata"]["tags"] rather than the header/root-body path that add_request_tag_to_metadata reads. Tests pass before and after the fix.

Comments Outside Diff (1)

  1. tests/test_litellm/proxy/test_litellm_pre_call_utils.py, line 1026-1143 (link)

    P2 New tests don't exercise the fixed code path

    Both new tests supply caller tags via data["metadata"]["tags"], which is preserved by the _admin_allow_client_tags strip-gate and then merged through the pre-existing key/team-level _merge_tags calls. By the time add_request_tag_to_metadata(headers, data) runs, it sees no x-litellm-tags header and no root-level data["tags"], so it returns None — and the if tags is not None and _admin_allow_client_tags: branch at the actual fix site (line 1549) never executes. Both tests would pass identically even if the fix were reverted.

    To cover the regression, at least one test should send caller tags via the root-level data["tags"] key (or the x-litellm-tags header) alongside static key/team tags, then assert all survive after the call.

Reviews (1): Last reviewed commit: "Merge PR #27140 into agent staging branc..." | Re-trigger Greptile

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