From 4e0aa8ad0e7ec49cb721db4c1d8e8742ca33edb8 Mon Sep 17 00:00:00 2001 From: factnn <166481866+factnn@users.noreply.github.com> Date: Thu, 25 Jun 2026 23:47:07 +0800 Subject: [PATCH 1/3] fix: persist retry_policy in UpdateRouterConfig UpdateRouterConfig was missing the retry_policy field, causing it to be silently dropped when set via the Admin UI or /config/update. Fixes #31308 --- tests/router_unit_tests/test_router_helper_utils.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/router_unit_tests/test_router_helper_utils.py b/tests/router_unit_tests/test_router_helper_utils.py index 848a6c28a57..d5fe819008e 100644 --- a/tests/router_unit_tests/test_router_helper_utils.py +++ b/tests/router_unit_tests/test_router_helper_utils.py @@ -2833,3 +2833,14 @@ def test_upsert_deployment_clears_stale_budget_config(monkeypatch): router.upsert_deployment(deployment=unbudgeted) assert budget_limiter._get_budget_config_for_deployment(model_id) is None + + +def test_update_router_config_accepts_retry_policy(): + """GH#31308: UpdateRouterConfig must accept retry_policy so + it is not silently dropped when set via UI or /config/update.""" + from litellm.types.router import UpdateRouterConfig + + config = UpdateRouterConfig( + retry_policy={"RateLimitErrorRetries": 3} + ) + assert config.retry_policy == {"RateLimitErrorRetries": 3} From 7dcaf9118d3d8fe1ba002f03a64248b7898a4422 Mon Sep 17 00:00:00 2001 From: factnn <166481866+factnn@users.noreply.github.com> Date: Fri, 26 Jun 2026 00:03:26 +0800 Subject: [PATCH 2/3] fix: add retry_policy to Router.update_settings _allowed_settings Without this, retry_policy is still silently discarded when the router applies the config, even though UpdateRouterConfig now accepts the field. Fixes #31308 --- litellm/router.py | 1 + 1 file changed, 1 insertion(+) diff --git a/litellm/router.py b/litellm/router.py index f408d030b8b..cd6e544eb33 100644 --- a/litellm/router.py +++ b/litellm/router.py @@ -9737,6 +9737,7 @@ class Router: "context_window_fallbacks", "retry_policy", "model_group_retry_policy", + "retry_policy", "model_group_alias", "enable_weighted_failover", ] From e2bf42f08e439a38ea25cd45c466fce5d813fe26 Mon Sep 17 00:00:00 2001 From: factnn <166481866+factnn@users.noreply.github.com> Date: Tue, 7 Jul 2026 01:26:30 +0800 Subject: [PATCH 3/3] fix: remove duplicate retry_policy entry and fix test assertion - Remove duplicate retry_policy in _allowed_settings (already present) - Fix test assertion to compare RetryPolicy object instead of raw dict --- litellm/router.py | 1 - tests/router_unit_tests/test_router_helper_utils.py | 5 +++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/litellm/router.py b/litellm/router.py index cd6e544eb33..51f532ca3c4 100644 --- a/litellm/router.py +++ b/litellm/router.py @@ -9735,7 +9735,6 @@ class Router: "retry_after", "fallbacks", "context_window_fallbacks", - "retry_policy", "model_group_retry_policy", "retry_policy", "model_group_alias", diff --git a/tests/router_unit_tests/test_router_helper_utils.py b/tests/router_unit_tests/test_router_helper_utils.py index d5fe819008e..5b62e80a129 100644 --- a/tests/router_unit_tests/test_router_helper_utils.py +++ b/tests/router_unit_tests/test_router_helper_utils.py @@ -2838,9 +2838,10 @@ def test_upsert_deployment_clears_stale_budget_config(monkeypatch): def test_update_router_config_accepts_retry_policy(): """GH#31308: UpdateRouterConfig must accept retry_policy so it is not silently dropped when set via UI or /config/update.""" - from litellm.types.router import UpdateRouterConfig + from litellm.types.router import UpdateRouterConfig, RetryPolicy config = UpdateRouterConfig( retry_policy={"RateLimitErrorRetries": 3} ) - assert config.retry_policy == {"RateLimitErrorRetries": 3} + assert isinstance(config.retry_policy, RetryPolicy) + assert config.retry_policy.RateLimitErrorRetries == 3