From 0bf9d6e8dbdbd95b09bbc356b31dc114b1cece4e Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Mon, 13 Jul 2026 20:11:18 -0700 Subject: [PATCH] fix(router): stop offering forward_client_headers_by_model_group in the UI It's a literal in the OptionalPreCallChecks type union, but add_optional_pre_call_checks has no handler for it - selecting it from the Admin UI's new multi-select would save successfully and show as enabled while the router does nothing with it. Drop it from optional_pre_call_checks' exposed options until it's actually implemented. --- .../router_settings_endpoints.py | 4 +++- .../test_router_settings_endpoints.py | 21 +++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/litellm/types/management_endpoints/router_settings_endpoints.py b/litellm/types/management_endpoints/router_settings_endpoints.py index dfb513cdd5f..72d1cd2f30d 100644 --- a/litellm/types/management_endpoints/router_settings_endpoints.py +++ b/litellm/types/management_endpoints/router_settings_endpoints.py @@ -243,13 +243,15 @@ ROUTER_SETTINGS_FIELDS: List[RouterSettingsField] = [ "that cached the prompt." ), field_default=[], + # "forward_client_headers_by_model_group" is excluded: it's a literal in the + # OptionalPreCallChecks type union, but add_optional_pre_call_checks has no + # handler for it, so selecting it from the UI would silently do nothing. options=[ "prompt_caching", "router_budget_limiting", "responses_api_deployment_check", "deployment_affinity", "session_affinity", - "forward_client_headers_by_model_group", "enforce_model_rate_limits", "encrypted_content_affinity", ], diff --git a/tests/test_litellm/proxy/management_endpoints/test_router_settings_endpoints.py b/tests/test_litellm/proxy/management_endpoints/test_router_settings_endpoints.py index 348d74a36fd..a924e2a49b8 100644 --- a/tests/test_litellm/proxy/management_endpoints/test_router_settings_endpoints.py +++ b/tests/test_litellm/proxy/management_endpoints/test_router_settings_endpoints.py @@ -97,6 +97,27 @@ class TestRouterSettingsEndpoints: assert field is not None assert "prompt_caching" in field["options"] + @pytest.mark.asyncio + async def test_get_router_fields_excludes_unimplemented_forward_client_headers_check(self): + """ + Regression test: "forward_client_headers_by_model_group" is a literal in the + OptionalPreCallChecks type union, but Router.add_optional_pre_call_checks has + no handler for it - selecting it from the Admin UI's multi-select would save + successfully and show as enabled while doing nothing. It must not be offered + as an option until it's actually implemented. + """ + response = client.get( + "/router/fields", headers={"Authorization": "Bearer sk-1234"} + ) + assert response.status_code == 200 + + fields = response.json()["fields"] + field = next( + (f for f in fields if f["field_name"] == "optional_pre_call_checks"), None + ) + assert field is not None + assert "forward_client_headers_by_model_group" not in field["options"] + @pytest.mark.asyncio async def test_get_router_settings_includes_routing_groups_from_live_router( self, monkeypatch