Repository navigation
feat: live quota for Gemini, Copilot, Antigravity + per-provider toggles - #1114
Merged
Merged
Conversation
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.
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.
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:
loadCodeAssist/retrieveUserQuotausing 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 toterminalFailurewith migration guidance.copilot_internal/userwith 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.RetrieveUserQuotaSummary→GetUserStatusfallback). Discovery viaexecFileps/lsofwith 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
sanitizeErrorextended for Googleya29.and GitHubgh*_token shapes.Kimi — audited, not duplicated
The 'Kimi 99% of quota used' surface is already live: the macOS menubar's
KimiSubscriptionService.swiftpollsapi.kimi.com/coding/v1/usageswith 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)
sanitizeError; token shapes for both new vendors redacted; tested per providerdisabledlist filtered against the provider allowlist inside the service (untrusted-string boundary)Tests
appquota suite 89/89, full app suite 578/578, tsc clean (all re-run by the reviewer, not just claimed). Nosrc/CLI changes; payloads add-only; no new deps.Follow-ups (issue notes)