Repository navigation
Description
Problem or use case
Orca's usage tracking (Configure usage tracking → AI Provider Accounts) supports Claude, Codex, Gemini, OpenCode Go, and Kimi, but not GitHub Copilot — even though Copilot already ships as a launchable agent (agent: 'copilot', ~/.copilot hook-service, added in #2027).
Copilot users (especially Enterprise/Business seats with monthly premium-interaction "credits") have no way to see their remaining quota in Orca's status bar the way every other provider does. VS Code already surfaces this (e.g. Copilot Enterprise 36% — 18,421.2 / 50,000 credits used, resets Jul 1); Orca should reach parity.
This follows the established pattern from #1022 (Gemini + OpenCode Go usage tracking) and the sibling token-based provider in #4570 (Kimi).
Proposed solution
Add copilot as a live rate-limit provider (subsystem in src/main/rate-limits/), mirroring the Kimi template: read a local credential read-only, call the quota API, return ProviderRateLimits. No chat traffic, no credential mutation, never logs out a live session.
How Copilot quota actually works (verified against the shipped @github/copilot CLI source)
- Auth host
https://api.github.com, API hosthttps://api.githubcopilot.com. - Quota is exchanged standalone via
POST https://api.github.com/copilot_internal/v2/token, sending the GitHub OAuth token. The response carries the Copilot bearer plusquota_snapshots(chat,completions,premium_interactions) andquota_reset_date.premium_interactionsis the Enterprise "credits" bucket VS Code shows. No model call needed. - Snapshot fields confirmed present in the CLI:
entitlement,remaining,percent_remaining,overage.
Where the existing Copilot login lives (verified locally, no secret read)
- Copilot CLI
@github/copilotstores prefs in~/.copilot/config.json(no token there). - macOS: GitHub OAuth token is in the OS keychain via keytar, service name
copilot-cli. - Linux/Windows (shared
github-copilotecosystem — copilot.vim, Neovim, Zed, and the Pi agent): token lives in~/.config/github-copilot/apps.json/hosts.json(honoringXDG_CONFIG_HOME). - The
ghCLI token is not usable — its scopes (gist, read:org, repo, workflow) lack Copilot access.
Implementation outline (mirror every kimi / opencode-go reference)
- New
src/main/rate-limits/copilot-usage-fetcher.ts(+ test):- Read GitHub OAuth token read-only. Source precedence: file-based
~/.config/github-copilot/*first (Linux/Windows/portable), macOS keychaincopilot-clisecond. POST .../copilot_internal/v2/token, parsequota_snapshots+quota_reset_date.- Map
premium_interactions(entitlement/remaining/percent/reset) → aRateLimitWindow. Because Copilot quota is a monthly entitlement bucket (not 5h/7d), extendProviderRateLimitsto carry it (reuse the optionalmonthlyfield already used by OpenCode Go).
- Read GitHub OAuth token read-only. Source precedence: file-based
- Thread provider id
'copilot'through the ~30 touchpoints the other providers use:- shared:
rate-limit-types.ts(provider union +RateLimitState.copilot),types.ts(StatusBarItem,_copilotStatusBarDefaultAdded),status-bar-defaults.ts,telemetry-events.ts. - main:
rate-limits/service.ts(state slot,withFetchingStatus,Promise.allSettledfetch, result mapping, stale policy). - renderer:
store/slices/rate-limits.ts,web/web-preload-api.ts, status bar (StatusBar.tsx,status-bar-provider-visibility.ts,status-bar-agent-gating.ts,tooltip.tsx,usage-error-copy.ts, icons),store/slices/ui.ts(default-add migration),appearance-status-bar-search.ts. - Accounts pane: new Copilot section in
AccountsPane.tsx+accounts-search.tsentries, with "uses your Copilot CLI login" copy (like Gemini/Kimi). - i18n:
en.jsonkeys (+ stub other locales).
- shared:
Acceptance criteria
- Copilot appears in AI Provider Accounts alongside the other providers.
- When a readable Copilot login exists, the status bar shows a Copilot usage chip with remaining premium-interaction credits and reset date.
- No login / unreadable token → graceful "not configured" / "not available" state, never a crash or a keychain prompt loop.
- Read-only: Orca never writes, refreshes, or invalidates the user's Copilot/GitHub credentials.
Alternatives or additional context
Two risks that shape req. 3 ("use the existing copilot-cli login, or an alternative login we define"):
- macOS keychain reads prompt / fail across code signing. Orca reading another app's keychain item (
copilot-cli) triggers a Keychain Access prompt or is denied under different signing. File-based sources work on Linux/Windows; macOS keychain is fragile. - Headless / SSH / no-CLI users have no readable token at all.
→ Fallback login Orca should define: an Orca-owned GitHub device-flow OAuth (Copilot client id, same flow copilot.vim and the Pi agent use) that writes Orca's own credentials, used whenever no readable CLI token exists. This covers macOS, SSH/remote, and users without the Copilot CLI installed.
Scope notes:
- In scope: live rate-limit / status-bar usage chip (this issue).
- Out of scope (parity with Kimi [Feature]: Improve Kimi Code support (status, usage, token analytics) #4570): usage-analytics scanner + a Copilot tab in Stats. Kimi has none either; defer to a follow-up.
Related: #1022 (pattern precedent — Gemini/OpenCode Go usage tracking), #4570 (sibling Kimi token-based provider), #2027 (Copilot as a launchable agent).
Cross-platform / SSH: token source differs per OS (keychain vs file); the fetcher must guard both behind runtime checks and degrade gracefully on remote/SSH worktrees where no local Copilot login exists.
Activity
davidjadczyk commentedon Sep 21, 2026
Agreed this is important for a lot of devs as GitHub Copilot has emerged as a defacto standard for Coding Agent Subscriptions for larger Enterprises that are locked in the Microsoft Enterprise Ecosystem already.
dgenezini commentedon Nov 23, 2026
Adding weight. Copilot is the only agent subscription I use that has no usage chip in the status bar, so the bar under-reports what I actually have left while Claude, Codex, Gemini and Cursor all show up.
For Business/Enterprise seats the number that matters is remaining premium requests plus the reset date — a bare percentage is not enough to plan around.
One practical note: Linux is the low-risk platform to land this on first. Copilot CLI keeps its login in a file under
~/.copilot, so the macOS keychain / code-signing problem described above does not apply there, and a read-only file-based fetcher would work today. A graceful "not available" state for SSH/headless is fine.0xAlbertChen commentedon Nov 29, 2026
+1 for GitHub Copilot usage tracking.
I use Orca to manage multiple AI coding agents across different providers. Centralized quota monitoring is essential for efficient workload distribution and maximizing subscription utilization.
Please add GitHub Copilot to AI Provider Accounts and support:
Without Copilot usage tracking, Orca's centralized quota management remains incomplete.