feat(antigravity): read plan usage limits over ACP #45176
Draft
patrick-toulme(GitHub profile, opens in a new tab)wants to merge 1 commit into
main fromrefs/pull/45176/head·opened View on GitHubProblem#
#43026 removed direct HTTP reads of Antigravity usage limits so T3 Code does not read saved Google credentials or call Google APIs directly, noting that limits could return once agy acp exposes them over ACP (google-antigravity/antigravity-cli#1968).
Change#
- Detect
agentCapabilities._meta.antigravity.quota === trueon ACPinitialize, and preservecapabilities._metawhen normalizing v2initializeresponses ineffect-acp. - Call
_antigravity/quota({ refresh?: boolean }) over ACP and map returned groups and buckets intoServerProviderUsageLimitsacross 5-hour session and weekly windows for both personal Google account (oauth-personal) and Gemini Enterprise (oauth-business) sign-ins. Non-subscription sign-in methods (gemini-api-key,agent-platform) reportunsupportedwithout spawning a probe. - Refresh limits on sign-in,
refreshModels, session start, every 60 seconds during active prompts, after each turn, and onrefreshUsage(reusing an active ACP session when one is open, or running a sessionlessinitializeand_antigravity/quotacall without creating conversation files). - Retain previously published limits on transient failures, clear limits and cancel pending reads across sign-out, account switch, runtime downgrade, or ACP
-32000(auth_required), and cache runtimes that do not advertise_meta.antigravity.quotaso currentagyreleases remain no-ops without repeated spawns. - Scope
exhaustedUsageWindowto the matching Antigravity model pool (including dedicated subfamily buckets and shared Claude and GPT pools) and order Antigravity windows consistently indisplayLimitWindows. - Update
docs/user/providers-antigravity.md.
Current agy releases do not advertise agentCapabilities._meta.antigravity.quota yet, so behavior is unchanged until the corresponding agy acp release ships.
Scope#
Keeping in draft while _antigravity/quota ships in agy acp (google-antigravity/antigravity-cli#1968), following #43026.
Verification#
vp test run apps/server/src/provider/acp/AntigravityQuota.test.ts: checked capability detection, 5-hour and weekly window mapping, untouched full-window reset suppression, explicit zero and sub-1% remaining fractions, disabled and non-fractional buckets,supported: false, and ACP-32000,-32601, and timeout handling.vp test run apps/server/src/provider/AntigravityProvider.test.ts apps/server/src/provider/Drivers/AntigravityDriver.test.ts: checked that runtimes without_meta.antigravity.quotanever receive_antigravity/quotaand are not respawned on repeatedrefreshUsagecalls, sessionlessrefreshUsagepublishes windows without callingsession/new, live sessions refresh at start and after turns and share their open runtime withrefreshUsage, transient probe errors keep existing limits, sign-out and account switches and ACP-32000cancel pending reads and clear limits, and API key sign-in reportsunsupported.vp test run packages/shared/src/usageLimits.test.ts apps/server/src/provider/ProviderRegistry.test.ts packages/effect-acp/src/client.test.ts: checked per-family and dedicated subfamily exhaustion checks, window display ordering, provider registry retention, and ACP client initialization.- Verified
AntigravityDriverend to end against anagy acpbuild supporting_antigravity/quotaacross signed-out-32000, personal Google OAuth, Gemini Enterprise,refreshModels, offline failure retention, revoked-token-32000, and API key sign-in, confirming sessionlessrefreshUsagecreates no conversation files on disk. vp run check:changed: format, lint, knip, graphql, typecheck across all 39 packages, and tests pass.
- 1
tanstack-source added labelsfeature
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XL
Sign in to join this conversation.