From 003192d5df22ffa6b4881dd73583f896ac91996d Mon Sep 17 00:00:00 2001 From: Yuneng Jiang Date: Wed, 4 Nov 2026 12:01:20 -0800 Subject: [PATCH 1/3] test(proxy): drop stale team cache update test on 1.108 main removed test_team_cache_update_called in #35643. The 1.108 line already carries the auth cache freshness backport, so update_cache no longer reads the team cache and the test fails --- tests/unit/proxy/auth/test_jwt.py | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/tests/unit/proxy/auth/test_jwt.py b/tests/unit/proxy/auth/test_jwt.py index a7aa379ad37..fb512539126 100644 --- a/tests/unit/proxy/auth/test_jwt.py +++ b/tests/unit/proxy/auth/test_jwt.py @@ -860,35 +860,6 @@ async def test_allowed_routes_admin( import pytest -@pytest.mark.asyncio -async def test_team_cache_update_called(): - import litellm - from litellm.proxy.proxy_server import user_api_key_cache - - # Use setattr to replace the method on the user_api_key_cache object - cache = DualCache() - - setattr( - litellm.proxy.proxy_server, - "user_api_key_cache", - cache, - ) - - with patch.object(cache, "async_batch_get_cache", new=AsyncMock(return_value=[None])) as mock_call_cache: - # Call the function under test - await litellm.proxy.proxy_server.update_cache( - token=None, - user_id=None, - end_user_id=None, - team_id="1234", - response_cost=20, - parent_otel_span=None, - ) # type: ignore - - await asyncio.sleep(3) - mock_call_cache.assert_awaited_once_with(keys=["team_id:1234"], parent_otel_span=None, throttle_redis=False) - - @pytest.fixture def public_jwt_key(): import json From 0b5b41ca1b70fccde7d855d741e17d8f3217a578 Mon Sep 17 00:00:00 2001 From: Yuneng Jiang Date: Wed, 4 Nov 2026 12:04:40 -0800 Subject: [PATCH 2/3] test(bedrock): let GovCloud lag on native structured output on 1.108 Brings over the test-only GovCloud exemption from #46870. The 1.108 cost map already mirrors main, where us-gov Sonnet 5 profiles mark supports_bedrock_native_structured_output false while the commercial base marks it true --- tests/unit/test_utils_get_model_info.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/unit/test_utils_get_model_info.py b/tests/unit/test_utils_get_model_info.py index 09c9079d89e..bfaac44a483 100644 --- a/tests/unit/test_utils_get_model_info.py +++ b/tests/unit/test_utils_get_model_info.py @@ -224,9 +224,20 @@ def test_regional_bedrock_alias_requires_canonical_converse_metadata( _enforce_bedrock_converse_models(model_cost, ()) +GOVCLOUD_LAGGING_CAPABILITIES: Final = frozenset({"supports_bedrock_native_structured_output"}) + + +def _govcloud_may_lag(model_key: str, capability: str) -> bool: + is_govcloud: Final = model_key.startswith("us-gov.") or any( + part.startswith("us-gov-") for part in model_key.split("/") + ) + return is_govcloud and capability in GOVCLOUD_LAGGING_CAPABILITIES + + def test_get_model_info_bedrock_models(): """ Check for drift in base model info for bedrock models and regional model info for bedrock models. + GovCloud regions may lag their commercial base on Bedrock native structured output, never lead it. """ from litellm.llms.bedrock.common_utils import BedrockModelInfo @@ -261,6 +272,9 @@ def test_get_model_info_bedrock_models(): assert ( base_model_key in v ), f"{base_model_key} is not in model cost map for {k}" + if _govcloud_may_lag(k, base_model_key): + assert base_model_value or not v[base_model_key], f"{base_model_key} is on {k} but not its base" + continue assert ( v[base_model_key] == base_model_value ), f"{base_model_key} is not equal to {base_model_value} for model {k}" @@ -297,6 +311,8 @@ def test_get_model_info_bedrock_cross_region_capability_parity(): """ Cross-region inference profiles carry litellm_provider "bedrock_converse", so the regional drift check above (which filters on "bedrock") never reaches them. + GovCloud is a separate AWS partition that gets features later, so a us-gov profile + may lack Bedrock native structured output its commercial base has, never the reverse. """ os.environ["LITELLM_LOCAL_MODEL_COST_MAP"] = "True" litellm.model_cost = litellm.get_model_cost_map(url="") @@ -318,6 +334,9 @@ def test_get_model_info_bedrock_cross_region_capability_parity(): if not cap.startswith("supports_"): continue assert cap in v, f"{cap} is on {base_model_key} but missing from {k}" + if _govcloud_may_lag(k, cap): + assert base_value or not v[cap], f"{cap} is on {k} but not on {base_model_key}" + continue assert ( v[cap] == base_value ), f"{cap} is {v[cap]} on {k} but {base_value} on {base_model_key}" From bbc8484790266864bf99fd4235cb11b56d43bdba Mon Sep 17 00:00:00 2001 From: Yuneng Jiang Date: Wed, 4 Nov 2026 12:23:05 -0800 Subject: [PATCH 3/3] test(utils): stop the register_model replay test leaking gpt-4o pricing on 1.108 Brings over the test_utils.py isolation fix from #47135. The replay test registered openai/gpt-4o with supports_function_calling false into the shared cost map, so a later function calling test on the same worker failed depending on xdist ordering --- tests/unit/test_utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/unit/test_utils.py b/tests/unit/test_utils.py index 7edfb22c121..381883eb284 100644 --- a/tests/unit/test_utils.py +++ b/tests/unit/test_utils.py @@ -4749,7 +4749,8 @@ def test_reapply_runtime_registrations_replays_register_model_overrides( # installed would make this depend on when that happens. monkeypatch.setattr(litellm_utils._LiveDeploymentReplay, "callback", None) - saved_model_cost = litellm.model_cost + saved_model_cost: Final = litellm.model_cost + monkeypatch.setattr(litellm, "model_cost", dict(saved_model_cost)) try: litellm.register_model( model_cost={