mirror of
https://github.com/tiennm99/litellm.git
synced 2026-07-05 23:06:35 +00:00
151d7ab1bc
The asyncio.gather in `_run_centralized_common_checks` ran with `return_exceptions=False` and a single bare `except HTTPException` arm, so an HTTPException from any one fetch (the realistic case is a 404 from `get_team_object` when a token references a deleted team) zeroed out the user, end-user, project, and global-spend contexts in addition to falling back the team object. That silently skipped the user budget, end-user budget, and project enforcement passes inside `common_checks` for the unrelated contexts that had actually fetched fine. Switch to `return_exceptions=True` and apply per-fetch fallback (matches the pre-refactor per-fetch try/except pattern in the builder): - ProxyException / BudgetExceededError still propagate as authz failures. - HTTPException on the team fetch reconstructs from the token; on the other fetches it nulls only that one context. - Successful fetches always reach `common_checks` intact. Adds two unit tests covering the team-404 and user-404 cases to lock the per-fetch isolation in. Drops the inaccurate `PROXY_ADMIN tokens short-circuit` claim from the docstring — admin tokens still flow through `common_checks`; admin status is only honored where the underlying check exempts it.
In total litellm runs 1000+ tests
[02/20/2025] Update:
To make it easier to contribute and map what behavior is tested,
we've started mapping the litellm directory in tests/test_litellm
This folder can only run mock tests.