Commit Graph
2 Commits
Author SHA1 Message Date
yetone d688a8b43c providers, gui: a Copilot account on the individual_max plan reads "Max", not "Individual_max", and individual_edu reads "Education"
copilotPlans had no name for two copilot_plan values that GitHub sends,
so label() capitalised the raw id. GitHub's own clients name them:
- VS Code's chatEntitlementService maps individual_pro to ProPlus
  ("Copilot Pro+"), individual_max to Max ("Copilot Max") and
  individual_edu to EDU.
- CopilotForXcode's planDisplayName gives "Copilot Pro+ Plan" for
  individual_pro and "Copilot Max Plan" for individual_max.

So individual_max is Max, not Pro+. The real individual_max response in
copilot_usage_test.go has a premium allowance of 20000, above Pro+'s.
That test and its comments called it Pro+ and now say Max. VS Code also
gives individual_edu the EDU entitlement, which magpie already labels
"Education" through the free_educational_quota SKU, so the plan id gets
the same name. The full list of ids that GitHub's clients handle (free,
individual, individual_pro, individual_max, individual_edu, business,
enterprise) is now named. The Copilot tile's plan list in the Add sheet
includes Max.

Verified: TestCopilotEntitlementLabels fails without the map change
("{Plan:individual_max AccessSKU:free_github_star_quota}: "Individual_max",
want "Max""; individual_edu the same), and passes with it under -race
-count=20. deprecated-subscriptions and signin-closes-sheet GUI tests pass
in Chromium and WebKit (5/5 each). No new t() string.
2026-10-07 07:08:17 +08:00
yetone a24458ca4b providers: a Copilot Business seat that has used up its premium requests reads as used up, not unlimited (#1063, n1majne3: Github copilot Bussiness额度用尽时显示为无限)
magpie counted a quota_snapshots entry only when has_quota was true. GitHub
sends has_quota false for an allowance that is used up, and under
token-based billing for every snapshot, so an exhausted seat's
premium_interactions was dropped and the card showed only Chat and
Completions, both unlimited. The snapshot is now read as VS Code's
chatEntitlementService (parseQuotas, getQuotaUsage, isChatQuotaExceeded)
reads it:

- an entitlement of 0 on a limited snapshot is no allowance (left out);
  otherwise used = entitlement - quota_remaining, or 100 - percent_remaining
  when quota_remaining is absent; neither known is unknown and left out,
  never unlimited;
- entitlement, quota_remaining and quota_reset_at come as numbers or as
  strings ("3900"); a string used to fail the whole reading;
- an organization's pooled premium allowance (unlimited true, has_quota
  false) is used up, not unlimited; chat and completions keep reading
  unlimited, as VS Code reads them;
- quota_reset_at, when set, is the snapshot's own reset;
- premium past its allowance with overage_permitted no longer stops a Pro
  account (Aside), while a Business or Enterprise seat stops whatever it
  says, as VS Code pauses it ("Contact your administrator").

GUI card, tray, TUI and CLI all render these windows, so none of them
changes. TestCopilotUsageReadsEverySeat (a real Pro+ response from
api.github.com, Business left / used up as numbers and as strings, Business
with overage, Enterprise pool spent / left, routing over each),
TestCopilotUsageFreeUnderTokenBilling and TestCopilotUsageUnknownIsNotUnlimited
fail on the old code (no Premium requests window; "cannot unmarshal string
into ... entitlement of type float64"). Not tried with a real Business seat:
its shapes are VS Code's test fixtures and the Pro+ account's live bytes.
2026-10-07 05:52:14 +08:00