The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
fix(ui): fix Router Settings Loadbalancing tab save (LIT-4057)
ryan-crabbe-berri9968499aabf6
diff --git a/ui/litellm-dashboard/src/components/router_settings/ReliabilityRetriesSection.tsx b/ui/litellm-dashboard/src/components/router_settings/ReliabilityRetriesSection.tsxindex fa48c1c97b9..da089552b11 100644--- a/ui/litellm-dashboard/src/components/router_settings/ReliabilityRetriesSection.tsx+++ b/ui/litellm-dashboard/src/components/router_settings/ReliabilityRetriesSection.tsx@@ -20,14 +20,15 @@ const ReliabilityRetriesSection: React.FC<ReliabilityRetriesSectionProps> = ({<div className="grid grid-cols-1 gap-6 lg:grid-cols-2 xl:grid-cols-3">{Object.entries(routerSettings).filter(- ([param, value]) =>+ ([param]) =>param != "fallbacks" &¶m != "context_window_fallbacks" &¶m != "routing_strategy_args" &¶m != "routing_strategy" &¶m != "enable_tag_filtering" &¶m != "retry_policy" &&- param != "model_group_retry_policy",+ param != "model_group_retry_policy" &&+ param != "routing_groups",).map(([param, value]) => (<div key={param} className="space-y-2">diff --git a/ui/litellm-dashboard/src/components/router_settings/index.test.tsx b/ui/litellm-dashboard/src/components/router_settings/index.test.tsxindex 78a0b4b0dff..0df1cd81d6b 100644--- a/ui/litellm-dashboard/src/components/router_settings/index.test.tsx+++ b/ui/litellm-dashboard/src/components/router_settings/index.test.tsx@@ -146,4 +146,44 @@ describe("RouterSettings", () => {expect(NotificationsManager.success).toHaveBeenCalledWith("router settings updated successfully");});++ it("should not render or save routing_groups (owned by the Routing Groups tab) (LIT-4057)", async () => {+ const user = userEvent.setup();+ vi.mocked(getCallbacksCall).mockResolvedValue({+ router_settings: {+ routing_strategy: "simple-shuffle",+ num_retries: 3,+ routing_groups: [{ group_name: "g1", models: ["gpt-4"], routing_strategy: "simple-shuffle" }],+ },+ });+ renderWithProviders(<RouterSettings {...defaultProps} />);++ await waitFor(() => {+ expect(screen.getByTestId("strategy-select")).toBeInTheDocument();+ });+ expect(document.querySelector('input[name="routing_groups"]')).toBeNull();++ await user.click(screen.getByRole("button", { name: /save changes/i }));++ const payload = vi.mocked(setCallbacksCall).mock.calls[0][1] as {+ router_settings: Record<string, unknown>;+ };+ expect(payload.router_settings).not.toHaveProperty("routing_groups");+ });++ it("should surface an error and not claim success when saving fails (LIT-4057)", async () => {+ const user = userEvent.setup();+ vi.mocked(setCallbacksCall).mockRejectedValue(new Error("422 Unprocessable Entity"));+ renderWithProviders(<RouterSettings {...defaultProps} />);++ await waitFor(() => {+ expect(screen.getByTestId("strategy-select")).toBeInTheDocument();+ });+ await user.click(screen.getByRole("button", { name: /save changes/i }));++ await waitFor(() => {+ expect(NotificationsManager.fromBackend).toHaveBeenCalled();+ });+ expect(NotificationsManager.success).not.toHaveBeenCalled();+ });});diff --git a/ui/litellm-dashboard/src/components/router_settings/index.tsx b/ui/litellm-dashboard/src/components/router_settings/index.tsxindex d3753529058..360c7f41138 100644--- a/ui/litellm-dashboard/src/components/router_settings/index.tsx+++ b/ui/litellm-dashboard/src/components/router_settings/index.tsx@@ -81,7 +81,7 @@ const RouterSettings: React.FC<RouterSettingsProps> = ({ accessToken, userRole,});}, [accessToken, userRole, userID]);- const handleSaveChanges = () => {+ const handleSaveChanges = async () => {if (!accessToken) {return;}@@ -91,9 +91,9 @@ const RouterSettings: React.FC<RouterSettingsProps> = ({ accessToken, userRole,const numberKeys = new Set(["allowed_fails", "cooldown_time", "num_retries", "timeout", "retry_after"]);const jsonKeys = new Set(["model_group_alias"]);- // retry_policy and model_group_retry_policy are owned exclusively by the- // Model Retry Settings tab; this page must not read or write them.- const tabOwnedKeys = new Set(["retry_policy", "model_group_retry_policy"]);+ // retry_policy and model_group_retry_policy are owned by the Model Retry Settings tab;+ // routing_groups is owned by the Routing Groups tab. This page must not read or write them.+ const tabOwnedKeys = new Set(["retry_policy", "model_group_retry_policy", "routing_groups"]);const parseInputValue = (key: string, raw: string | undefined, fallback: unknown) => {if (raw === undefined) return fallback;@@ -172,12 +172,11 @@ const RouterSettings: React.FC<RouterSettingsProps> = ({ accessToken, userRole,};try {- setCallbacksCall(accessToken, payload);+ await setCallbacksCall(accessToken, payload);+ NotificationsManager.success("router settings updated successfully");} catch (error) {NotificationsManager.fromBackend("Failed to update router settings: " + error);}-- NotificationsManager.success("router settings updated successfully");};if (!accessToken) {