Repository navigation
Surface per-member budget cycle in Teams > Members tab - #26207
yuneng-berri merged 10 commits into
Conversation
Greptile SummaryThis PR surfaces per-member budget cycle data on the Teams > Members tab by adding three new columns (Current Cycle Spend, Total Spend, Budget Reset) and a new
Confidence Score: 4/5Safe to merge for the Members-tab columns; the Budget Status card "Resets …" feature described in the PR is unimplemented. The Members tab additions and backend budget-clone fix are correct and well-guarded. One P1 remains: the PR description explicitly claims "Resets …" lines are added to the Budget Status card (Overview tab), but no rendering changes exist in the diff and the TypeScript ui/litellm-dashboard/src/components/team/TeamInfo.tsx — missing
|
| Filename | Overview |
|---|---|
| litellm/proxy/_types.py | Promotes team_member_budget_table from LiteLLM_BudgetTable to LiteLLM_BudgetTableFull so the API response includes budget_reset_at; backward-compatible since Full extends Base. |
| litellm/proxy/management_helpers/utils.py | Correctly seeds budget_reset_at from the clone time when a member inherits a team default budget, preventing stale reset timestamps for mid-cycle joiners. |
| ui/litellm-dashboard/src/components/team/TeamInfo.tsx | Adds total_spend and budget_reset_at to TeamMembership interface; however, team_member_budget_table in TeamData is missing budget_reset_at, and no rendering changes add the described "Resets …" lines to the Budget Status card. |
| ui/litellm-dashboard/src/components/team/TeamMemberTab.tsx | Adds Current Cycle Spend, Total Spend, and Budget Reset columns to the Members tab; helpers correctly handle null values from the membership lookup. |
| ui/litellm-dashboard/src/utils/budgetUtils.ts | New formatBudgetReset helper using dayjs; correctly guards against null/undefined/invalid inputs and returns a fixed "MMM D, YYYY" format. |
Sequence Diagram
sequenceDiagram
participant UI as TeamMemberTab (UI)
participant API as /team/info (Backend)
participant DB as litellm_budgettable
UI->>API: GET /team/info?team_id=...
API->>DB: fetch team_memberships with litellm_budget_table
DB-->>API: membership rows (spend, total_spend, budget_reset_at)
API-->>UI: TeamInfoResponseObject (LiteLLM_BudgetTableFull per member)
UI->>UI: getUserCurrentCycleSpend(userId) → membership.spend
UI->>UI: getUserTotalSpend(userId) → membership.total_spend
UI->>UI: getUserBudgetReset(userId) → formatBudgetReset(budget_reset_at)
UI->>UI: Render columns: Current Cycle Spend / Total Spend / Budget Reset
Comments Outside Diff (1)
-
ui/litellm-dashboard/src/components/team/TeamInfo.tsx, line 121-123 (link)Budget Status card "Resets …" rendering is absent
The PR description states this PR adds "Resets …" lines for the team budget and the shared member-default budget to the Overview > Budget Status card. The test plan also lists two checkboxes for these items (team
max_budget + budget_durationandteam_member_budgetdefault). However, the diff forTeamInfo.tsxonly adds two type fields toTeamMembership— no rendering changes touch the Budget Status card, andbudget_reset_atis not added to theteam_member_budget_tableshape in theTeamDatainterface. Both test plan items (5 and 6) would fail against the current code.
Reviews (10): Last reviewed commit: "restore budget_reset_at on TeamMembershi..." | Re-trigger Greptile
Adds a "Total Spend (USD)" column backed by the new membership.total_spend field. Cumulative across budget cycles; tracking began 2026-04-21.
91ce958 to
331e3f2
Compare
Adds a formatBudgetReset helper (dayjs-based, with validity guard) that renders the next reset as "today" / "in N days" / "on MMM D, YYYY". The team budget card now shows the team's reset timestamp and the member- default reset (when a shared team_member_budget is configured), and the Members tab gains a Budget Reset column per member.
Adds back the per-cycle spend column that was replaced by Total Spend in 331e3f2. Current Cycle Spend reads membership.spend (zeroed on budget_reset_at) — this is the value enforced against the member's budget, so admins need it to see whether a member is approaching their cap for the active window. Total Spend remains for lifetime analytics.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
…itellm_team_member_total_spend_frontend
Low: UI and minor backend changes for team member budget displayThis PR adds budget cycle and total spend information to the Teams > Members UI tab, creates a small utility for formatting budget reset dates, and fixes the budget reset timestamp when cloning a team default budget for a new member. No security issues found. Status: 0 open Posted by Veria AI · 2026-04-23T22:58:10.291Z |
…itellm_team_member_total_spend_frontend
Low: UI and minor backend changes for team member budget displayThis PR adds budget cycle information (reset timestamps, total spend, current cycle spend) to the Teams > Members UI tab and fixes the budget reset time when cloning a team default budget for a new member. The backend change uses Prisma ORM for the database write, and the frontend changes are purely display-oriented. No security issues found. Status: 0 open Posted by Veria AI · 2026-04-23T23:50:25.837Z |
Out of scope for the members-tab feature and regressed legacy teams whose budget_reset_at is null (duration was previously shown as a fallback).
Low: UI and budget display changesThis PR surfaces per-member budget cycle information (current cycle spend, total spend, budget reset date) in the Teams > Members tab. The backend change properly initializes budget reset timestamps when cloning team budgets for new members. No security-sensitive fields are newly exposed, and all data flows through existing authenticated endpoints. Status: 0 open Posted by Veria AI · 2026-04-24T00:03:52.698Z |
Members tab column reads this field; dropping it from the type in the previous revert broke the type check without affecting the reverted render logic.
Low: UI and budget cloning changes with no security impactThis PR surfaces per-member budget cycle information (total spend, budget reset time) in the Teams > Members UI tab. The backend change correctly initializes Status: 0 open Posted by Veria AI · 2026-04-24T00:08:40.038Z |
Summary
Frontend companion to #26195 — surfaces member spend and budget-cycle info on the Teams > Members tab.
—if no budget/duration.src/utils/budgetUtils.ts→formatBudgetReset(iso): dayjs-based, returns"MMM D, YYYY"ornullfor missing/malformed input so callers skip rendering.Requires backend PR #26195 to merge first —
total_spendandbudget_reset_atare populated by its/team/infochanges.Screenshots
Issued a request with Alice's key under this team to verify per-member Current Cycle Spend / Total Spend increment and Budget Reset renders.
Test plan
budget_duration+budget_reset_atset → Budget Reset showsMMM D, YYYY—cd ui/litellm-dashboard && npx tsc --noEmit -p tsconfig.json— no new errors in edited files