fix: show status badges in overview when no quota data is available#489
Open
RaghavShubham wants to merge 2 commits into
Open
fix: show status badges in overview when no quota data is available#489RaghavShubham wants to merge 2 commits into
RaghavShubham wants to merge 2 commits into
Conversation
When a plugin returns only a "Status" badge (e.g. "No usage data" or "Rate limited") and the card is rendered in overview scope, the badge was silently filtered out because its label was not listed as an overview-scoped line in plugin.json. This left the card visibly blank after the first successful probe set `lastUpdatedAt`, making `hasStaleData` true while `filteredLines` remained empty. Fix the scope filter in ProviderCard to always pass badge-type lines through regardless of scope — they are status indicators, not metric lines, and should always be visible. Also improve the Claude plugin's fallback message when the usage API responds successfully but returns no recognized quota fields (e.g. Enterprise plans or future plan types): show "Connected — no quota data" instead of the generic "No usage data" so users can distinguish a working connection from an authentication or network failure. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The personal usage endpoint (/api/oauth/usage) returns 403 for Enterprise accounts because their billing is tracked at the organisation level, not per-user. Previously the plugin treated any 403 as a token-expired error, which caused the JS probe to throw, the Rust runtime to emit an Error badge, and the state management to set data=null. On the first load this left the provider card completely blank because hasStaleData was false and no PluginError was prominently surfaced. Fix: intercept 403 from the usage endpoint before the generic isAuthStatus check and treat it as "no personal quota data" instead. The probe no longer throws, returns a "Status: Enterprise — org-level billing" badge, and the card renders meaningful content on the first load. A three-way fallback is now emitted when lines is empty: • 403 response → "Enterprise — org-level billing" • 200 but no recognized quota fields → "Connected — no quota data" • Inference-only / no API call → "No usage data" Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
1 issue found across 2 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="plugins/claude/plugin.js">
<violation number="1" location="plugins/claude/plugin.js:632">
P2: Enterprise/org-billing status badge is not stable across probes because `orgBillingOnly` is function-local and lost when requests are throttled via the min-interval guard.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
| let lines = [] | ||
| let rateLimited = false | ||
| let retryAfterSeconds = null | ||
| let orgBillingOnly = false // true when the API returned 403 (Enterprise org-level billing) |
Contributor
There was a problem hiding this comment.
P2: Enterprise/org-billing status badge is not stable across probes because orgBillingOnly is function-local and lost when requests are throttled via the min-interval guard.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At plugins/claude/plugin.js, line 632:
<comment>Enterprise/org-billing status badge is not stable across probes because `orgBillingOnly` is function-local and lost when requests are throttled via the min-interval guard.</comment>
<file context>
@@ -629,6 +629,7 @@
let lines = []
let rateLimited = false
let retryAfterSeconds = null
+ let orgBillingOnly = false // true when the API returned 403 (Enterprise org-level billing)
if (canFetchLiveUsage) {
if (nowMs < rateLimitedUntilMs) {
</file context>
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.
Problem
When a plugin returns only a status badge — "No usage data" or "Rate limited" — and the card is rendered in overview/menu-bar scope, the badge was silently dropped, leaving the card visibly blank.
Root cause
ProviderCardfilters lines by scope:overviewLabelsis built fromskeletonLineswithscope === "overview". For Claude that's only"Session"and"Weekly". The fallback badge has label"Status"— not in the set — so it gets filtered out.After the first successful probe sets
lastUpdatedAt,hasStaleDatabecomestrue, butfilteredLinesstays empty. The{hasStaleData && …}block renders with no children → blank card.This affects Enterprise accounts (API responds but contains no recognized quota fields), inference-only tokens, and any provider where the plugin falls back to a status-only badge.
Fix
src/components/provider-card.tsx— Badge-type lines are status indicators, not metric lines. They must always pass the scope filter:plugins/claude/plugin.js— Improve the fallback message so users can distinguish a working connection from an auth/network failure:"Connected — no quota data"(e.g. Enterprise plans)"No usage data"(unchanged)Tests
provider-card.test.tsxthat reproduces the exact scenario: overview scope +lastUpdatedAtset + only a"Status"badge → badge must be visible.plugin.test.jsto match the new"Connected — no quota data"text for the API-connected case, and added a complementary test for the inference-only path (must still show"No usage data"and must not call the HTTP API).All 1087 tests pass.
Closes #440
Summary by cubic
Always show status badges in the overview and clarify Claude’s status when personal quota data isn’t available, including Enterprise org‑billing accounts.
Written for commit 4813319. Summary will update on new commits. Review in cubic