From 9809b60c76f2d7ca9c17f36d58fbca62675cbeba Mon Sep 17 00:00:00 2001 From: Mark Philipp Date: Mon, 24 Aug 2026 15:10:33 -0700 Subject: [PATCH] fix(proxy): support Python 3.12 health imports --- litellm/proxy/auth/auth_exception_handler.py | 5 +---- litellm/proxy/health_endpoints/_health_endpoints.py | 7 ++----- litellm/proxy/proxy_server.py | 4 +--- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/litellm/proxy/auth/auth_exception_handler.py b/litellm/proxy/auth/auth_exception_handler.py index 21637754252..1ca0bf009a0 100644 --- a/litellm/proxy/auth/auth_exception_handler.py +++ b/litellm/proxy/auth/auth_exception_handler.py @@ -130,10 +130,7 @@ class UserAPIKeyAuthExceptionHandler: database_unavailable: Final = ( PrismaDBExceptionHandler.is_database_connection_error(e) or configured_database_without_client ) - if ( - PrismaDBExceptionHandler.should_allow_request_on_db_unavailable() - and database_unavailable - ): + if PrismaDBExceptionHandler.should_allow_request_on_db_unavailable() and database_unavailable: # log this as a DB failure on prometheus proxy_logging_obj.service_logging_obj.service_failure_hook( service=ServiceTypes.DB, diff --git a/litellm/proxy/health_endpoints/_health_endpoints.py b/litellm/proxy/health_endpoints/_health_endpoints.py index 2f7ebd6cb79..3a635f27e91 100644 --- a/litellm/proxy/health_endpoints/_health_endpoints.py +++ b/litellm/proxy/health_endpoints/_health_endpoints.py @@ -8,7 +8,7 @@ import time import traceback from collections.abc import Iterable, Mapping from datetime import datetime, timedelta -from typing import Any, Final, Literal, NotRequired, ReadOnly, TypedDict, cast +from typing import Any, Final, Literal, NotRequired, TypedDict, cast import fastapi from fastapi import APIRouter, Depends, HTTPException, Request, Response, status @@ -1765,10 +1765,7 @@ async def _resolve_public_readiness_db(response: Response) -> str: return "disconnected" if initial_recovery_pending else "Not connected" db_health_status: Final = await _db_health_readiness_check() - if ( - db_health_status["status"] != "connected" - and _readiness_can_fail_open(db_health_status) is False - ): + if db_health_status["status"] != "connected" and _readiness_can_fail_open(db_health_status) is False: response.status_code = status.HTTP_503_SERVICE_UNAVAILABLE return db_health_status["status"] diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py index ba27a8b3304..580456876fe 100644 --- a/litellm/proxy/proxy_server.py +++ b/litellm/proxy/proxy_server.py @@ -10137,9 +10137,7 @@ class ProxyStartupEvent: for attempt in range(3): try: - result = await global_agent_registry.migrate_legacy_grant_ids( - table=object_permission_table(client) - ) + result = await global_agent_registry.migrate_legacy_grant_ids(table=object_permission_table(client)) if result.rewritten: verbose_proxy_logger.info( "Rewrote %s object_permission rows from legacy config agent ids", result.rewritten