feat(ui): expose the assistant-turn classifier context switch on Auto-Router screens - #35500
Conversation
|
@greptileai can you reply here with a score and why that score? |
|
bugbot run |
|
Score: 5/5 The implementation is clean and the rationale is sound. Here's what holds it at a 5: Correctness of the two asymmetric emit rules:
Coverage gaps that aren't gaps:
Things I verified that are fine:
No issues found. |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 4f98099. Configure here.
Greptile SummaryThe PR exposes the existing assistant-turn classifier context option in the Auto-Router create and edit screens.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains; the previously unnamed switch now exposes an accessible name on the interactive control, and the tests query it by that name.
|
| Filename | Overview |
|---|---|
| ui/litellm-dashboard/src/components/add_model/ClassificationMethodConfig.tsx | Adds the assistant-turn switch with an accessible name and clears its value when switching to the heuristic classifier. |
| ui/litellm-dashboard/src/components/add_model/ComplexityRouterConfig.tsx | Extends the form value type with the optional assistant-turn classifier setting. |
| ui/litellm-dashboard/src/components/add_model/add_auto_router_tab.tsx | Carries the assistant-turn value from create-form state into payload construction. |
| ui/litellm-dashboard/src/components/add_model/build_complexity_router_config.ts | Serializes defined boolean values for LLM classifiers, including an explicit false value. |
| ui/litellm-dashboard/src/components/edit_auto_router/edit_auto_router_modal.tsx | Adds the setting to edit hydration, managed-key handling, and update serialization. |
| ui/litellm-dashboard/src/components/add_model/ComplexityRouterConfig.test.tsx | Verifies accessible rendering, default state, classifier-dependent visibility, and state updates. |
| ui/litellm-dashboard/src/components/add_model/build_complexity_router_config.test.ts | Covers true, false, unset, and heuristic serialization behavior on create. |
| ui/litellm-dashboard/src/components/edit_auto_router/build_updated_complexity_router_config.test.ts | Covers edit round trips, explicit disabling, omission, and stale-value removal. |
| ui/litellm-dashboard/src/components/edit_auto_router/edit_auto_router_modal.test.tsx | Exercises hydration and persistence through the real edit modal. |
Reviews (2): Last reviewed commit: "feat(ui): expose the assistant-turn clas..." | Re-trigger Greptile
4f98099 to
a8abb70
Compare
…-Router screens PR #35471 added classifier_context_include_assistant_turns to ComplexityRouterConfig. It worked through config.yaml and the model API but had no control on the Add Model or Edit Auto-Router screens, so an operator working from the dashboard could not reach it. Wires it into the create and edit forms, shown only when the LLM classifier is selected, matching what #35315 did for the two context-window fields The create and edit stacks share the rendered control but keep their own serializer, their own hydration, and their own managed-key set, so the field is added in five places rather than one. A field wired into only one stack fails in a way neither serializer unit test can see, since those are handed a form value assembled by hand, so the edit-modal test drives the real component through open, edit and save The switch is emitted even when false, because there the operator turning it off is a choice that has to overwrite a stored true rather than an absent value a truthiness gate would drop
a8abb70 to
4c7b66c
Compare
|
@greptileai can you review this and give me a score & why the score |
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 4c7b66c. Configure here.
TLDR
Problem this solves:
classifier_context_include_assistant_turnstoComplexityRouterConfig, but it was reachable only throughconfig.yamlor the model API, so an operator working from the Admin UI could not turn it onHow it solves it:
Relevant issues
Follows the UI split established by #35185 -> #35315
Linear ticket
Resolves LIT-5082
Pre-Submission checklist
Screenshots / Proof of Fix
This is a UI change, so here is the click-through rather than a curl. Run the proxy on
localhost:4000and the dashboard dev server withnpm run devinui/litellm-dashboard.Create path:
complexity_router_configcarriesclassifier_context_include_assistant_turns: trueEdit path, which is the half that a create-only wiring would break:
classifier_context_include_assistant_turns: falserather than the key vanishingThe backend behaviour this control drives was proven on a live proxy in #35471.
Type
🆕 New Feature
Changes
ClassificationMethodConfig.tsxrenders the switch inside the existingclassifier_type === "llm"block, with anaria-labelso it has an accessible name, and clears the field when the classifier is switched back to heuristicComplexityRouterConfig.tsxcarries the field onComplexityRouterConfigValuebuild_complexity_router_config.tsandadd_auto_router_tab.tsxserialize it on the create pathedit_auto_router_modal.tsxadds it toMANAGED_COMPLEXITY_ROUTER_KEYS, tobuildUpdatedComplexityRouterConfig, and to the hydration that fills the form from the stored configThings a reviewer will ask about:
Why
falseis emitted rather than omitted. An operator turning assistant context off is a decision that has to overwrite a storedtrue, and a truthiness-based emit would silently drop it, so the switch emits whenever it is defined rather than only when true.Why the field count is five rather than one. The create and edit paths share
ClassificationMethodConfigbut duplicate the serializer, the hydrator and the managed-key allow-set. Anything missing fromMANAGED_COMPLEXITY_ROUTER_KEYSis carried through from the stored config untouched, so a field wired everywhere except that set silently ignores the form. The edit-modal test drives the real component through open, edit and save, because the serializer unit tests are handed a form value assembled by hand and cannot see a hydration or managed-key gap.QA runbook
Automated coverage,
npx vitest run src/components/add_model src/components/edit_auto_router, 164 tests:build_complexity_router_config.test.tscovers emit when llm, omit when heuristic, omit when unset, andfalsestill emittedbuild_updated_complexity_router_config.test.tscovers the same on the edit serializer plus the untouched round trip and the no-stale-resurrection caseComplexityRouterConfig.test.tsxcovers rendering, the default-off state, hiding under heuristic, and the switch callingonChangeedit_auto_router_modal.test.tsxdrives the real modal: the stored value hydrates, an untouched save preserves it, and turning the switch off persistsMutation-checked by removing each wiring point in turn: dropping the key from
MANAGED_COMPLEXITY_ROUTER_KEYS, removing the hydration arm, and removing thearia-labeleach fail tests that pass on the real code.Final Attestation
Note
Low Risk
Dashboard-only wiring for an existing router config flag; enabling it can change tier routing and spend, but behavior is explicit in the UI and covered by tests.
Overview
Exposes
classifier_context_include_assistant_turnsin the Admin UI for complexity Auto-Routers, which previously requiredconfig.yamlor the model API.When LLM Classifier is selected under Advanced: Classification Method, a new Include Assistant Turns switch appears (default off, with tooltip about tier/spend and sending assistant text to the classifier). Switching back to Heuristic clears the field from form state.
The flag is threaded through create (
add_auto_router_tab→build_complexity_router_config) and edit (edit_auto_router_modal: hydration,MANAGED_COMPLEXITY_ROUTER_KEYS,buildUpdatedComplexityRouterConfig). Serialization only includes the key for LLM classifiers when the value is defined—includingfalseso turning it off overwrites a storedtrue.Reviewed by Cursor Bugbot for commit 4c7b66c. Bugbot is set up for automated code reviews on this repo. Configure here.