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.
This commit is contained in:
Krrish Dholakia 2026-07-13 20:11:18 -07:00
parent e1e58f3f98
commit 0bf9d6e8db
2 changed files with 24 additions and 1 deletions

View file

@ -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",
],

View file

@ -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