fix: permanent [Timeout] in extra usage widgets when no monthly limit is set#416
Open
mhriemers wants to merge 2 commits into
Open
fix: permanent [Timeout] in extra usage widgets when no monthly limit is set#416mhriemers wants to merge 2 commits into
mhriemers wants to merge 2 commits into
Conversation
…age data Accounts with extra usage enabled but no monthly limit configured (monthly_limit: null) never receive extraUsageLimit/extraUsageUtilization from the usage API. hasRequiredUsageField treated those absent fields as incomplete data on every fetch - including successful ones - so cached data was never accepted, the fetch loop re-fetched each cycle, and the extra usage widgets surfaced the cached lock error as a permanent [Timeout]. Extend the existing extraUsageEnabled === false special case to any response where the extra usage state is known: once the API has told us whether extra usage is enabled, absent detail fields are conclusive and refetching cannot produce them. Fixes sirmalloc#413 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This was referenced Jun 4, 2026
…sirmalloc#418 Once sirmalloc#418 teaches the parser about extra_usage.currency, a fixture carrying the field would add extraUsageCurrency to the parsed result and break this test's expectation depending on merge order. The field is irrelevant to what this test covers (monthly_limit: null handling). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Author
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.
Summary
Fixes #413 — accounts with extra usage enabled but no monthly limit configured (
monthly_limit: null) saw the extra-usage widgets render a permanent[Timeout]even though every API fetch succeeded.Root cause
hasRequiredUsageField()treated the absence ofextraUsageLimit/extraUsageUtilizationas incomplete data. For limit-less accounts those fields never appear in the API response, so:getStaleUsageOrError()surfaced the lock error as[Timeout]— indefinitely, since no amount of refetching can produce a field the account doesn't have.Fix
Extend the existing
extraUsageEnabled === falsespecial case to any response where the extra usage state is known: once the API has reportedis_enabled, absent detail fields are conclusive.With this change the widgets render nothing for limit-less accounts (instead of a false network error), matching how other widgets handle genuinely unavailable data. #414 proposes showing
used_creditsfor these accounts.Testing
treats enabled extra usage without a monthly limit as complete for extra usage widget fields, with a fixture mirroring a realmonthly_limit: nullAPI response — fails without the fix (cache rejected, second probe re-fetches), passes with itbun run lintclean🤖 Generated with Claude Code