From 56f009400f4c4c05f020212a63bf5a2ae5963f5d Mon Sep 17 00:00:00 2001 From: Tin Date: Wed, 2 Sep 2026 15:54:54 -0700 Subject: [PATCH] fix(ui): restrict heuristic v2 to proxy admins --- .../add_model/ClassificationMethodConfig.tsx | 20 +++++++++--- .../add_model/ComplexityRouterConfig.test.tsx | 31 +++++++++++++++++-- .../add_model/ComplexityRouterConfig.tsx | 3 ++ .../add_model/add_auto_router_tab.tsx | 1 + 4 files changed, 49 insertions(+), 6 deletions(-) diff --git a/ui/litellm-dashboard/src/components/add_model/ClassificationMethodConfig.tsx b/ui/litellm-dashboard/src/components/add_model/ClassificationMethodConfig.tsx index a29527a20fa..6e93e64d760 100644 --- a/ui/litellm-dashboard/src/components/add_model/ClassificationMethodConfig.tsx +++ b/ui/litellm-dashboard/src/components/add_model/ClassificationMethodConfig.tsx @@ -159,15 +159,21 @@ interface ClassificationMethodConfigProps { showValidationErrors?: boolean; /** The resolved default model - see resolveComplexityDefaultModel. Names and gates the radio. */ defaultModel?: string; + /** Mirrors the backend's proxy-admin-only heuristic_v2 write gate. */ + allowHeuristicV2?: boolean; } const ClassifierTypeRadios: React.FC<{ value: ComplexityRouterConfigValue; classifierType: ClassifierType; onTypeChange: (classifierType: ClassifierType) => void; -}> = ({ value, classifierType, onTypeChange }) => { + allowHeuristicV2: boolean; +}> = ({ value, classifierType, onTypeChange, allowHeuristicV2 }) => { const scorerLocked = Boolean(value.custom_tier_set); const scorerLockedReason = restrictedBy(value, "heuristicClassifier")?.reason; + const heuristicV2Locked = scorerLocked || !allowHeuristicV2; + const heuristicV2LockedReason = + scorerLockedReason ?? (!allowHeuristicV2 ? "Only proxy admins can configure Heuristic v2." : undefined); return ( - +