Skip to content

fix(server): prefer current Antigravity sign-in for usage limits - #40834

Closed
iomarsuleiman wants to merge 1 commit into
pingdotgg:mainfrom
iomarsuleiman:fix/antigravity-current-signin
Closed

iomarsuleiman wants to merge 1 commit into
pingdotgg:mainfrom
iomarsuleiman:fix/antigravity-current-signin

Conversation

@iomarsuleiman

Copy link
Copy Markdown

Problem

Antigravity Usage → Limits can remain at 100% and omit the five-hour and Argon windows when a profile contains both antigravity-oauth-token and a leftover acp_token.json. The probe currently chooses the legacy credential and project before checking the active CLI sign-in.

Reproduced on Windows x64 with T3 Desktop 0.1.12-nightly.20261120.4994, managed Antigravity 1.5.13, and Google AI Pro.

Change

Prefer the profile's native CLI token whenever that file exists. Keep the existing legacy-only path for older profiles. An expired native token reports the existing failure instead of silently falling back to a different legacy sign-in.

Scope

Related: #34381, #40348, #40015. This overlaps #39544; this smaller alternative preserves legacy-only compatibility rather than removing the legacy probe path.

Verification

  • Live requests with the legacy credential returned only gemini-weekly and 3p-weekly, both at 100% remaining.
  • Requests with the current CLI credential returned all five windows, including about 62% Gemini weekly and 47% shared Claude/GPT weekly remaining.
  • After reversibly backing up the legacy file, the installed app displayed the five-hour windows, current percentages, reset times, and separate Argon quota. The patched source probe also returned all five windows.
  • Extended the existing tests for native-token precedence with and without a legacy file, and for an expired native file alongside a legacy token. Both regression cases failed before the source change. After the fix: 20 passed, 1 skipped in antigravityUsageLimits.test.ts.
  • Formatting, lint, and focused Effect TypeScript checking passed. The type checker emitted an existing schema-brand suggestion on an unchanged class.
  • The broader check:changed run has passed formatting and lint; its remaining steps have not completed locally.

Produced by GPT-6.1 Sol in Codex.

Use the native CLI token when it coexists with a legacy acp_token.json, so stale credentials and their project do not hide current quota windows. Preserve the legacy-only path and cover credential precedence and expired native tokens.

Produced by GPT-6.1 Sol in Codex.
@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Nov 22, 2026
@coderabbitai

coderabbitai Bot commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The Antigravity usage probe now checks for a native CLI token before selecting legacy ACP credentials. Tests cover CLI sign-in with and without a legacy token file, and verify that an expired CLI token fails without making requests.

Changes: Antigravity credential selection

Layer / File(s) Summary
Credential selection and probe tests
apps/server/src/provider/antigravityUsageLimits.ts, apps/server/src/provider/antigravityUsageLimits.test.ts
The probe selects the native CLI-token/keyring path when the CLI token file exists or the ACP token file is absent. Tests cover both legacy-token-file states, confirm no token-refresh request for CLI sign-in, and verify that an expired CLI token returns probeFailed without requests.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Possibly related issues

  • Issue 34381: The probe now prefers the native CLI token when present, addressing the reported stale-ACP-token precedence in that case. The legacy ACP path remains when no native CLI token file exists.

Possibly related PRs

Suggested labels: bugfix

Suggested reviewers: juliusmarminge, macroscopeapp

Merge Risk: Minimal · up to b1e13

The change makes Antigravity usage limits use the current CLI sign-in when both credentials exist. It looks narrowly scoped and tested, and no merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "fix(server): prefer current Antigravity sign-in for usage limits" matches the main change: the usage-limits probe now prefers the native CLI token (antigravity-oauth-token) over a leftover …
Description check Passed The description follows the template's main sections: Problem, Change, Scope, and Verification. The Problem section explains the bug and reproduction environment. The Change section explains the prece…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "fix(server): prefer current Antigravity sign-in for usage limits" matches the main change: the usage-limits probe now prefers the native CLI token (antigravity-oauth-token) over a leftover legacy acp_token.json. It is a conventional commit title, specific, and concise.

Full details: Description check

Explanation

The description follows the template's main sections: Problem, Change, Scope, and Verification. The Problem section explains the bug and reproduction environment. The Change section explains the precedence fix and the expired-token behavior. The Scope section links related issues and notes overlap with #39544. The Verification section gives concrete test results and live checks, and it states that the broader check:changed run did not finish. The Scope section cites related issues but does not explicitly say why a bug-fix issue is the basis, which is a minor gap. The description also ends with a model attribution line, which the template requests.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 91d2d90 and b1e13a7.

Files selected for processing: 2

  • apps/server/src/provider/antigravityUsageLimits.test.ts
  • apps/server/src/provider/antigravityUsageLimits.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@juliusmarminge

Copy link
Copy Markdown
Member

Thanks for this. #39544 makes the same change and is the one being kept.

#39544 fixes the same stale-credential problem and also handles a current sign-in stored in the keyring when no native token file exists. This change still lets the leftover legacy file override that sign-in.

The legacy compatibility path preserves credentials from runtimes that current T3 Code already refuses. Your Windows reproduction and live quota comparison would be useful evidence for finishing the existing fix.

Closing as a duplicate.

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

Labels

size:XS 0-9 changed lines (additions + deletions). vouch:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants