From d663094202fd05fcc19a180a1275bb3d01d6899f Mon Sep 17 00:00:00 2001 From: Jason Cook Date: Thu, 16 Apr 2026 20:58:40 -0400 Subject: [PATCH] docs(db_authenticator): explain the inline imports in persist_credential_to_db Greptile flagged the inline proxy imports as an acknowledged P2 style nit. Documenting the two real reasons they're inline so the next reader doesn't 'fix' them into a module-level import and break things. Co-Authored-By: Claude Opus 4.7 (1M context) --- litellm/llms/chatgpt/db_authenticator.py | 4 ++++ litellm/llms/github_copilot/db_authenticator.py | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/litellm/llms/chatgpt/db_authenticator.py b/litellm/llms/chatgpt/db_authenticator.py index e1abed66b84..9d823120516 100644 --- a/litellm/llms/chatgpt/db_authenticator.py +++ b/litellm/llms/chatgpt/db_authenticator.py @@ -147,6 +147,10 @@ async def persist_credential_to_db(item: CredentialItem) -> None: login endpoint (which can ``await`` it directly on the request event loop). """ + # Inline imports: proxy_server transitively imports this module via + # the OAuth router (avoids circular), and prisma_client is a + # module-level global mutated at proxy startup — a top-level import + # would bind the stale None reference rather than the live client. from litellm.proxy.common_utils.encrypt_decrypt_utils import encrypt_value_helper from litellm.proxy.proxy_server import prisma_client diff --git a/litellm/llms/github_copilot/db_authenticator.py b/litellm/llms/github_copilot/db_authenticator.py index 866ec3f3d31..a2470f4320d 100644 --- a/litellm/llms/github_copilot/db_authenticator.py +++ b/litellm/llms/github_copilot/db_authenticator.py @@ -159,6 +159,10 @@ def _persist_item_sync(item: CredentialItem) -> None: async def persist_credential_to_db(item: CredentialItem) -> None: + # Inline imports: proxy_server transitively imports this module via + # the OAuth router (avoids circular), and prisma_client is a + # module-level global mutated at proxy startup — a top-level import + # would bind the stale None reference rather than the live client. from litellm.proxy.common_utils.encrypt_decrypt_utils import encrypt_value_helper from litellm.proxy.proxy_server import prisma_client