Repository navigation
fix: 1.99.0-rc2 UI bug batch (empty org on key create, session pagination, access group rename/delete) - #39436
Conversation
…n_id="" on key create
…on type counts and models server-side
Greptile SummaryThe PR fixes cleared organization handling, conversation-level Request Logs metadata, and access-group synchronization during model rename and deletion
Confidence Score: 5/5The PR appears safe to merge No blocking failure remains
|
| Filename | Overview |
|---|---|
| litellm/proxy/_types.py | Normalizes empty organization IDs to unset values for key generation and update requests |
| litellm/proxy/spend_tracking/spend_management_endpoints.py | Adds capped per-session model aggregation while preserving non-MCP representative selection across all matching rows |
| ui/litellm-dashboard/src/components/view_logs/RequestLogsTableColumns.tsx | Renders conversation-level type counts, spend, and model lists from server aggregates |
| litellm/proxy/management_endpoints/model_management_endpoints.py | Synchronizes access groups after model rename or deletion and persists eligible legacy-endpoint renames |
| litellm/proxy/management_helpers/access_group_model_sync.py | Rewrites access-group model arrays while retaining names still backed by database or config deployments |
Reviews (8): Last reviewed commit: "fix(ui): send an explicit null when the ..." | Re-trigger Greptile
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
A worker whose router has not polled the database yet still lists a sibling under its old name, so a delete or rename handled there kept the stale name in every access group. Only config-sourced deployments count as router backing now; db models are counted in the table.
…nversation A conversation that straddles the bounded page window can be represented by one of its MCP rows, which showed a plain MCP badge and hid the session counts. The badge now reads the server aggregates whenever the conversation has more than one call.
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…ep the conversation badge for MCP representatives Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
|
PR overviewAll previously flagged issues have been addressed. No open security concerns remain on this pull request. Security reviewNo open security issues remain on this pull request. Fixed/addressed: 1 · PR risk: 0/10 |
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
bugbot run |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
Autofix Details
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Cleared org not removed on edit
- Changed handleOrganizationChange to write null instead of undefined on clear so JSON.stringify keeps the field and /key/update actually clears the stored organization.
Or push these changes by commenting:
@cursor push 13c5fbb0fe
Preview (13c5fbb0fe)
diff --git a/ui/litellm-dashboard/src/components/templates/key_edit_view.tsx b/ui/litellm-dashboard/src/components/templates/key_edit_view.tsx
--- a/ui/litellm-dashboard/src/components/templates/key_edit_view.tsx
+++ b/ui/litellm-dashboard/src/components/templates/key_edit_view.tsx
@@ -303,8 +303,11 @@
}
};
- const handleOrganizationChange = (setField: (value: string | undefined) => void, orgId: string | undefined) => {
- setField(orgId || undefined);
+ const handleOrganizationChange = (
+ setField: (value: string | null | undefined) => void,
+ orgId: string | undefined,
+ ) => {
+ setField(orgId || null);
setSelectedOrganizationId(orgId || null);
form.setValue("team_id", undefined);
};You can send follow-ups to the cloud agent here.
…nization Clearing the Organization picker in the key edit form wrote undefined into the form value, and JSON.stringify drops undefined-valued keys, so /key/update never saw the field and the key kept its old organization. Writing null instead survives serialization, and the backend's model_dump(exclude_unset=True) preserves it, so the column is set to NULL.
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 7804574. Configure here.
34d4f7f
into
litellm_internal_staging

TLDR
Problem this solves:
organization_id: ""and 500smodel_name, so Terraform renames never landHow it solves it:
""as unsetsession_models(the conversation's distinct models, capped at 10) to the per-session aggregate fix(ui): paginate request logs by session groups server-side #39257 already runs, and the Model column lists themaccess_model_namesin every group that named the modelmodel_nameand runs the same rewriteUser Flow
Bug 1: key create with a cleared organization picker
Before: an admin who picks an organization on the Create Key form and then clears it gets a server error instead of a key
"organization_id": ""and gets a 500 reading "Organization doesn't exist in db. Organization=. Create organization via/organization/newcall.""organization_id": ""and gets a 400 reading "Authentication Error, Foreign key constraint failed on the field:LiteLLM_VerificationToken_organization_id_fkey (index)", and the key keeps its organizationAfter: the same clicks create a key with no organization
sk-...key"organization_id": ""directly to POST http://localhost:4000/key/generate gets the same 200"organization_id": nulland get a 200, and the key's Organization reads "Not Set" afterwardsBug 2: Request Logs sessions view
Before: an admin reviewing a conversation that alternated two models sees only one of them in the Model column
x-litellm-session-id)After: each conversation row lists every model it used
x-litellm-session-id)Bug 3: model rename or delete and access groups
Before: an admin who renames or deletes a model finds their access group still granting the old name
"model_name": "lit6695-rename-me"and get a 200 with the model id"access_model_names": ["lit6695-rename-me"]and get a 200"model_name": "lit6695-renamed") and get a 200 with the new name["lit6695-rename-me"], and http://localhost:4000/ui/?page=access-groups shows the same stale name"model_name": "lit6695-renamed-tf"and gets a 200, but GET http://localhost:4000/model/info still showslit6695-renamed["lit6695-rename-me"], a model that no longer existsAfter: the group follows the rename and drops the deleted name
"model_name": "lit6695-rename-me"and get a 200 with the model id"access_model_names": ["lit6695-rename-me"]and get a 200"model_name": "lit6695-renamed") and get a 200 with the new name["lit6695-renamed"], and http://localhost:4000/ui/?page=access-groups shows the new name"model_name": "lit6695-renamed-tf"and gets a 200, GET http://localhost:4000/model/info showslit6695-renamed-tf, and the group lists["lit6695-renamed-tf"]Relevant issues
Linear ticket
Resolves LIT-6695
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
uv run pytest tests/test_litellm/<your_test_file>.py -v. Leave the suites (make test-unit-*,make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more@greptileaito re-request a review after pushing changes)Delays in PR merge?
If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).
Screenshots / Proof of Fix
Shared setup: each leg runs its own proxy with a fresh Postgres,
STORE_MODEL_IN_DB=Trueand--num_workers 2, plus the dashboard dev server (npm run devinui/litellm-dashboard), on the ports named under its heading;$Pand$Kare that leg's proxy URL and master key, and the config definesgpt-5.4-nanoandclaude-haiku-4-5. Bug 2 data comes from this loop, which makes 196 real OpenAI and Anthropic calls across three conversations:Before (291e84e)
Proxy at 291e84e on http://localhost:22201 with two workers, dashboard dev server on http://localhost:53502, master key
sk-lit6695-qa-beforeKey create with a cleared organization picker
lit6695-orgin the Organization picker, click the picker's Clear (X), set Key Namelit6695-qa-key, click Create Keylit6695-control-key, click Create KeyAn untouched picker leaves
organization_idout of the payload; picking an organization and clearing it sendsorganization_id: ""lit6695-org, click Clear, click Save ChangesRequest Logs sessions view
lit6695-session-big-120, 72 inlit6695-session-mid-72, 4 inlit6695-session-small-4, each half gpt-5.4-nano and half claude-haiku-4-5)One row per conversation, each on a single page, and the badge matches its tooltip on all three. The Model column shows
anthropic/claude-haiku-4-5for every conversation even though each one alternated gpt-5.4-nano and claude-haiku-4-5lit6695-session-big-120row to open the session drawerThe drawer lists both models for the conversation whose Model cell reads only
anthropic/claude-haiku-4-5session_llm_countis server-side and correct,session_modelsis null on every row, and the row'smodelis the single most recent call's modelModel rename or delete and access groups
lit6695-rename-merow, Edit Settings, set Model Name tolit6695-renamed, Save ChangesThe group derived from the deployment (
lit6695-legacy-group) follows the rename; the unified access group keeps the dead namelitellm_modelresource,model_namefromTF_VAR_model_name) after both workers see the first apply's modelTerraform believes the rename landed (
terraform state showreadsmodel_name = "lit6695-tf-renamed"), the proxy never took it, and a call tolit6695-tf-renamedgets HTTP 400 "Invalid model name"lit6695-shared, a group names it, one deployment is renamed and the other deletedAfter (7804574)
Proxy at 7804574 on http://localhost:29713 with two workers, dashboard dev server on http://localhost:43858, master key
sk-lit6695-qa-afterKey create with a cleared organization picker
lit6695-orgin the Organization picker, click the picker's Clear (X), set Key Namelit6695-qa-key, click Create KeyScreenshots
a4_s1_create_key_org_picked.png,a4_s1_create_key_org_cleared.png,a4_s1_create_key_result.pnglit6695-control-key, click Create KeyBoth paths now leave
organization_idout of the payload; picking an organization and clearing it no longer sendsorganization_id: ""Open that key at http://localhost:43858/api-keys/, Settings tab, Edit Settings, pick
lit6695-orgin the Organization picker, click Clear, click Save ChangesThe form sends
"organization_id": nullinstead of"", the call is a 200, and the organization the key really had is gone. Screenshotsa4_s1_edit_org_selected.png,a4_s1_edit_org_cleared.png,a4_s1_edit_key_after_header.pngThe edit form's Organization picker opens empty (placeholder "All Organizations") even on a key that has an organization, which is why the run picks
lit6695-orgfirst and then clears it. That prefill gap is not part of this PR's diff and behaves the same at the base commitBoth read back with
organization_id: nullRequest Logs sessions view
lit6695-session-big-120, 72 inlit6695-session-mid-72, 4 inlit6695-session-small-4, each half gpt-5.4-nano and half claude-haiku-4-5)One row per conversation, each on a single page, the badge matches its tooltip on all three, and the Model column now lists both models each conversation actually used. Screenshots
a4_s2_logs_page1.png,a4_s2_badge_tooltip.pnglit6695-session-big-120row to open the session drawerThe drawer and the Model cell now agree: both list
gpt-5.4-nanoandclaude-haiku-4-5. Screenshota4_s2_session_drawer.pngsession_modelsis a populated array on every conversation row, and the median grouped call is 68 ms against the before leg's 177 ms, so the LATERAL join did not cost latencyModel rename or delete and access groups
lit6695-rename-merow, Edit Settings, set Model Name tolit6695-renamed, Save ChangesScreenshots
a4_s3_edit_form.png,a4_s3_rename_result.pngThe deployment-derived group (
lit6695-legacy-group) and the unified access group both readlit6695-renamed, and a call against the new name is servedlitellm_modelresource,model_namefromTF_VAR_model_name) after both workers see the first apply's modelThe terraform rename reaches the proxy on the first poll, both workers agree across 20 consecutive
/v1/modelsreads, the tf access group follows the new name, and only the new name serves trafficlit6695-shared, a group names it, one deployment is renamed and the other deletedWhile one deployment still answers to
lit6695-sharedthe group holds both names, and once that deployment is gone the group holds onlylit6695-shared-b. The/model/infoand/v1/modelsreads settle about 20 seconds after each write, so the numbers above are the settled onesType
🐛 Bug Fix
Caveats (if any)
Medium
DEFAULT_ACCESS_GROUP_CACHE_TTL) after a rename; only the worker that handled the rename invalidates its cache immediately/model/infoand/v1/modelscan keep serving the old name for roughly 20 seconds until every worker's router refreshes; the after-leg numbers below are the settled reads on a two-worker proxyLow
POST /key/updatewithorganization_id: ""now detaches the key from its org, matching the edit form's Clear, where the base returned a foreign-key 400null, so a client that omitsorganization_identirely still leaves the key's org untouchedPOST /model/updatewith a differentmodel_namenow renames the deployment, which docs/proxy/model_management.md still describes as changing onlylitellm_paramsormodel_info; a docs update follows once this mergesmodel_nameonly for models without a team, ...when the conversation used more than 10MCP: <tool>names, so a conversation with many distinct tools can push model names past the cap; the trailing, ...still says the list was cutFinal Attestation