Skip to content

fix(antigravity): read plan limits with Antigravity User-Agent and fix usage refresh races - #1086

Merged
badcuban merged 1 commit into
mainfrom
fix/antigravity-usage
Nov 24, 2026
Merged

badcuban merged 1 commit into
mainfrom
fix/antigravity-usage

Conversation

@badcuban

Copy link
Copy Markdown
Collaborator

Antigravity plan limits stayed stuck on "Usage unavailable" after signing in because Cloud Code quota requests sent a Threadlines User-Agent and logged nothing when Google rejected them. Even when a read succeeded, several races could drop or delay the result: model discovery overwrote out-of-band usage on the snapshot, reads that landed while the snapshot was pending were discarded, null optional fields in the token file failed decoding, and CLI token renewals waited up to 5 minutes for the next periodic probe.

Fixes

  • Send Antigravity's Cloud Code client User-Agent (antigravity/hub/2.24.0 (aidev_client; os_type=...; arch=...; cl=963137146)) on quota requests while keeping Threadlines/<version> on Google userinfo.
  • Log safe warnings (host, operation, and fixed failure reason; never tokens, headers, emails, or bodies) when quota calls fail, return malformed 200 payloads, or when the token file cannot be read or decoded.
  • Accept null for optional token file fields (refresh_token, expiry, id_token_email) and treat 200 summary responses with neither groups nor buckets as failed reads so last good rows are kept.
  • Track the access-token hash so a CLI token renewal on disk immediately bypasses the 2-minute throttle and cancels any stale in-flight read.
  • Patch only models and versionAdvisory during ACP model enrichment so out-of-band accountUsage is preserved, and reconcile any landed background usage read when a probe snapshot commits.
  • Trigger a usage refresh when Antigravity sessions open, model discovery runs, prompts settle, and when clicking Refresh on the Usage page.

Verification

  • vp fmt, vp lint, and vp run typecheck (all 14 packages)
  • Server unit tests: AntigravityUsage, AcpProviderDriver, AntigravityAcpSupport, AntigravityTurns, CursorAcpSupport
  • Web browser tests: UsageView
  • Not verified live against Google's Cloud Code API from this checkout; needs a check on a signed-in machine.

…x usage refresh races

Antigravity plan limits stayed stuck on "Usage unavailable" after signing in because Cloud Code quota requests sent a Threadlines User-Agent and logged nothing when Google rejected them. Even when a read succeeded, several races could drop or delay the result: model discovery overwrote out-of-band usage on the snapshot, reads that landed while the snapshot was pending were discarded, null optional fields in the token file failed decoding, and CLI token renewals waited up to 5 minutes for the next periodic probe.

- Send Antigravity's Cloud Code client User-Agent on quota requests (keeping Threadlines/<version> on Google userinfo) and log safe host, operation, and reason warnings on failures, malformed 200 payloads, or unreadable token files.
- Accept null values for optional token file fields (`refresh_token`, `expiry`, `id_token_email`) and treat malformed 200 summary bodies as failed reads so last good rows are kept.
- Track the access-token hash so a renewed token on disk immediately bypasses the 2-minute throttle and cancels any stale in-flight read.
- Patch only `models` and `versionAdvisory` during ACP model enrichment and reconcile any background usage read that landed while the snapshot was pending or across an account switch.
- Trigger a usage refresh after Antigravity sessions open, model discovery runs, prompts settle, and when clicking Refresh on the Usage page.
@vercel

vercel Bot commented Nov 24, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
threadlines Skipped Skipped Nov 24, 2026 6:43am UTC

Request Review

@badcuban
badcuban added this pull request to the merge queue Nov 24, 2026
Merged via the queue into main with commit 87b31e1 Nov 24, 2026
25 checks passed
@badcuban
badcuban deleted the fix/antigravity-usage branch November 24, 2026 06:57

This branch was previously deployed

1 inactive deployment
Preview — 4f8865ed Deployed Nov 24, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant