From 8047392b2161b97ab88e4c8de7fd5d95279826a1 Mon Sep 17 00:00:00 2001 From: imviky-ctrl <272028991+imviky-ctrl@users.noreply.github.com> Date: Tue, 5 May 2026 15:48:28 +0530 Subject: [PATCH] fix: add missing provider aliases, fix test semaphore accounting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add vertex_ai_anthropic → anthropic, bedrock_converse → aws, azure_ai → azure to _PROVIDER_MAP so composite providers report the canonical slug instead of their raw internal key - Fix test_fire_and_forget_respects_semaphore_cap to release only as many slots as were actually acquired, preventing semaphore count from exceeding _MAX_INFLIGHT if an assert fires mid-loop --- litellm/integrations/tickerr.py | 3 +++ .../test_tickerr_callback.py | 19 +++++++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/litellm/integrations/tickerr.py b/litellm/integrations/tickerr.py index 72538580d7e..75732d8e515 100644 --- a/litellm/integrations/tickerr.py +++ b/litellm/integrations/tickerr.py @@ -48,7 +48,10 @@ _PROVIDER_MAP: Dict[str, str] = { "fireworks_ai": "fireworks", "openrouter": "openrouter", "azure": "azure", + "azure_ai": "azure", "bedrock": "aws", + "bedrock_converse": "aws", + "vertex_ai_anthropic": "anthropic", "ai21": "ai21", "cerebras": "cerebras", "xai": "xai", diff --git a/tests/logging_callback_tests/test_tickerr_callback.py b/tests/logging_callback_tests/test_tickerr_callback.py index b8f949c0f4d..ca37d82bb6e 100644 --- a/tests/logging_callback_tests/test_tickerr_callback.py +++ b/tests/logging_callback_tests/test_tickerr_callback.py @@ -217,10 +217,21 @@ def test_report_omits_error_type_for_unknown_code(): def test_fire_and_forget_respects_semaphore_cap(): """Reports beyond _MAX_INFLIGHT are dropped silently without blocking.""" - # Exhaust the semaphore by acquiring all slots directly + # Exhaust the semaphore by acquiring all slots directly. + # Track how many we actually acquired so the finally block releases exactly + # that many — releasing more than acquired would push the count above its + # initial maximum and corrupt later tests. + acquired_count = 0 for _ in range(_MAX_INFLIGHT): - acquired = _inflight.acquire(blocking=False) - assert acquired, "semaphore should have slots available at test start" + if _inflight.acquire(blocking=False): + acquired_count += 1 + else: + break + + assert acquired_count == _MAX_INFLIGHT, ( + f"semaphore should have {_MAX_INFLIGHT} slots available at test start, " + f"got {acquired_count}" + ) try: # With semaphore exhausted, _fire_and_forget must return immediately @@ -229,7 +240,7 @@ def test_fire_and_forget_respects_semaphore_cap(): _fire_and_forget({"provider": "openai"}) mock_thread.assert_not_called() finally: - for _ in range(_MAX_INFLIGHT): + for _ in range(acquired_count): _inflight.release()