feat(shadow-eval): name the shadowed key in job responses and the UI headline - #37221
Merged
Merged
Conversation
Contributor
Greptile SummaryThe PR enriches shadow-evaluation responses with the sampled key’s alias and masked name, then uses those labels in dashboard job headlines.
Confidence Score: 5/5The PR appears safe to merge, with the backend and UI consistently handling present, missing, and deleted key labels. The label lookup uses the same hashed token stored on each job, preserves existing authorization boundaries, batches list enrichment, and keeps the new response fields nullable for backward compatibility.
|
| Filename | Overview |
|---|---|
| litellm/proxy/management_endpoints/auto_router_endpoints.py | Adds consistent key-label enrichment across all shadow-evaluation response endpoints, using a single batched query for lists and null fallbacks for deleted keys. |
| litellm/types/management_endpoints/auto_router_endpoints.py | Adds backward-compatible nullable key_alias and key_name fields to ShadowEvalJobResponse. |
| ui/litellm-dashboard/src/app/(dashboard)/cost-optimization/_components/ShadowEvalSection.tsx | Displays the sampled key in forward and reverse job headlines with alias, masked-name, and shortened-hash fallbacks. |
| tests/test_litellm/proxy/management_endpoints/test_auto_router_endpoints.py | Verifies start, list, and detail label resolution, batched lookup behavior, and deleted-key null handling. |
| ui/litellm-dashboard/src/app/(dashboard)/cost-optimization/_components/ShadowEvalSection.test.tsx | Verifies updated headlines and the complete key-label fallback order. |
| ui/litellm-dashboard/src/lib/http/schema.d.ts | Regenerates the OpenAPI declaration with optional nullable key-label fields. |
Reviews (1): Last reviewed commit: "feat(shadow-eval): name the shadowed key..." | Re-trigger Greptile
tin-berri
enabled auto-merge (squash)
August 17, 2026 22:06
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
yucheng-berri
approved these changes
Aug 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TLDR
Problem this solves:
How it solves it:
User Flow
Before: an admin running shadow evals over several keys cannot tell which key each job samples
"api_key_id": "64c87d65f785...", a hash they must cross-reference against the key list by handAfter: every job names the key it samples, on the card and over the API
prod-batch-alphatraffic viaauto_router1"auto_router1togpt-5on 10% ofprod-batch-alphatraffic""key_alias": "prod-batch-alpha"and"key_name": "sk-...ghYg"next to the hash; a key with no alias falls back to its masked name, and a deleted key returns null for both while the card falls back to the shortened hashRelevant issues
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
tests/test_litellm/directory, Adding at least 1 test is a hard requirement - see detailsmake test-unit[https://docs.litellm.ai/docs/extras/contributing_code]Type
🆕 New Feature
Changes
Backend:
ShadowEvalJobResponsegains nullablekey_aliasandkey_name, resolved from the key row at read time. The start endpoint reads them off the key row it already fetched for validation; list, detail, and stop resolve through one batchedfind_manyover the distinct hashes, so the list path adds a single query rather than one per job. Deleted keys resolve to nullUI: the shadow eval card headline names the shadowed key in both directions, falling back from alias to masked key name to a shortened hash.
schema.d.tsregenerated vianpm run gen:apiHeads up: open PR #36871 moves
api_key_idinto a per-job keys list; these labels rebase onto it as per-key fieldsProof of fix
Live proxy on localhost:4000 backed by a fresh Postgres database, an auto-router (
auto_router1), and the local stub provider. Same commands at the merge base and at this PR's headBefore, at merge base c1fc598, the list response has no key fields:
After, at this branch, create an aliased key and start a job on it:
List and detail both resolve the labels, and the fallbacks hold: a job on a key generated without an alias reports
"key_alias": null, "key_name": "sk-...EY4A", and afterPOST /key/deleteon that key the same job lists"key_alias": null, "key_name": null:UI screenshots of the card headline to follow in a comment (http://localhost:4000/ui/?page=cost-optimization with the job above running)