Skip to content

Add a compact All tab to the provider usage card - #4571

Merged
ymichael merged 5 commits into
mainfrom
bb/prototype-an-update-to-the-provider-usage-thr_r5awq3cs8i
Sep 30, 2026
Merged

ymichael merged 5 commits into
mainfrom
bb/prototype-an-update-to-the-provider-usage-thr_r5awq3cs8i

Conversation

@ymichael

@ymichael ymichael commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

The sidebar provider usage card showed one provider per tab. With pooled accounts across Codex and Claude Code, seeing every account's remaining quota meant toggling back and forth between provider tabs. The header was also visually busy (full-height underlined tabs, a bold machine name, warning dots even for on-screen data), and the loading/empty/error states left the header's top-left blank and used heavy boxed notices.

Separately, one pooled Codex account showed a secondary window at 0%. #3465 drops the ChatGPT backend's placeholder secondary rate-limit window when it has no length, no reset, and zero usage, and treats reset-at: 0 as no reset. The placeholder now arrives with reset-after-seconds: 0 instead, which resetAt() in the Account Pooler's Codex adapter turned into "resets now", so the placeholder check kept it. The stored row confirmed it: {"slot":"secondary","windowMinutes":null,"utilization":0,"resetAt":<observedAt>,"source":"header"}.

What changed

The card changes are in plugins/provider-usage; the placeholder fix is in plugins/account-pool. No server/daemon wire changes, no SDK surface changes.

  • Codex placeholder window (plugins/account-pool/src/codex-adapter.ts): a non-positive reset-after-seconds is treated as no reset, matching the existing reset-at handling, so the Drop placeholder Codex secondary limit windows in Account Pooler #3465 check drops the placeholder. A stored placeholder clears on the next header pass because its reset is already in the past.

  • All tab (app.tsx): when the selected machine or source has more than one provider, the card opens on an All tab listing every account on one 24px row: provider icon, account name, and per-window cells (short label, %, thin bar, tone-colored at 80%/95%). Plan, full window label, and reset time are in the tooltip. Non-ok accounts show a short status ("Expired", "Signed out", …). While the All tab is open, the card refreshes every provider on the machine.

  • Shared-first alignment: windows are ranked by how many accounts report them (ties: 7d, 5h, 1d, then alphabetical) and packed right to left in fixed-width cells, so the most shared window (usually 7d) always lines up. Model-scoped windows like Weekly · Fable render as "Fable".

  • All tab fetching: getUsage only measures resources when the request names a provider (providerId: null returns cached measurements), so the All tab requests each provider separately for periodic refresh and Reload. No server change.

  • Quieter header: a small segmented tab control instead of full-height underlined tabs; inactive provider icons drop their brand tint and render dimmed in the muted text color until that tab is hovered (a named group/tab, since the sidebar host already has a group ancestor; a grayscale filter left near-white tints such as Cursor's bright); the machine name is muted text-2xs. Warning dots appear only on tabs whose accounts aren't on screen (never on the All tab or the selected tab). With fewer than two providers the header shows a "Usage" title instead of a lone tab, and the machine picker is hidden when there are no machines.

  • States: skeleton rows on first load; accounts that are known but not yet measured show their names with a skeleton where the numbers go; empty/error/offline messages are one left-aligned line with an inline Retry. Stale-data copy is shortened to "Couldn’t refresh. Showing last update." and " is offline. Showing last update." (usage-feedback.tsx), which also applies to the settings page.

  • Stories (app.stories.tsx): added mixed pool, live pool (real Account Pooler numbers with a Claude Fable window, emails anonymized), load failed, and accounts loading scenarios.

  • Ladle shim (apps/app/.ladle/plugin-sdk-app.ts): exported experimental_usePluginId; the provider-usage story failed to load without it on main.

  • README updated for the All tab and badge behavior.

How you verified

  • pnpm exec turbo run typecheck lint test --filter=bb-plugin-provider-usage: pass (20 tests). The footer test now covers the All tab default, the compact row order, arrow-key navigation from All to a provider tab, and warning dots only for off-screen providers.
  • pnpm exec turbo run typecheck lint --filter=@bb/app: pass.
  • pnpm exec turbo run typecheck lint test --filter=bb-plugin-account-pool: pass (324 tests). The Drop placeholder Codex secondary limit windows in Account Pooler #3465 placeholder test now also covers reset-after-seconds: 0; that case fails without the adapter change.
  • pnpm start:worktree on a fresh data dir: the All tab loads real Codex, Claude Code (5h, 7d, Fable), Cursor, and OpenCode usage on first open, and inactive tab icons stay grey while hovering elsewhere in the sidebar. The footer test asserts the All tab requests each provider; it fails on the first commit.
  • Visual QA in Ladle (plugins/Provider usage → Disclosure) for all 11 scenarios, compared with main rendered using the same story data (before/after screenshots for every state were shared in the originating bb thread).

AGENT GENERATED

🤖 Generated with Claude Code

ymichael and others added 5 commits September 30, 2026 09:52
The sidebar usage card showed one provider per tab, so checking every pooled
account meant toggling between providers. When a location has more than one
provider, the card now opens on an All tab with one compact row per account.
Window cells are ordered by how many accounts share them and packed right to
left so shared windows align. The header uses a quieter segmented tab control,
and warning dots show only for providers whose accounts are off screen.

Loading, empty, and error states now use a "Usage" title, skeleton rows, and
one-line notices with an inline retry.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The ChatGPT backend's placeholder secondary rate-limit window now arrives as
used-percent 0 with reset-after-seconds 0 instead of reset-at 0. resetAt()
turned that into "resets now", so the #3465 placeholder check saw a reset and
kept the window, which surfaced as a "secondary" 0% cell in provider usage.
Treat a non-positive reset-after like a non-positive reset-at.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
getUsage only measures resources when the request names a provider; a null
providerId returns cached measurements. The All tab sent null, so accounts it
showed were never measured unless another tab had fetched them first. The card
now requests each provider on the All tab, for both periodic refresh and
Reload.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
group-hover matched any hovered ancestor with a group class, and the sidebar
host has one, so hovering anywhere in the sidebar un-greyed every inactive
provider icon. Use a named group on each tab.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Inactive tab icons were greyed with a CSS filter, but tinted logos such as
Cursor's near-white dark-mode tint stayed bright. Drop the brand tint on
inactive tabs so every icon renders in the muted text color, dimmed until the
tab is hovered.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ymichael
ymichael merged commit 0e7b518 into main Sep 30, 2026
43 of 46 checks passed
@ymichael
ymichael deleted the bb/prototype-an-update-to-the-provider-usage-thr_r5awq3cs8i branch September 30, 2026 17:50
ymichael added a commit that referenced this pull request Oct 1, 2026
## Human comments

## What was wrong

The All tab added in #4571 squeezed every account onto one 24px row with
per-cell window labels, percentages and hairline bars. It was dense and
hard to scan, and reset times were only in tooltips. The provider tabs
already had a readable per-account layout. The All tab didn't reuse it,
so the two views showed the same data in different shapes.

## What changed

All changes are in `plugins/provider-usage`. No wire, SDK, or CLI
changes.

- **All tab** (`app.tsx`): stacks each provider tab's account blocks in
provider order. Each account's title line carries its provider icon, and
a divider separates providers. There are no separate provider headings,
so M4's four providers (Codex, Claude Code, opencode, Cursor) fit
without scrolling. The compact table and its shared-first window ranking
(`CompactUsageTable`, `CompactUsageCell`, `windowPriority`,
`compactWindowLabel`, `compactStatus`) are deleted.
- **Account blocks** (used by both the All tab and the provider tabs):
- The title is the account label, then the email, then the provider
name, so host accounts no longer show "Codex" under the Codex tab.
  - The plan badge stays.
- Every usage window sits on one card-wide grid (label, bar, percent,
time until reset), so columns line up across all accounts in the card.
- The percent text turns orange at 80% and red at 95%, matching the bar.
- Status messages (signed out, expired, not reported) are a single
`text-2xs` line.
  - Clicking a window still expands the full reset date.
- **Stories** (`app.stories.tsx`): the `live` scenario and a new **Live
server** story seed M4, M5, Intel (offline) and Account Pooler from a
real bb server's `getUsage` response. That data includes Cursor and
opencode with their logos. Emails are anonymized and resets are relative
to load time.
- README describes the stacked All tab.

## How you verified

- `pnpm exec turbo run lint typecheck test --filter='...[origin/main]'`:
pass (20 provider-usage tests). The footer test now asserts the All
tab's account order through the account regions and the account headings
on provider tabs.
- Visual QA in Ladle (`plugins/Provider usage` → Live server,
Disclosure), screenshotting every tab on each machine plus the existing
mixed-pool, loading, offline, and error scenarios.

> AGENT GENERATED

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <[email protected]>
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