metrics + overview: stop counting utility accounts as members, and surface agent usage

The panel has always excluded operator/utility emails from member counts
(OPERATOR_EMAILS), but the metrics counted every row in the members table, so the
panel said 75 while every metric surface said 76. The one affected row is
info@inference.coop — the reading mailbox, not a person.

- metrics_snapshot.py now applies the same OPERATOR_EMAILS definition (same variable
  name, same default) so the two cannot drift apart again. No backfill: history stays
  as published and the daily job writes the corrected value going forward.
- admin_overview now also returns an `agents` list, built from the LiteLLM teams it
  already fetches (anything not member:*), so bot and sandbox spend is visible rather
  than structurally invisible. Kept out of member counts and member aggregates, like
  the operator category.
This commit is contained in:
inference-bot committed 2026-10-29 20:57:10 +00:00
1 parent b11552fa49
commit 592cf83656
2 files changed
+37 -10

No files matched your search

+16
View File
@@ -3131,9 +3131,25 @@ async def admin_overview(request: Request):
total_spend += spend
total_all_time += member_all_time
# Bot and sandbox teams: real spend, but not members. Surfaced in their own
# category so the co-op's own usage is accountable without inflating member
# counts — the same reasoning as the operator accounts above.
agents = [
{
"alias": alias,
"spend": float(t.get("spend") or 0.0),
"budget": t.get("max_budget"),
"team_members": len(t.get("members_with_roles") or []),
}
for alias, t in teams.items()
if alias and not alias.startswith("member:")
]
agents.sort(key=lambda a: a["spend"], reverse=True)
return {
"members": members,
"admins": admins,
"agents": agents,
"totals": {
"members": len(members),
"active": sum(1 for m in members if m["active"]),