Skip to content

[Feature] UI - Team Settings: Soft Budget + Alerting Emails#20634

Merged
yuneng-jiang merged 2 commits intomainfrom
litellm_ui_team_budget_settings
Feb 7, 2026
Merged

[Feature] UI - Team Settings: Soft Budget + Alerting Emails#20634
yuneng-jiang merged 2 commits intomainfrom
litellm_ui_team_budget_settings

Conversation

@yuneng-jiang
Copy link
Collaborator

Relevant issues

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have Added testing in the tests/litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem

CI (LiteLLM team)

CI status guideline:

  • 50-55 passing tests: main is stable with minor issues.
  • 45-49 passing tests: acceptable but needs attention
  • <= 40 passing tests: unstable; be careful with your merges and assess the risk.
  • Branch creation CI run
    Link:

  • CI run for the last commit
    Link:

  • Merge / cherry-pick CI run
    Links:

Type

🆕 New Feature
✅ Test

Changes

Adds soft budget and soft budget alerting emails fields to the team settings UI. Users can now set a soft budget value and configure comma-separated email addresses to receive alerts when the soft budget is reached. The soft budget and alerting emails are displayed in the team settings view and can be edited through the settings form.

Screenshots

image image

@vercel
Copy link

vercel bot commented Feb 7, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
litellm Ready Ready Preview, Comment Feb 7, 2026 4:49am

Request Review

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 7, 2026

Greptile Overview

Greptile Summary

  • Adds soft_budget and soft_budget_alerting_emails fields to the Team Settings UI, including form editing + read-only display.
  • Update flow parses metadata JSON, merges structured settings (guardrails/logging/etc.), and serializes alerting emails into metadata.soft_budget_alerting_emails.
  • Adjusts a couple of UI test suites to accommodate new/changed component dependencies and selectors.
  • Updates dashboard dev/tooling config (next dev --webpack, jsx: react-jsx).

Confidence Score: 3/5

  • This PR is likely safe to merge once a couple of correctness/brittleness issues are addressed.
  • Core UI wiring for the new fields looks consistent, but there are two concrete issues: (1) soft_budget may be sent to the backend without consistent normalization/coercion compared to max_budget, and (2) a duplicate vi.mock() plus an index-based switch selector make tests brittle and can fail unexpectedly as components evolve. Tooling changes (dev script, TS jsx mode) also deserve a quick sanity check in CI.
  • ui/litellm-dashboard/src/components/team/team_info.tsx, ui/litellm-dashboard/src/components/team/team_info.test.tsx, ui/litellm-dashboard/src/components/mcp_tools/MCPPermissionManagement.test.tsx

Important Files Changed

Filename Overview
ui/litellm-dashboard/package.json Switches Next dev script from --turbo to --webpack; no functional app code changes but alters local dev behavior.
ui/litellm-dashboard/tsconfig.json Changes TSX emit from jsx: preserve to react-jsx, which can affect tooling/build expectations; no direct runtime code changes.
ui/litellm-dashboard/src/components/mcp_tools/MCPPermissionManagement.test.tsx Updates tests to select the first switch via getAllByRole('switch')[0]; fixes ambiguity but introduces a brittle index-based selector.
ui/litellm-dashboard/src/components/mcp_tools/mcp_servers.test.tsx Expands networking mocks to include additional functions required by MCPServers tests; appears consistent with component dependencies.
ui/litellm-dashboard/src/components/team/team_info.test.tsx Adds tests for soft budget + alert emails display; file contains a duplicate vi.mock() for the same module which can cause brittle behavior.
ui/litellm-dashboard/src/components/team/team_info.tsx Adds soft budget field + alerting emails UI, and includes them in update payload; ensure soft_budget is normalized/coerced consistently with other numeric budget fields.

Sequence Diagram

sequenceDiagram
  participant U as User (Dashboard)
  participant T as TeamInfoView
  participant API as Backend API

  U->>T: Open Team Settings
  T->>API: teamInfoCall(accessToken, teamId)
  API-->>T: TeamData(team_info, metadata)
  T-->>U: Render Settings view (soft_budget + alert emails)

  U->>T: Click "Edit Settings"
  T-->>U: Prefill form
  Note over T: soft_budget from team_info
  Note over T: soft_budget_alerting_emails from metadata[]

  U->>T: Enter soft budget + comma-separated emails
  U->>T: Click "Save Changes"
  T->>T: Parse metadata JSON
  T->>T: Split/trim/filter emails
  T->>API: teamUpdateCall(accessToken, updateData)
  API-->>T: 200 OK
  T-->>U: Success + refresh
  T->>API: teamInfoCall(accessToken, teamId)
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

6 files reviewed, 3 comments

Edit Code Review Agent Settings | Greptile

Comment on lines 44 to 51
it("should default allow_all_keys switch to unchecked for new servers", async () => {
renderWithForm();
await expandPanel();
const toggle = screen.getByRole("switch");
// Find the switch associated with "Allow All LiteLLM Keys" text
// The first switch in the component is for allow_all_keys
const switches = screen.getAllByRole("switch");
const toggle = switches[0];
expect(toggle).toHaveAttribute("aria-checked", "false");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Brittle switch selection

These tests assume getAllByRole("switch")[0] is the allow_all_keys control. If another switch is added/reordered in MCPPermissionManagement, the test will silently start asserting the wrong switch. Prefer selecting the switch by accessible name/label (e.g., getByRole('switch', { name: /allow all litellm keys/i })) so the test stays aligned with the UI.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 7, 2026

Additional Comments (2)

ui/litellm-dashboard/src/components/team/team_info.tsx
Soft budget may serialize wrong

soft_budget is only passed through sanitizeNumeric() but never through mapEmptyStringToNull() like max_budget is. If the form field returns an empty string (common for controlled numeric inputs), sanitizeNumeric() returns null but if it returns "" or a string number, this can still reach the backend as a string. That can break API validation expecting a number/null. Consider normalizing soft_budget the same way max_budget is normalized (or explicitly coercing to number | null).


ui/litellm-dashboard/src/components/team/team_info.test.tsx
Duplicate module mock

This file mocks @/components/team/member_permissions twice back-to-back. In Vitest, duplicate vi.mock() for the same module can lead to brittle behavior depending on hoisting/order and makes failures hard to debug. Remove the duplicate and keep a single mock definition.

@yuneng-jiang yuneng-jiang merged commit a427a2b into main Feb 7, 2026
58 of 67 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant