Repository navigation
Store Account Pooler's Claude 5-hour and 7-day limits as limit windows - #7191
Merged
Merged
Conversation
Claude quotas kept dedicated fiveHour*/sevenDay* fields, and the usage
refresh fell back to the previous value for each one. `five_hour: null`
(no five-hour limit) therefore kept the last observation, `resets_at: null`
(no window running) kept a past reset, and a stale rejected five-hour window
kept the account exhausted until that reset passed.
Claude now records these limits in `limitWindows`, the list Codex already
uses: the five-hour limit is the 300-minute primary window and the seven-day
limit the 10080-minute secondary window. A usage response rebuilds the list,
so an absent bucket drops its window and a null reset clears it. Rate-limit
headers still merge into the previous window, because a missing header means
"not sent". Routing, the settings row and dialog, the provider-usage source,
and the CLI now read one shape for both providers. The settings UI keeps
Claude's own labels ("5 hour", "7 day") and shows empty 5H and 7D slots for
an account with no observed usage; the only visible change is that a window
Anthropic no longer reports disappears.
A migration copies the stored columns into limit_windows_json and nulls
them; the columns stay so older builds can still open the database.
`bb pool account list --json` and `bb pool status --json` no longer include
the fiveHour*/sevenDay* fields, and the CLI table drops its 5h/7d columns
in favour of the existing Windows column. The unused governingWeeklyResetAt
and longestLimitWindow are removed.
Fixes #7149
Co-Authored-By: Claude Opus 5.5 <[email protected]>
API-key accounts are billed per token and have no subscription usage windows, yet Account Pooler published every pooled account to Provider usage. Each one appeared as a "Claude Code" row that said "Usage has not been observed for this account." or "No usage limits reported for this plan." The usage source now lists only signed-in (OAuth) accounts and treats an API-key account id as unknown when fetched. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Nov 11, 2026
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
Account Pooler stored Claude's shared limits in dedicated
fiveHour*/sevenDay*fields, and the usage refresh (quotaFromUsage) fell back to the previous value for each field.GET /api/oauth/usagereturningfive_hour: null(the account has no 5-hour limit) therefore kept the last observation.five_hour: { utilization: 0, resets_at: null }(no window running) kept a reset from days ago, which Settings showed as "resets in 1m". A stale rejected 5-hour window kept the accountexhausted, so requests got 429 until that stale reset passed. Codex didn't have this bug: it already stored limits as alimitWindowslist rebuilt from each usage response. Reported in #7149.What changed
limitWindows, the list Codex already uses. The 5-hour limit is theprimarywindow (300 min) and the 7-day limit is thesecondarywindow (10080 min). ThefiveHour*/sevenDay*fields are removed fromAccountQuota/AccountSummary(src/contracts.ts).src/usage.ts): a usage response rebuilds the list, so a null bucket drops its window and a null reset clears it. A response with neither bucket keeps the previous windows.src/quota.ts): they now write into the same windows and still merge field by field with the previous window, because a missing header means "not sent".quotaWindows), the settings row and dialog, the provider-usage source and the CLI now read one shape for both providers. The settings UI keeps Claude's own labels ("5H"/"7D", "5 hour"/"7 day") and its empty 5H/7D slots for an account with no observed usage. The only visible change is that a window Anthropic no longer reports disappears, and a stale reset is no longer shown.src/store.ts): an appended migration copies the storedfive_hour_*/seven_day_*columns intolimit_windows_jsonand nulls them. The columns stay so older builds can still open the database.bb pool account list --jsonandbb pool status --jsonno longer includefiveHourUtilization,fiveHourResetAt,fiveHourStatus,sevenDayUtilization,sevenDayResetAtandsevenDayStatus. The same data is inlimitWindows. Thebb pool account listtable drops its 5h/5h reset/7d/7d reset columns; the existing Windows column now shows Claude's windows (5h=…; 7d=…). No docs or skills referenced the removed fields or columns.governingWeeklyResetAtandlongestLimitWindow.src/usage-source.ts): Account Pooler now lists only signed-in (OAuth) accounts to Provider usage. API-key accounts are billed per token and have no usage windows. Before, each one showed up as a "Claude Code" row that said "Usage has not been observed for this account." or "No usage limits reported for this plan." Fetching an API-key account id now reports it as unknown.This goes further than the issue's suggested fix (clear the fields on null). It makes Claude use the same window model as Codex, so the field-by-field fallback that caused the bug no longer exists on the usage path.
How you verified
pnpm exec turbo run typecheck lint test --filter=bb-plugin-account-poolpasses 393/393. The 3 lint warnings inapp.tsxalready exist on main.src/usage.test.ts:five_hour: nulldrops a rejected 5-hour window and the account is no longer exhausted,resets_at: nullclears the reset, and a response with neither bucket keeps the previous windows. The first two cases failed on main.VACUUM INTOcopy of a real Account Pooler database (2 Claude rows and 1 Codex row); every row converted and read back throughQuotaStore.five_hour: null:exhausted, request → 429ready, request → 200Fixes #7149
🤖 Generated with Claude Code