Skip to content

feat: live quota for Gemini, Copilot, Antigravity + per-provider toggles - #1114

Merged
iamtoruk merged 1 commit into
mainfrom
feat/1112-quota-providers
Aug 23, 2026
Merged

iamtoruk merged 1 commit into
mainfrom
feat/1112-quota-providers

Conversation

@iamtoruk

Copy link
Copy Markdown
Member

Fixes #1112. Implementation drafted by OpenCode (big-pickle) against the spec on the issue; reviewed line-by-line and verified locally before this PR.

What

Extends the desktop app's live-quota module (previously claude/codex only) with three providers, all local-credential, no cookies, no logins:

  • Gemini — Code Assist loadCodeAssist/retrieveUserQuota using the Gemini CLI's own on-disk OAuth creds (prior art: CodexBar docs/gemini.md). Optional token refresh only when the CLI's documented env overrides are set; refreshed token stays in memory. Retired consumer tiers degrade to terminalFailure with migration guidance.
  • Copilot — copilot_internal/user with editor-plugin headers; token read-only from ~/.config/github-copilot/hosts.json→apps.json, one re-read on 401. Marked in-code as an internal API that may drift; all failures degrade to honest connection states.
  • Antigravity — loopback-only Connect-RPC probe of the local language server (RetrieveUserQuotaSummary → GetUserStatus fallback). Discovery via execFile ps/lsof with regex-validated pids; TLS relaxation scoped to 127.0.0.1 self-signed certs; no Google OAuth fallback (v1, per spec).

Plus: per-provider quota toggles in Settings (default on for detected providers; a disabled provider's fetcher never runs — no credential read, no request), the hardcoded Claude/Codex display names replaced with a provider map, ConnectAffordance rows with honest sign-in guidance, and sanitizeError extended for Google ya29. and GitHub gh*_ token shapes.

Kimi — audited, not duplicated

The 'Kimi 99% of quota used' surface is already live: the macOS menubar's KimiSubscriptionService.swift polls api.kimi.com/coding/v1/usages with the short-lived token from ~/.kimi-code/credentials. The electron app not surfacing Kimi is a pre-existing gap (shared by the menubar/electron split), documented on the issue — no duplicate fetcher added.

Security review (done on this PR)

  • All error paths route through sanitizeError; token shapes for both new vendors redacted; tested per provider
  • IPC disabled list filtered against the provider allowlist inside the service (untrusted-string boundary)
  • No shell interpolation (execFile with fixed argv), loopback-pinned host, no credential writes anywhere

Tests

app quota suite 89/89, full app suite 578/578, tsc clean (all re-run by the reviewer, not just claimed). No src/ CLI changes; payloads add-only; no new deps.

Follow-ups (issue notes)

  • Electron surfaces for Kimi live quota (close the menubar/app gap)
  • Menubar (Swift) parity for the three new providers — it runs its own services

Extends the existing borrowed-credential quota module (claude/codex) with
three providers, per-provider settings toggles, and a provider display map:

- gemini: Code Assist loadCodeAssist/retrieveUserQuota via the Gemini CLI's
  on-disk OAuth creds; optional env-gated token refresh; retired-tier
  responses degrade to terminalFailure with migration guidance
- copilot: copilot_internal/user with editor-plugin headers; token read-only
  from hosts.json/apps.json with one re-read on 401; marked as an internal
  API that may drift, failures degrade honestly
- antigravity: loopback-only Connect-RPC probe of the local language server
  (ps/lsof discovery via execFile, csrf token for the app variant, agy CLI
  accepted tokenless); TLS relaxation scoped to 127.0.0.1; no OAuth fallback
- settings: per-provider quota switches (default on) persisted renderer-side,
  honored in the main-process service so disabled fetchers never run; IPC
  disabled-list filtered against the provider allowlist
- sanitizeError extended for Google (ya29.) and GitHub (gh*_) token shapes

Kimi audited, not duplicated: the macOS menubar already fetches Kimi quota
live (KimiSubscriptionService.swift); the electron app not surfacing it is a
pre-existing gap, unchanged here.
@iamtoruk
iamtoruk merged commit c9dab7d into main Aug 23, 2026
9 checks passed
@iamtoruk
iamtoruk deleted the feat/1112-quota-providers branch August 23, 2026 11:29
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.

feat: live quota windows for Gemini, Copilot, Antigravity (local-credential, no cookies) + settings toggles everywhere

1 participant