Repository navigation
Drop placeholder Codex secondary limit windows in Account Pooler - #3465
Merged
SawyerHood merged 1 commit intoSep 11, 2026
Merged
Conversation
The ChatGPT backend sends x-codex-secondary-* headers alongside the weekly window even when the account has no secondary limit: used-percent 0, reset-at 0, no window-minutes. The adapter stored that as a real window, so the Account Pooler showed a "LIMIT 2" pill at 0% with a reset at the Unix epoch. Treat a non-positive reset-at as absent and skip a header window that has no length, no reset, no usage, and no over-limit flag. A stored placeholder clears the next time the headers repeat it. Co-Authored-By: Claude Fable 5.1 <[email protected]>
SawyerHood
deleted the
bb/what-is-limit-2-in-the-account-pooler-thr_rps89hgjkk
branch
September 11, 2026 03:43
ymichael
added a commit
that referenced
this pull request
Sep 30, 2026
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]>
ymichael
added a commit
that referenced
this pull request
Sep 30, 2026
## 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 #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 "<machine> 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 #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](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Human comments
What was wrong
The ChatGPT backend returns
x-codex-secondary-*rate-limit headers alongside the weekly window even for accounts that have no secondary limit. Those headers carryused-percent: 0,reset-at: 0, and nowindow-minutes. The Codex adapter in the Account Pooler stored that as a real limit window, so the settings row showed a second pill labelledLIMIT 2at 0% next to the 7D pill, and the detail sheet reported a reset at the Unix epoch (rendered as "resets in 1m"). Accounts whose quota last came from the usage endpoint, which only returnsprimary_window, did not show it, which is why only one of two Codex accounts in the same pool had the extra pill.What changed
plugins/account-pool/src/codex-adapter.ts:reset-atheader that is zero or negative is treated as no reset time.account_quotaclears the next time the backend repeats it.Windows at 0% that report a length or a reset are kept. No wire, CLI, or doc changes.
How you verified
Added three tests in
plugins/account-pool/src/codex-adapter.test.ts: the placeholder secondary window is dropped, a stored placeholder is cleared when the headers repeat it, and a zero-usage window with a length or reset is kept. The first two fail before the change.275 tests pass, typecheck clean, Prettier clean. Confirmed against the live pool that the affected account's stored secondary window was exactly
{ windowMinutes: null, utilization: 0, resetAt: 0, source: "header" }.🤖 Generated with Claude Code