From b8a46d7c6dddaabe6d48c02c0e6e244ed8b99fcf Mon Sep 17 00:00:00 2001 From: Siddharth Srivastava Date: Wed, 4 Nov 2026 02:27:38 +0530 Subject: [PATCH] fix(proxy): include relations and format customer response on /customer/block (#49934) --- litellm/proxy/management_endpoints/customer_endpoints.py | 3 ++- .../proxy/management_endpoints/test_customer_endpoints.py | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/litellm/proxy/management_endpoints/customer_endpoints.py b/litellm/proxy/management_endpoints/customer_endpoints.py index b426369adea..be0b5c50b47 100644 --- a/litellm/proxy/management_endpoints/customer_endpoints.py +++ b/litellm/proxy/management_endpoints/customer_endpoints.py @@ -192,8 +192,9 @@ async def block_user(data: BlockUsers): "create": {"user_id": id, "blocked": True}, "update": {"blocked": True}, }, + include={"litellm_budget_table": True, "object_permission": True}, ) - records.append(record) + records.append(_to_customer_response(record)) await _evict_end_user_cache_keys(_end_user_cache_keys(data.user_ids)) else: raise HTTPException( diff --git a/tests/unit/proxy/management_endpoints/test_customer_endpoints.py b/tests/unit/proxy/management_endpoints/test_customer_endpoints.py index e9f10e8c0db..9ff11b44baf 100644 --- a/tests/unit/proxy/management_endpoints/test_customer_endpoints.py +++ b/tests/unit/proxy/management_endpoints/test_customer_endpoints.py @@ -1289,6 +1289,10 @@ def test_customer_block_success_serializes_db_model_instance(mock_prisma_client, assert body["blocked_users"][0]["user_id"] == "c1" assert body["blocked_users"][0]["blocked"] is True assert body["blocked_users"][0]["spend"] == 0.0 + assert mock_prisma_client.db.litellm_endusertable.upsert.call_args.kwargs["include"] == { + "litellm_budget_table": True, + "object_permission": True, + } def test_customer_delete_invalidates_end_user_and_registry_caches(mock_prisma_client, mock_user_api_key_auth):