fix(container): keep ownership-filter exceptions out of the LLM-error path

filter_container_list_response runs after the upstream call has
already succeeded; treating an ownership-lookup failure as an LLM-API
error fires post_call_failure_hook for a successful upstream call and
returns a misleading provider-shaped error to the client. Run the
filter outside the try/except so genuine LLM errors stay scoped to
the upstream call.
This commit is contained in:
user 2026-05-04 22:43:18 +00:00
parent c01f209723
commit 4fa577810b
No known key found for this signature in database

View file

@ -241,11 +241,6 @@ async def list_containers(
user_api_base=user_api_base,
version=version,
)
return await filter_container_list_response(
response=response,
user_api_key_dict=user_api_key_dict,
custom_llm_provider=custom_llm_provider,
)
except Exception as e:
raise await processor._handle_llm_api_exception(
e=e,
@ -254,6 +249,16 @@ async def list_containers(
version=version,
)
# Ownership filtering runs OUTSIDE the LLM-exception scope: a DB error
# in the ownership lookup is not an LLM-API error and shouldn't be
# translated to a provider-shaped failure (which would also fire the
# post_call_failure_hook for what is in fact a successful upstream call).
return await filter_container_list_response(
response=response,
user_api_key_dict=user_api_key_dict,
custom_llm_provider=custom_llm_provider,
)
@router.get(
"/v1/containers/{container_id}",