From e2779639c03b667c482fae9c0c9a4de41b2022c4 Mon Sep 17 00:00:00 2001 From: yuneng-jiang Date: Fri, 13 Mar 2026 12:35:20 -0700 Subject: [PATCH] [Fix] Fix test_users_in_team_budget using model with no pricing data gpt-3.5-turbo-0301 was removed from the model cost map, so every call had response_cost=0 and team member spend never increased. The wait helper also returned True after 3s regardless of whether spend updated. - Switch fake-openai-endpoint to gpt-3.5-turbo (has pricing in cost map) - Remove premature early-return in wait_for_team_member_spend_update Co-Authored-By: Claude Opus 4.6 --- proxy_server_config.yaml | 2 +- tests/test_team.py | 18 +++--------------- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/proxy_server_config.yaml b/proxy_server_config.yaml index 8ed728c5b28..5d3d810926a 100644 --- a/proxy_server_config.yaml +++ b/proxy_server_config.yaml @@ -46,7 +46,7 @@ model_list: model: dall-e-3 - model_name: fake-openai-endpoint litellm_params: - model: openai/gpt-3.5-turbo-0301 + model: openai/gpt-3.5-turbo api_key: fake-key api_base: https://exampleopenaiendpoint-production.up.railway.app/ - model_name: fake-openai-endpoint-2 diff --git a/tests/test_team.py b/tests/test_team.py index 424e0495d2b..d73e36d1dfe 100644 --- a/tests/test_team.py +++ b/tests/test_team.py @@ -45,9 +45,6 @@ async def wait_for_team_member_spend_update( Wait for the team member spend update to be committed to the database. Polls the user info endpoint until the spend is updated. This is needed because spend updates are queued asynchronously and committed periodically. - - Note: If the model has no pricing (cost = 0), the spend will remain 0.0. - In that case, we just wait a bit to ensure the spend update queue has been processed. """ start_time = time.time() initial_spend = None @@ -62,21 +59,12 @@ async def wait_for_team_member_spend_update( if initial_spend is None: initial_spend = spend print(f"Initial team member spend: {spend}") - - # If spend has been updated (even if still 0), the queue has been processed - # For models with no pricing, spend will be 0, but we still need to wait - # for the update to be committed so the budget check sees the current state + if spend >= expected_min_spend: print(f"[OK] Team member spend updated: {spend} >= {expected_min_spend}") return True - - # If we've waited a reasonable amount and spend is still 0, - # it likely means the model has no pricing, but we should still - # wait a bit more to ensure the update queue has been processed - elapsed = time.time() - start_time - if elapsed > 3.0: # Wait at least 3 seconds for queue processing - print(f"[OK] Waited {elapsed:.1f}s for spend update queue processing (spend: {spend})") - return True + + print(f"[WAITING] Team member spend: {spend}, expected >= {expected_min_spend}, elapsed: {time.time() - start_time:.1f}s") await asyncio.sleep(0.5) except Exception as e: print(f"Error checking team member spend: {e}")