Repository navigation
feat(usage): show GitHub Copilot premium request usage - #25911
Draft
geoff-powell wants to merge 1 commit into
Draft
geoff-powell wants to merge 1 commit into
geoff-powell wants to merge 1 commit into
Conversation
|
@geoff-powell if i build the app locally i can help you verify? I want this feature badly :D |
This branch has not been deployed
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.
ELI5
Orca shows how much of your AI subscription you've used for Claude, Codex, Gemini, Kimi, and others — but not GitHub Copilot. This adds Copilot: if you're already signed in to Copilot, Orca shows your monthly premium-request usage in the status bar and in Settings → Accounts.
What Changed
src/main/rate-limits/copilot-usage-fetcher.ts(+ tests):github-copilotconfig dir (apps.json, thenhosts.json; honorsXDG_CONFIG_HOME/LOCALAPPDATA) first, then the macOS Keychain itemcopilot-cli.github.comentries are used (a GHE token is never sent to github.com). Token is redacted from errors and never stored; account identity is an HMAC.GET https://api.github.com/copilot_internal/user→ mapsquota_snapshots.premium_interactionsto the existingmonthlywindow, with "used / entitlement" and the reset date. 401 →stale-token, 403/404 →no-subscription, 429 →rate-limited. No login →unavailable(no chip).'copilot'threaded through shared types, defaults, RPC enum, persisted UI flag (_copilotStatusBarDefaultAdded, one-shot default-on migration).CopilotAccountsSectionin Accounts, en.json strings (other locales via the catalog sync script).accounts-zcode-search.tssoaccounts-search.tsstays under the max-lines cap.Why
Follows the #1022 / #4570 / ZCode (#23520) pattern. I used
/copilot_internal/userrather than thePOST /copilot_internal/v2/tokensuggested in the issue: both returnquota_snapshots, butv2/tokenalso mints a Copilot bearer, while/userkeeps Orca strictly read-only (it is also what VS Code uses for its quota display). The chip is not PATH-gated on thecopilotCLI because the login may come from copilot.vim / Zed / JetBrains.Out of scope (follow-up): an Orca-owned GitHub device-flow login for macOS/SSH users without a readable token, and a Stats tab.
Linked Issue
Fixes #6892
Visual Proof
Pending — I haven't yet run the app against a real Copilot seat; will attach before/after of the status bar and Accounts pane before marking ready.
Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
copilot-usage-fetcher.test.ts: config-dir resolution, apps/hosts precedence, GHE filtering, window mapping (entitlement/percent/unlimited), HTTP error mapping, token redaction, Keychain-denial latch.Existing service tests mock the new fetcher; hydration test updated for the new default-on item.
tsc(node/web/cli), oxlint, oxfmt, localization verify/extraction/coverage, max-lines ratchet: pass. Vitest oversrc/main/rate-limits,settings,status-bar,store: 724 files pass.Still to verify against a live seat: the
/copilot_internal/userresponse shape and the Keychain lookup by service name only (macOS).AI Disclosure
Implemented with an AI coding agent (Claude, via OpenCode), reviewed by me.
Review
Agent skill upstream boundary