fix(router): classify pass-through cooldown against pass-through deployments only

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
yassin 2026-09-13 09:48:35 +00:00
parent 10f411e60d
commit e61b6bfd5f
2 changed files with 24 additions and 1 deletions

View file

@ -13989,6 +13989,11 @@ class Router:
model=model,
llm_provider="",
)
pass_through_model_ids: Final = tuple(
deployment["model_info"]["id"]
for deployment in pass_through_deployments
if "id" in deployment.get("model_info", {})
)
# 4. Apply health-check and cooldown filtering
parent_otel_span: Final[Span | None] = _get_parent_otel_span_from_kwargs(request_kwargs)
@ -14026,7 +14031,7 @@ class Router:
cooldown_time=_cooldown_time,
enable_pre_call_checks=self.enable_pre_call_checks,
cooldown_list=_cooldown_list,
model_ids=model_ids,
model_ids=pass_through_model_ids,
)
# 6. Apply load balancing strategy

View file

@ -7818,6 +7818,24 @@ def test_get_available_deployment_for_pass_through_raises_when_dict_blocked():
)
def test_get_available_deployment_for_pass_through_names_cooldown_despite_healthy_non_pass_through():
from litellm.types.router import RouterRateLimitError
router: Final = _router_with_two_pass_through_deployments([False, False])
router.add_deployment(
Deployment(
model_name="gpt-4o",
litellm_params=LiteLLM_Params(model="openai/gpt-4o-plain", api_key="sk-fake-for-tests"),
model_info=ModelInfo(id="plain-0"),
)
)
_cool_down(router, "pt-0", "pt-1")
with pytest.raises(RouterRateLimitError) as exc_info:
router.get_available_deployment_for_pass_through(model="gpt-4o", request_kwargs={})
assert exc_info.value.all_deployments_in_cooldown is True
assert exc_info.value.type == "all_deployments_in_cooldown"
def test_initialize_deployment_for_pass_through_keeps_bedrock_iam_deployment():
"""
Bedrock deployments using IAM/OIDC auth have no api_key; pass-through