Repository navigation
Conversation
…eadings silently A usage refresh that got an HTTP error, a response that could not be read, or a network error returned as if it had succeeded. The hub also swallowed any error with .catch(() => undefined). Provider usage then kept showing the last reading as current, and plugin.log had nothing (get-bb#7739). The Claude and Codex adapters now reject when the usage request fails. The hub records the latest failure per account, clears it on the next successful refresh, and logs one warning per account and reason. The usage source reports the failure as that account's error state, so Provider usage keeps the last reading and shows that it could not be refreshed. bb pool account refresh exits with usage_refresh_failed. The failure is not stored as quota.error, so routing is unaffected.
lanjak
force-pushed
the
fix-7739-pool-usage-refresh-failures
branch
from
November 24, 2026 00:58
1b3a28a to
5eade87
Compare
This branch has not been deployed
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
An Account Pooler usage refresh that failed looked like a success. The Claude adapter cancelled the body of a non-OK response and returned, turned a JSON parse failure into
null, and ignored a payload that produced no quota (claude-adapter.ts#L108-L156). The Codex adapter returned early in the same cases. The hub then swallowed anything that was thrown, such as a network error, with.catch(() => undefined)(hub.ts#L369-L389). So the usage source still had a stored observation and no account error, and returnedstatus: "ok"with the old windows. Provider usage showed them as current, and plugin.log had nothing (#7739).What changed
claude-adapter.ts,codex-adapter.ts:refreshUsagerejects when the usage request fails, withthe usage endpoint returned HTTP <status>orthe usage response could not be read. A network error propagates as before. A valid response with no usage data ({}) is not a failure, because there is nothing to update. The Claude account-UUID lookup still runs after a failed usage request.hub.ts:refreshAccountUsagerecords the latest failure per account and clears it on the next successful refresh. It reports a failure through a newonUsageRefreshFailedcallback only when the reason changes, so a persistent 401 logs once instead of every 5 minutes.server.tslogs it asAccount Pooler <provider> account <id> usage refresh failed: <reason>.usage-source.ts: an account with a recorded failure reportsstatus: "error"withUsage could not be refreshed: <reason>.and keeps itsobservedAt. Provider usage already handles this state: it keeps the last reading on that account's row and shows the message followed by "Showing last update.". No Provider usage change.quota.error. That field makesaccountStatusreturnerrorand takes the account out of routing, and a failing usage endpoint does not make the account unusable.cli.ts,operations.ts:bb pool account refresh <id>fails withusage_refresh_failedwhen the forced refresh fails, instead of printing "Refreshed usage". The plugin skill reference documents this.Deviations from the issue:
observedAtcarried through Provider usage's snapshot schema and UI. That is a separate change, not made here.How you verified
server.test.tscases through the real plugin entry and its usage RPC:errorstate with the reason and an unchangedobservedAt, one warning (not repeated on the next failed refresh),error: nullon the account instatus.get, the CLI exit code and message, and recovery tookonce the endpoint works again.okand no warning.observedAtis stillnull.pnpm exec turbo run test typecheck lint --filter=bb-plugin-account-poolpasses (405 tests). The 3 lint warnings are React Compiler notes that main has too.Fixes #7739