Skip to content

[Feature]: Add GitHub Copilot usage tracking (status-bar rate limits + Accounts pane) #6892

Description

@marcosgilf

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 host https://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 plus quota_snapshots (chat, completions, premium_interactions) and quota_reset_date. premium_interactions is 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/copilot stores 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-copilot ecosystem — copilot.vim, Neovim, Zed, and the Pi agent): token lives in ~/.config/github-copilot/apps.json / hosts.json (honoring XDG_CONFIG_HOME).
  • The gh CLI token is not usable — its scopes (gist, read:org, repo, workflow) lack Copilot access.

Implementation outline (mirror every kimi / opencode-go reference)

  1. 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 keychain copilot-cli second.
    • POST .../copilot_internal/v2/token, parse quota_snapshots + quota_reset_date.
    • Map premium_interactions (entitlement/remaining/percent/reset) → a RateLimitWindow. Because Copilot quota is a monthly entitlement bucket (not 5h/7d), extend ProviderRateLimits to carry it (reuse the optional monthly field already used by OpenCode Go).
  2. 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.allSettled fetch, 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.ts entries, with "uses your Copilot CLI login" copy (like Gemini/Kimi).
    • i18n: en.json keys (+ stub other locales).

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"):

  1. 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.
  2. 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:

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

  1. added
    enhancement
    size/m
    on Jun 30, 2026
  2. added theissue type on Jul 12, 2026
  3. davidjadczyk commented on Sep 21, 2026

    @davidjadczyk

    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.

  4. dgenezini commented on Nov 23, 2026

    @dgenezini

    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.

  5. 0xAlbertChen commented on Nov 29, 2026

    @0xAlbertChen

    +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:

    • Remaining quota and usage percentage.
    • Quota reset date and time.
    • Status bar integration.
    • Multiple account support.
    • Machine-readable quota data via the Orca CLI and RPC.

    Without Copilot usage tracking, Orca's centralized quota management remains incomplete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementsize/m

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions