Skip to content

Fix 0/0 hover for ubb#314651

Merged
pwang347 merged 2 commits into
mainfrom
pawang/zeroTotalFix
May 6, 2026
Merged

Fix 0/0 hover for ubb#314651
pwang347 merged 2 commits into
mainfrom
pawang/zeroTotalFix

Conversation

@pwang347
Copy link
Copy Markdown
Member

@pwang347 pwang347 commented May 6, 2026

Fixes #314558

Copilot AI review requested due to automatic review settings May 6, 2026 06:10
@pwang347 pwang347 marked this pull request as ready for review May 6, 2026 06:10
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

Screenshot Changes

Base: c75215c0 Current: 46f8c065

Changed (9)

chat/input/chatInput/Default/Dark
Before After
before after
chat/input/chatInput/Default/Light
Before After
before after
chat/input/chatInput/WithFileChanges/Light
Before After
before after
chat/input/chatInput/WithTodos/Light
Before After
before after
chat/input/chatInput/WithTodosAndFileChanges/Dark
Before After
before after
chat/input/chatInput/WithArtifactsAndFileChanges/Dark
Before After
before after
chat/input/chatInput/WithArtifactsAndFileChanges/Light
Before After
before after
chat/widget/chatWidget/PendingToolApproval/Light
Before After
before after
chat/widget/chatWidget/MultiTurn/Light
Before After
before after

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses an incorrect quota hover display in the Chat Status dashboard where usage-based billing (UBB) quotas with entitlement: 0 could show a misleading 0 / 0 “credits used” fraction on hover.

Changes:

  • Adds a regression test ensuring hover does not change the displayed quota value when entitlement is zero.
  • Adjusts the dashboard hover behavior to avoid showing credit fractions when entitlement is falsy.
Show a summary per file
File Description
src/vs/workbench/contrib/chat/test/browser/chatStatusDashboard.test.ts Adds a new test for the entitlement: 0 hover scenario to prevent 0 / 0 display regressions.
src/vs/workbench/contrib/chat/browser/chatStatus/chatStatusDashboard.ts Changes hover/focus “show credits” logic to skip credit fraction rendering when entitlement is falsy.

Copilot's findings

Comments suppressed due to low confidence (1)

src/vs/workbench/contrib/chat/browser/chatStatus/chatStatusDashboard.ts:716

  • showCredits() now checks currentQuota.entitlement for truthiness. This makes the hover/focus display logic dependent on JS truthiness and means that when entitlement is 0 or undefined, showCredits() becomes a no-op. Because update() calls showCredits() whenever isHovered is true, quota updates that arrive while the element is hovered/focused will not refresh the displayed percentage/label. Consider using an explicit numeric check (e.g. typeof entitlement === 'number' && entitlement > 0) and falling back to showPercentage() when credits can't be shown so the UI still updates while hovered/focused.
		const showCredits = () => {
			if (typeof currentQuota !== 'string' && currentQuota.entitlement) {
				const total = currentQuota.entitlement;
				const used = total * (100 - currentQuota.percentRemaining) / 100;
				const usedFormatted = this.quotaCreditsFormatter.value.format(used);
				const totalFormatted = this.quotaCreditsFormatter.value.format(total);
				quotaValue.textContent = localize('quotaCreditsDisplay', "{0} / {1}", usedFormatted, totalFormatted);
				quotaValueSuffix.textContent = ` ${localize('quotaUsed', "used")}`;
			}
		};
  • Files reviewed: 2/2 changed files
  • Comments generated: 1

DonJayamanne
DonJayamanne previously approved these changes May 6, 2026
@pwang347 pwang347 enabled auto-merge (squash) May 6, 2026 06:41
@pwang347 pwang347 merged commit 1ed89f1 into main May 6, 2026
26 checks passed
@pwang347 pwang347 deleted the pawang/zeroTotalFix branch May 6, 2026 06:57
@vs-code-engineering vs-code-engineering Bot added this to the 1.120.0 milestone May 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Free users showing 0/0 credits used when limit is reached

4 participants