From 1f21ab0886af873fc357ac18b532ede6df399959 Mon Sep 17 00:00:00 2001 From: Ariel Sandor Date: Tue, 31 Mar 2026 23:39:16 -0700 Subject: [PATCH] fix(quota): show actual overusage percentage for GitHub Copilot (#805) Remove the Math.min(100, ...) clamp on usedPercent in the Copilot quota provider so overusage flows through as the real value (e.g. 353%). Update formatPercent to display values above 100% instead of clamping, matching what the GitHub Copilot settings page reports. The progress bar remains capped at 100% width via its own independent clampPercent call, so only the label text is affected. Co-authored-by: Ariel Sandor <39200214+arielsandor@users.noreply.github.com> --- packages/ui/src/lib/quota/utils.ts | 5 ++--- packages/web/server/lib/quota/providers/copilot.js | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/ui/src/lib/quota/utils.ts b/packages/ui/src/lib/quota/utils.ts index 14c13a54..484ad127 100644 --- a/packages/ui/src/lib/quota/utils.ts +++ b/packages/ui/src/lib/quota/utils.ts @@ -6,11 +6,10 @@ export const clampPercent = (value: number | null): number | null => { }; export const formatPercent = (value: number | null): string => { - const clamped = clampPercent(value); - if (clamped === null) { + if (typeof value !== 'number' || Number.isNaN(value)) { return '-'; } - return `${clamped}%`; + return `${Math.round(value)}%`; }; export const resolveUsageTone = (percent: number | null): 'safe' | 'warn' | 'critical' => { diff --git a/packages/web/server/lib/quota/providers/copilot.js b/packages/web/server/lib/quota/providers/copilot.js index c3ebfe61..9df7b3d2 100644 --- a/packages/web/server/lib/quota/providers/copilot.js +++ b/packages/web/server/lib/quota/providers/copilot.js @@ -18,7 +18,7 @@ const buildCopilotWindows = (payload) => { const entitlement = toNumber(snapshot.entitlement); const remaining = toNumber(snapshot.remaining); const usedPercent = entitlement && remaining !== null - ? Math.max(0, Math.min(100, 100 - (remaining / entitlement) * 100)) + ? Math.max(0, 100 - (remaining / entitlement) * 100) : null; const valueLabel = entitlement !== null && remaining !== null ? `${remaining.toFixed(0)} / ${entitlement.toFixed(0)} left`