fix(antigravity): migrate OAuth and quota logic to match Rust Antigravity-Manager#3516
fix(antigravity): migrate OAuth and quota logic to match Rust Antigravity-Manager#3516v1vi4n wants to merge 7 commits into
Conversation
…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
|
This pull request targeted The base branch has been automatically changed to |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
💡 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".
- 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
There was a problem hiding this comment.
💡 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".
…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.
There was a problem hiding this comment.
💡 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".
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.
There was a problem hiding this comment.
💡 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".
… 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.
There was a problem hiding this comment.
💡 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".
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.
See commit 1c3b1c8 for detailed description.