Skip to content

feat: [TBB] Refactor quota usage menu and UI updates#172

Open
ethanyhou wants to merge 4 commits into
mainfrom
ethan/tbb-plan-usage
Open

feat: [TBB] Refactor quota usage menu and UI updates#172
ethanyhou wants to merge 4 commits into
mainfrom
ethan/tbb-plan-usage

Conversation

@ethanyhou
Copy link
Copy Markdown
Contributor

@ethanyhou ethanyhou commented May 11, 2026

This PR updated Copilot usage status bar menu and menu bar menu.

  • Switch cls to qingyiliu/token-based-billing
  • Test using test accounts and adjust the quota usage using the old quota setup portal (It is working now and the usage menu should be refreshed in the real time as long as CAPI notifies the quota changes) :
Plan Account UI (status bar menu should be identical to the menu bar menu)
Max eclipse-proplus image
Pro+ xcode-proplus image
Pro xcode-pro image
Free xcode-test image
CB eclipse-cb image
CB xcode-cb image
CE MS account image

CFI users should see AI Credits and CBCE users should see Monthly Limit if the plan is not unlimited.


Also added code to fallback to the original UI before TBB relase

Component Before TBB After TBB
Model selector image image
Chat footer image image
Usage menu image image

Copilot AI review requested due to automatic review settings May 11, 2026 08:40
Copy link
Copy Markdown

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 refactors the Copilot “Usage” menu (status bar + menu bar) to support updated quota semantics and plan types (including Individual Max), adds shared menu helpers, and modernizes the quota protocol types to Java records.

Changes:

  • Introduces MenuUtils to centralize plan labeling, usage icon selection, overage/upgrade row logic, and allowance-reset formatting.
  • Updates status-bar and menu-bar handlers + QuotaTextCalculator to render the new usage UI (monthly limit/included credits, overage upsell, allowance reset row).
  • Refactors quota protocol DTOs (Quota, CheckQuotaResult) to records, adds resetDateUtc, and adds CheckQuotaResult.empty() as the default placeholder.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/utils/MenuUtils.java New shared helpers for usage menu rendering (plan labels, icons, allowance reset, predicates).
com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/i18n/messages.properties Adds/updates localized strings for the refactored usage UI.
com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/i18n/Messages.java Declares new NLS fields for the updated usage UI strings.
com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/handlers/ShowStatusBarMenuHandler.java Refactors status-bar menu construction and refresh to use MenuUtils + new quota display rules.
com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/handlers/ShowMenuBarMenuHandler.java Refactors menu-bar contribution items to match the new usage UI and refresh behavior.
com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/handlers/QuotaTextCalculator.java Updates quota row text formatting (included credits vs monthly limit, percent formatting, tooltips).
com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/services/ModelService.java Updates plan accessor usage after CheckQuotaResult refactor.
com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/ChatContentViewer.java Updates plan accessor usage and reuses CFI plan predicate.
com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/protocol/quota/QuotaSnapshotParams.java Adds record type for quota snapshots used in quota change/warning notifications.
com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/protocol/quota/Quota.java Refactors quota DTO to a record with clamped percentRemaining and equality excluding timestamp.
com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/protocol/quota/CopilotPlan.java Adds individual_max plan value.
com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/protocol/quota/CheckQuotaResult.java Refactors to a record, adds resetDateUtc + token-based billing flag, and empty() placeholder.
com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/AuthStatusManager.java Uses CheckQuotaResult.empty() as the default quota status.
com.microsoft.copilot.eclipse.core.test/src/com/microsoft/copilot/eclipse/core/AuthStatusManagerTests.java Updates tests to use CheckQuotaResult.empty() instead of new CheckQuotaResult().

@ethanyhou ethanyhou changed the title feat: Refactor quota usage menu and UI updates feat: [TBB] Refactor quota usage menu and UI updates May 11, 2026
Co-authored-by: Copilot <copilot@github.com>
@ethanyhou
Copy link
Copy Markdown
Contributor Author

Hi @jdneo,

As we aligned, append TBB fallback to the same PR via commit: 2bac11b

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.

3 participants