Skip to content

feat(frontend): per-team spend breakdown in org billing tab (SECRT-2450) - #13659

Open
ntindle wants to merge 6 commits into
feat/memory-tier-uifrom
feat/team-spend-display
Open

feat(frontend): per-team spend breakdown in org billing tab (SECRT-2450)#13659
ntindle wants to merge 6 commits into
feat/memory-tier-uifrom
feat/team-spend-display

Conversation

@ntindle

@ntindle ntindle commented Jul 22, 2026

Copy link
Copy Markdown
Member

Why

SECRT-2450 tail: the per-team spend endpoint (#13530) had no UI.

What

New Billing tab in org settings, gated to owner/billing_manager (canManageBilling — not plain admin, matching the billing role-gating decision), rendering TeamSpendSection: team / spend (credits→dollars) / run count, with an org-home row. Uses the endpoint's own team_name rather than TeamBadge since billing managers can see spend for teams they aren't in. Deep-link ?tab=billing degrades to General for unauthorized roles.

Testing

2 tests (rows incl. org-home from mocked endpoint; hidden + zero requests for non-billing roles). format/lint/types clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Jm3mCG9okfdGtAXtFaDF9A


Note

Low Risk
Read-only billing UI with role gating aligned to backend permissions; no payment or mutation paths.

Overview
Adds a Billing tab to organization settings that shows per-team credit spend for owners and billing managers only (not org admins without billing rights).

The tab loads spend via the existing per-team breakdown API and renders a table of team name, dollar spend (cents → dollars), and run count, including an Organization row for org-home usage (null team_id). Team labels come from the API response so billing managers can see teams they are not members of. Unauthorized users do not see the tab; ?tab=billing falls back to General. The spend query stays disabled when billing access is denied.

Includes TeamSpendSection tests for mocked rows and for no UI/request when canManageBilling is false.

Reviewed by Cursor Bugbot for commit 9f22ddd. Bugbot is set up for automated code reviews on this repo. Configure here.

ntindle and others added 2 commits July 22, 2026 16:11
Add a billing-manager/owner-gated Billing tab to org settings with a
spend-by-team table riding GET /api/orgs/{org}/spend:

- TeamSpendSection renders one row per team plus the org-home row (team_id
  null), showing team name, spend (credits formatted as dollars), and run
  count, with design-system Skeleton loading and ErrorCard failure states.
  Uses the endpoint's own team_name (not TeamBadge) since a billing manager
  can see spend for teams they aren't a member of.
- Gating: canManageBilling (owner or billing_manager, not plain admin —
  matches MANAGE_BILLING in the backend permission matrix) shows the tab and
  content; the query stays disabled otherwise, and a ?tab=billing deep link
  falls back to General for members without the right.

Co-Authored-By: Claude Opus <noreply@anthropic.com>
@ntindle
ntindle requested a review from a team as a code owner July 22, 2026 21:15
@ntindle
ntindle requested review from Pwuts and Swiftyos and removed request for a team July 22, 2026 21:15
@github-project-automation github-project-automation Bot moved this to 🆕 Needs initial review in AutoGPT development kanban Jul 22, 2026
@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (1)
  • dev

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 41235a29-82af-4da0-9bc9-e64c8c6890eb

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/team-spend-display

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the platform/frontend AutoGPT Platform - Front end label Jul 22, 2026
@ntindle

ntindle commented Jul 22, 2026

Copy link
Copy Markdown
Member Author

/batch orgs

@autogpt-batch-bot autogpt-batch-bot Bot added the batch:orgs batch-bot batch membership label Jul 22, 2026
autogpt-batch-bot Bot pushed a commit that referenced this pull request Jul 22, 2026
@autogpt-batch-bot autogpt-batch-bot Bot mentioned this pull request Jul 22, 2026
24 tasks
@autogpt-batch-bot

Copy link
Copy Markdown

🤖 Added #13659 to batch orgs. Batch orgs (22): #13658, #13657, #13654, #13653, #13650, #13649, #13648, #13642, #13641, #13640, #13638, #13637, #13604, #13603, #13599, #13574, #13541, #13540, #13532, #13530, #13496, #13659.

Deploying the combined preview (#13651); /batch-merge lands them together.

@codecov

codecov Bot commented Jul 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.33333% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.17%. Comparing base (36a0acc) to head (9f22ddd).

Additional details and impacted files
@@                 Coverage Diff                  @@
##           feat/memory-tier-ui   #13659   +/-   ##
====================================================
  Coverage                76.16%   76.17%           
====================================================
  Files                     2748     2751    +3     
  Lines                   202382   202397   +15     
  Branches                 19697    19688    -9     
====================================================
+ Hits                    154152   154179   +27     
+ Misses                   43950    43872   -78     
- Partials                  4280     4346   +66     
Flag Coverage Δ
platform-frontend 49.89% <83.33%> (+0.02%) ⬆️
platform-frontend-e2e 31.33% <ø> (+0.30%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
Platform Backend 82.68% <ø> (ø)
Platform Frontend 53.41% <83.33%> (+0.05%) ⬆️
AutoGPT Libs ∅ <ø> (∅)
Classic AutoGPT 28.43% <ø> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

autogpt-batch-bot Bot pushed a commit that referenced this pull request Jul 22, 2026
autogpt-batch-bot Bot pushed a commit that referenced this pull request Jul 22, 2026
autogpt-batch-bot Bot pushed a commit that referenced this pull request Jul 22, 2026
autogpt-batch-bot Bot pushed a commit that referenced this pull request Jul 22, 2026
autogpt-batch-bot Bot pushed a commit that referenced this pull request Jul 22, 2026
ntindle and others added 3 commits July 30, 2026 18:28
…/team-spend-display

Clean forward-merge (inherits OrgTeamProvider + AddToLibraryButton resolutions).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NBwmh7CkHiF8vKLBf2GWTU
…eSupabase→useAuth (keep branch's test additions)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NBwmh7CkHiF8vKLBf2GWTU
…dToLibraryButton test useAuth fix

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NBwmh7CkHiF8vKLBf2GWTU
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

batch:orgs batch-bot batch membership cla: signed CLA signed by all contributors platform/frontend AutoGPT Platform - Front end size/l

Projects

Status: 🆕 Needs initial review
Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant