Skip to content

Account Pooler keeps stale 5-hour values when an account has no 5-hour limit (five_hour: null) or no window running (resets_at: null) #7149

Closed

Description

@seklow

Summary

Account Pooler never clears its stored 5-hour window. It just keeps whatever values it saw last. On my pool this goes wrong in two cases:

  1. The account has no 5-hour limit. /api/oauth/usage returns five_hour: null for two of my Max 20x accounts, so they no longer report a 5-hour limit at all. The pool keeps the last 5-hour utilization, reset and status it ever saw, and Settings → Account Pooler still draws a 5H bar for an account that has no such limit.
  2. No 5-hour window is running. For idle accounts the endpoint returns five_hour: { utilization: 0, resets_at: null }. The pool keeps the previous reset time, which can be days in the past.

I expected the pool to store "no 5-hour limit" or "no window running" and to show that, not the last observation.

Versions and environment

  • bb 0.48.1 (npm bb-app, systemd user service), Debian 13, Node v24.22.1; built-in Account Pooler with 8 Claude OAuth accounts.
  • The installed bundle (server/dist/builtin-plugins/account-pool/dist/server.js) has the same logic as main at a0f291b8084ed69aacfc00dc1492a53da30618ad: fiveHourUtilization:c?.utilization??A.fiveHourUtilization,fiveHourResetAt:c?.resetAt??A.fiveHourResetAt,fiveHourStatus:c?.status??….

Steps to reproduce

This was observed on live accounts. Whether an account has a 5-hour limit is decided by Anthropic, so I can't toggle it on demand.

  1. Have a pooled Claude account whose GET https://api.anthropic.com/api/oauth/usage (with anthropic-beta: oauth-2025-04-20) returns "five_hour": null together with a normal seven_day bucket.
  2. Let the pool refresh usage (it does so every 5 minutes), then run bb pool account list --json and open Settings → Account Pooler.

The same code path can be reproduced at unit level: call quotaFromUsage with a previous quota that has fiveHourUtilization: 1, fiveHourStatus: "rejected" and a payload of { five_hour: null, seven_day: { utilization: 30, resets_at: … } }. The result keeps fiveHourUtilization: 1 and fiveHourStatus: "rejected".

Expected vs actual

Read-only usage responses on 2026-11-06 (~02:05Z), fetched with the pool's own access tokens. Accounts are anonymized.

account A (Max 20x)  five_hour=null                                   seven_day.utilization=100
account B (Max 20x)  five_hour=null                                   seven_day.utilization=30
account C (Max 20x)  five_hour={"utilization":0.0,"resets_at":null,…}  seven_day.utilization=100

What the pool stores for them (bb pool account list --json, same minute):

account A  fiveHourUtilization=0 fiveHourStatus=allowed fiveHourResetAt=2026-10-28T17:49Z  (9 days in the past)
account B  fiveHourUtilization=0 fiveHourStatus=allowed fiveHourResetAt=2026-10-31T14:40Z  (6 days in the past)
account C  fiveHourUtilization=0 fiveHourStatus=allowed fiveHourResetAt=2026-11-04T02:00Z  (2 days in the past)
  • Actual: A and B keep an old 5-hour observation and show a 5H bar, although the provider no longer reports a 5-hour limit for them. All three keep a stale past reset. If an account's last observation before losing its 5-hour limit had been utilization: 1, status: rejected with a future reset, the pool would keep treating it as 5-hour-exhausted until that stale reset passed.
  • Expected:
    • five_hour: null clears the 5-hour fields, and the UI shows that this account has no 5-hour limit (for example "—" in the 5H column, or no 5H bar).
    • resets_at: null together with utilization: 0 clears the stored reset, and the UI shows "no window running" instead of a past reset time.

Evidence

  • five_hour == null is mapped to null (usage.ts#L171-L172), and every 5-hour field then falls back to the previous value (usage.ts#L195-L197). The same ?? previous fallback keeps a past fiveHourResetAt when resets_at is null.
  • The account row always includes a 5H column for Claude accounts, which is drawn from the stored value (app.tsx#L328-L333).
  • Investigation: bb thread thr_agudxusj98 (private).

What you ruled out

Suggested priority and effort

Low priority, low effort. It is mostly a misleading display. It can only affect routing in the stale-rejected case described above.

AGENT GENERATED

Activity

  1. seklow commented on Nov 11, 2026

    @seklow
    Author

    Follow-up: #7191 fixed the usage path, but a removed 5-hour window can still stay while the account is busy. Responses without 5h headers keep the old window, and usage refresh skips accounts with requests in flight. Details are in #7418.

    AGENT GENERATED

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions