fix(ui): send router_settings list/dict fields as JSON, surface save errors#12
Open
shivshekhar12 wants to merge 1 commit into
Open
Conversation
…errors The Router Settings "Reliability & Retries" form rendered every field as a text input, so the routing_groups List field was POSTed to /config/update as the string "[]". The backend rejected it with a 422 (routing_groups -> "Input should be a valid list"), which invalidated the entire router_settings body and silently dropped every other field (allowed_fails, cooldown_time, timeout, ...). The save handler also did not await the request, so the error was swallowed and a success toast was always shown. - Parse List/Dictionary fields back into real JSON before sending, driven by the field_type metadata from /router/settings. - Await the save call: show success only on success, surface backend errors via NotificationsManager.fromBackend. Adds UI functional tests (array serialization + error surfacing), backend unit tests for UpdateRouterConfig.routing_groups, and functional tests for POST /config/update (422 on string, 200 + persisted list). Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the Admin UI Router Settings → "Reliability & Retries" section, where saving any value (Allowed Fails, Cooldown Time, Timeout, Retry After, etc.) silently did nothing.
Root cause: the form rendered every field as a plain text input, so the
routing_groupsList field was POSTed to/config/updateas the string"[]"instead of the array[]. The backend validates the wholerouter_settingsbody at once, so that one malformed field caused a 422 (routing_groups -> "Input should be a valid list") that rejected the entire payload — dropping every other field in the section. The save handler also didn'tawaitthe request, so the 422 was swallowed and a success toast always showed.Fix (frontend only,
router_settings/index.tsx):field_typemetadata from/router/settings), sorouting_groupsgoes out as[].awaitthe save call: show success only on success; surface the real backend error viaNotificationsManager.fromBackendon failure.Test plan
tests/test_litellm/types/test_router_types.py):UpdateRouterConfigrejects"[]", accepts[], parses populated entries.tests/.../proxy_server/test_config_update_routing_groups.py):ConfigYAMLrejects the string;POST /config/updatereturns 422 for"[]"and 200 for[]with a real list persisted; full Reliability & Retries payload round-trips (backward compatibility).router_settings/index.test.tsx): payload sendsrouting_groupsas an array; failed save surfaces error and shows no success.retry_policy/model_group_alias/boolean fields still serialize correctly.Made with Cursor