Repository navigation
fix(auth): report unreadable team rows as 503 and open the rust db in the spend logs parity test - #52923
Merged
Conversation
Contributor
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
Contributor
Author
narmstrong-berri
marked this pull request as ready for review
November 19, 2026 20:02
Contributor
Contributor
Contributor
[Medium impact] The PR appears safe to merge.
|
Contributor
Author
Contributor
Author
|
bugbot run |
This was referenced Nov 23, 2026
narmstrong-berri
approved these changes
Nov 24, 2026
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>
devin-ai-integration
Bot
force-pushed
the
litellm_fix_spendlogs_parity_team_lookup
branch
from
November 24, 2026 19:29
f36c4d2 to
363309b
Compare
mateo-berri
enabled auto-merge (squash)
November 24, 2026 19:31
Contributor
Author
Contributor
Author
|
bugbot run |
Contributor
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 363309b. Configure here.
1 of 13 tasks
yuneng-berri
added a commit
that referenced
this pull request
Nov 28, 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.
Handwritten 1-3 sentence description
When the proxy could not read a team from the database, it told callers the team did not exist, which sent people hunting for a deleted team during a database outage. Now an unreadable team row returns a 503 so the outage is visible, and the spend logs parity integration test opens the Rust database it needs since #52176 moved team reads onto it
Details
Link to Devin session: https://app.devin.ai/sessions/137b3aa85599475992a0f318641361ca
Open in Devin Desktop: https://app.devin.ai/desktop/session/137b3aa85599475992a0f318641361ca?variant=devin
Requested by: @narmstrong-berri
TLDR
Problem this solves:
test_pending_delivery_after_reset_matches_queued_legacy_spendfailed 3x on scheduled integration runsNoDatabaseConnectedget_team_objectreported that failed read as "Team doesn't exist in db" (404)How it solves it:
Database.open()/aclose()TeamNotFoundError(404)User Flow
A proxy admin sends
POST /team/member_addwith a team ID and a memberTeam policy is unavailablePre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
uv run pytest tests/unit/<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 moreDelays 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
/qa PASS at
f36c4d27a3841aed8282bbd3605e9cc2056e60e0. The before and after runs used live proxies, PostgreSQL, Redis, and OpenAI for the chat controlPOST /team/member_add, existing team unreadableTeam policy is unavailablePOST /team/member_add, absent teamPOST /team/member_add, team readable againNoDatabaseConnectedThe chat request returned 200 in this outage scenario on both commits
Live proxy commands and output
Run from the repository root at each commit with an initialized
.venv, a workingDATABASE_URLfor disposable local PostgreSQL databases, a localredis-server, andOPENAI_API_KEYin the shell. Save the script below at/tmp/qa52923_live.py. It boots two proxy instances per commit and restores the scratch database schema before testing recoverySpend logs parity and auth tests
Type
🐛 Bug Fix
✅ Test
Caveats (if any)
Medium
user_api_key_authalready keys onTeamNotFoundError, so its fallback is unchangedFinal Attestation
Note
Medium Risk
Changing unreadable team lookups from 404 to 503 alters client-visible behavior during DB outages; callers that treated any 404 as "team missing" must distinguish 503, though auth paths that key on
TeamNotFoundErrorare unchanged.Overview
Failed team database reads now return HTTP 503 with
Team policy is unavailable(and the underlying error chained), instead of a 404 that looked like a missing team. Truly absent teams still raiseTeamNotFoundError(404) with the existing message.The spend logs ledger parity integration test opens the Rust
Databasefor team reads and tears it down withaclose(), fixing failures from team lookups after team reads moved off Prisma-only connections. Unit tests were updated to expect 503 for connection /NoDatabaseConnectedfailures and 404 only for confirmed absences.Reviewed by Cursor Bugbot for commit 363309b. Bugbot is set up for automated code reviews on this repo. Configure here.