fix(router): persist and apply retry_policy via update_settings (#31308)#9
Merged
shivshekhar12 merged 1 commit intoJul 7, 2026
Conversation
…iAI#31308) Co-authored-by: Cursor <cursoragent@cursor.com>
shivshekhar12
added a commit
that referenced
this pull request
Jul 7, 2026
…-422 Root cause: the Router Settings "Reliability & Retries" form rendered every field as a plain text input, so the routing_groups List field was POSTed to /config/update as the string "[]" instead of the array []. The backend validates the whole router_settings body at once, so that one malformed field returned a 422 (routing_groups -> "Input should be a valid list") that rejected the entire payload, dropping every other field (allowed_fails, cooldown_time, timeout, retry_after, ...). The save handler also didn't await the request, so the 422 was swallowed and a success toast always showed. Changes (frontend only, router_settings/index.tsx): - Parse List/Dictionary fields back into real JSON before sending, driven by the field_type metadata from /router/settings, so routing_groups goes out as []. - await the save call: show success only on success; surface the real backend error via NotificationsManager.fromBackend on failure. Tests: - Backend unit (test_router_types.py): UpdateRouterConfig rejects "[]", accepts [], parses populated entries. - Backend functional (test_config_update_routing_groups.py): ConfigYAML rejects the string; POST /config/update returns 422 for "[]" and 200 for [] with a real list persisted; full Reliability & Retries payload round-trips. - UI functional (router_settings/index.test.tsx): payload sends routing_groups as an array; failed save surfaces the error and shows no success toast. - Suites: targeted UI 51 passed; full UI 3837 passed / 381 files; backend 10 passed. Stacked on #9 (backend retry_policy persistence)
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
retry_policyset in the Admin UI / config was silently dropped:UpdateRouterConfig, so Pydantic dropped it at parse time before the DB write.Router.update_settings()allowlist, so a value loaded from the DB was never applied to the live router.This PR:
retry_policy: Optional[RetryPolicy]toUpdateRouterConfig(movedRetryPolicyabove it so it can be referenced).retry_policyto theupdate_settings()allowlist.RetryPolicyinstance before applying it to the live router.Test plan
test_update_settings_retry_policy—Router.update_settings()accepts a retry_policy dict and coerces it intoRetryPolicy.retry_policyto the live Router on startup.POST /config/updatepersistsretry_policyinto the DB merged with existing values.UpdateRouterConfigparses and serializesretry_policycorrectly.Fixes BerriAI#31308
Made with Cursor