Skip to content

fix(antigravity): migrate OAuth and quota logic to match Rust Antigravity-Manager#3516

Open
v1vi4n wants to merge 7 commits into
router-for-me:devfrom
v1vi4n:main
Open

fix(antigravity): migrate OAuth and quota logic to match Rust Antigravity-Manager#3516
v1vi4n wants to merge 7 commits into
router-for-me:devfrom
v1vi4n:main

Conversation

@v1vi4n
Copy link
Copy Markdown

@v1vi4n v1vi4n commented May 22, 2026

See commit 1c3b1c8 for detailed description.

…vity-Manager

- Add openid scope, DailySandboxAPIEndpoint, TokenRefreshSkewSeconds
- Add RefreshAccessToken, resolveSubscriptionTier (paid→current→default)
- Add OnboardUser polling with DailyAPIEndpoint, ctx cancellation check
- Force HTTP/1.1 transport after proxy setup in NewAntigravityAuth
- Remove Accept header from loadCodeAssist calls (matches Rust exactly)
- Use oauthUserAgent (vscode/1.X.X) for OAuth/loadCodeAssist calls
- Add sandbox-first 3-tier API endpoint fallback
- Add hardcoded project_id fallback (bamboo-precept-lgxtn) in 3 layers:
  SDK login, management UI, and request-time PrepareRequestAuth
- Add fetchAntigravityQuota with fetchAvailableModels 3-tier fallback
- Add AntigravityModelQuota, AntigravityQuotaData data model
- Fix callback server port fallback and readiness check
- Add Rust-matching callback HTML success/error pages
- Update tests for new constants, RefreshAccessToken, quota model

Mirrors: Antigravity-Manager/src-tauri/src/modules/oauth.rs,
quota.rs, project_resolver.rs, token_manager.rs
@github-actions github-actions Bot changed the base branch from main to dev May 22, 2026 07:26
@github-actions
Copy link
Copy Markdown

This pull request targeted main.

The base branch has been automatically changed to dev.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request enhances the Antigravity authentication and executor logic by implementing subscription tier resolution, token refresh capabilities, and a robust multi-tier fallback mechanism for fetching model quotas. The changes also improve the SDK's callback server reliability and align the implementation with the Rust version. Feedback focuses on improving code maintainability by refactoring hardcoded project IDs and API endpoints into shared constants, deduplicating HTTP transport and User-Agent logic, handling ignored errors in JSON marshaling, and removing Byte Order Marks from source files.

Comment thread internal/auth/antigravity/auth.go Outdated
Comment thread internal/runtime/executor/antigravity_executor.go Outdated
Comment thread internal/auth/antigravity/constants.go
Comment thread internal/api/handlers/management/auth_files.go Outdated
Comment thread internal/runtime/executor/antigravity_executor.go Outdated
Comment thread sdk/auth/antigravity.go Outdated
Comment thread internal/runtime/executor/antigravity_executor.go Outdated
Comment thread internal/runtime/executor/antigravity_executor.go
Comment thread internal/auth/antigravity/auth.go
Comment thread internal/runtime/executor/antigravity_executor.go Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1c3b1c8157

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread internal/auth/antigravity/auth.go Outdated
Comment thread internal/runtime/executor/antigravity_executor.go Outdated
- Remove BOM from auth.go and antigravity_executor.go
- Extract FallbackProjectID constant to avoid hardcoded strings
- P1: resolveSubscriptionTier returns canonical tier IDs (remove (Restricted) suffix)
- P2: 403 quota response continues to next endpoint instead of short-circuiting
- Use antigravity package constants for quota endpoints
- Handle json.Marshal error in fetchAvailableModels payload
- Extract forceHTTP1Transport helper function
- Add public OAuthUserAgent() helper for shared User-Agent construction
- Update tests for removed Accept header and tier ID changes
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 581b215b6d

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread internal/runtime/executor/antigravity_executor.go Outdated
…it refresh

P2: updateAntigravityCreditsBalance now iterates over all fallback
endpoints (sandbox → daily → prod) instead of aborting on the first
non-2xx response. Removed unused antigravityLoadCodeAssistBaseURL.
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 367248dff7

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread internal/auth/antigravity/auth.go Outdated
Comment thread internal/runtime/executor/antigravity_executor.go Outdated
Comment thread internal/runtime/executor/antigravity_executor.go Outdated
rs2k1t added 2 commits May 23, 2026 01:12
PowerShell encoding corruption mangled em dashes and arrows in
comments during earlier edits. Restored to proper Unicode:
— (em dash) and → (right arrow).
…ence, fix 403 fallback

P1: resolveSubscriptionTier now prefers id over name at all 3 tier levels,
ensuring tier_id sent to onboardUser is a stable machine ID.

P1: antigravityBaseURLFallbackOrder reordered to daily -> prod -> sandbox
so sandbox-only permission denials do not break inference for accounts
that work on daily/prod.

P2: fetchAntigravityQuota 403 path now breaks to next endpoint instead of
returning, and unknown status codes also break instead of returning.
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2205beff22

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread internal/auth/antigravity/auth.go
… available

P1: Added lookupTierIDByName helper that matches currentTier/paidTier
names against allowedTiers (by id or name, case-insensitive). When
currentTier has only a name (e.g. Pro), it now resolves to the
machine id from allowedTiers (e.g. pro) instead of sending the
display label as tier_id to onboardUser.
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b4ff801fe4

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread internal/auth/antigravity/auth.go
P2: Move nil context normalization to the top of OnboardUser, before
the polling loop select on ctx.Done(). Previously a nil context would
panic because the nil guard happened after the cancellation check.
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.

1 participant