fix(vault): resolve merge conflict, use async auth, include error details

- Remove duplicate description kwarg in supported_db_objects Field()
  that caused SyntaxError preventing proxy startup
- Wrap sync _get_request_headers() in asyncio.to_thread to avoid
  blocking the event loop during AppRole/TLS cert auth
- Include exception messages in error responses for admin-only
  endpoints to aid debugging
This commit is contained in:
Ryan Crabbe 2026-03-05 17:40:51 -08:00
parent 11f83ff522
commit 73a8e8cf07
2 changed files with 5 additions and 5 deletions

View file

@ -2169,7 +2169,6 @@ class ConfigGeneralSettings(LiteLLMPydanticObjectBase):
supported_db_objects: Optional[List[SupportedDBObjectType]] = Field(
None,
description="Fine-grained control over which object types to load from the database when store_model_in_db is True. Available types: 'models', 'mcp', 'guardrails', 'vector_stores', 'pass_through_endpoints', 'prompts', 'model_cost_map', 'tools', 'config_overrides'. If not set, all objects are loaded (default behavior).",
description="Fine-grained control over which object types to load from the database when store_model_in_db is True. Available types: 'models', 'mcp', 'guardrails', 'vector_stores', 'pass_through_endpoints', 'prompts', 'model_cost_map', 'tools'. If not set, all objects are loaded (default behavior).",
)
user_mcp_management_mode: Optional[UserMCPManagementMode] = Field(
None,

View file

@ -1,3 +1,4 @@
import asyncio
import json
import os
from typing import Any, Dict, Set
@ -216,7 +217,7 @@ async def update_hashicorp_vault_config(
)
raise HTTPException(
status_code=500,
detail="Failed to initialize secret manager",
detail=f"Failed to initialize secret manager: {e}",
)
# Only persist to DB after successful init
@ -378,11 +379,11 @@ async def test_hashicorp_vault_connection(
# Step 1: Authenticate (exercises AppRole login, TLS cert login, or direct token)
try:
headers = client._get_request_headers()
headers = await asyncio.to_thread(client._get_request_headers)
except Exception as e:
raise HTTPException(
status_code=502,
detail="Vault authentication failed",
detail=f"Vault authentication failed: {e}",
)
# Step 2: Verify the token is valid via token/lookup-self
@ -396,7 +397,7 @@ async def test_hashicorp_vault_connection(
except Exception as e:
raise HTTPException(
status_code=502,
detail="Vault token validation failed",
detail=f"Vault token validation failed: {e}",
)
return {