Fix Antigravity agy cold-start quota readiness wait - #2665
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1d0703e0b9
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if AntigravitySelectedAccountGuard.matches( | ||
| snapshotAccountEmail: readySnapshot.accountEmail, | ||
| expectedAccountEmail: expectedAccountEmail) |
There was a problem hiding this comment.
Don't keep polling after a known account mismatch
When auto mode has a selected Antigravity account and the spawned agy session is already returning a different non-empty email, this matches failure is not a readiness condition that polling can fix. The loop now waits until the full 15s deadline before throwing accountMismatch and letting the pipeline fall through to OAuth, whereas before the ready snapshot was returned and the selected-account validation triggered fallback immediately. This makes every refresh stall for users whose local agy is signed into a different account than the selected OAuth account; only the missing-email case should keep waiting.
Useful? React with 👍 / 👎.
|
Codex review: needs changes before merge. Reviewed August 5, 2026, 9:56 PM ET / August 6, 2026, 01:56 UTC. ClawSweeper reviewWhat this changesThe PR extends Antigravity’s freshly started agy CLI quota wait from 5 to 15 seconds and retries incomplete account-identity snapshots. Merge readinessKeep this PR open for a narrow repair: its cold-start retry is useful, but a ready snapshot with a different non-empty account email now waits up to 15 seconds before the established OAuth fallback can run. Priority: P2 Review scores
Verification
How this fits togetherCodexBar’s Antigravity provider probes local app and agy CLI quota sources before OAuth fallback. The CLI path starts or reuses agy, waits for a parseable quota snapshot, then supplies usage and account identity to the provider pipeline. flowchart LR
A[Usage refresh] --> B[Antigravity provider]
B --> C[Start agy CLI session]
C --> D[Poll quota snapshot]
D --> E{Account identity state}
E -->|matching or unselected| F[Return CLI quota data]
E -->|missing identity| D
E -->|different identity| G[OAuth fallback]
F --> H[Usage display]
G --> H
Before merge
Findings
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Keep the longer cold-start window, but retry only snapshots with no account email and immediately return a ready snapshot with a different non-empty email to the existing fallback guard. Do we have a high-confidence way to reproduce the issue? Yes, from source: select one Antigravity account while agy returns a different non-empty email; the new loop treats it as unready and continues until its deadline. Is this the best way to solve the issue? No: the missing-email retry is appropriate for cold start, but a non-empty different email is a known account mismatch and should preserve the existing immediate fallback behavior. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 4cdb349cbc57. LabelsLabel justifications:
EvidenceAcceptance criteria:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles)
|
|
Landed. Verified before merge: the cold-start race is real (agy keyring auth ~3.6s vs the old 5s deadline → reliable fall-through to the degraded OAuth path from #2427); the new wait is strictly bounded (15s, spawn path only, poll sleep capped to remaining), warm-path latency untouched, and at deadline the retained error still routes to the next strategy. Known tradeoff: a genuine account mismatch on cold spawn now burns the full window before failing — acceptable since mid-init nil email is indistinguishable. Local: 98/98 across the CLI strategy/warm-reuse/session suites incl. the new not-ready polling test. CI green at merge. Thanks @Yuxin-Qiao! |
* Document Antigravity sources when the app is closed * docs: keep Antigravity experimental tag and reflect cold-start readiness wait (#2665) --------- Co-authored-by: Peter Steinberger <steipete@gmail.com>
Summary
agyCLI HTTPS session to become quota-ready. Live tests showed a newagyneeds ~3s for macOS keyring auth, then more time before quota endpoints answer; the 5s window reliably missed it.agyprocesses can answer quota endpoints before the signed-in userInfo email is available, and the selected-account guard would otherwise reject the cold-start snapshot.cli HTTPS keeps waiting while snapshot account is not ready yet.Reproduction environment
agy1.1.10 installed viabrew install --cask antigravity-cli(/opt/homebrew/bin/agy)language_serverprocess)7ace3d0b1; all reproduction commands were one-shot CLI fetches:swift run CodexBarCLI usage --provider antigravity --verboseBefore: cold start fails inside the 5s window
Fresh
agyspawn at T+0s. Every probe in the window returns transient init errors:agy's own log shows keyring auth completes only at ~T+3.6s:
Result: strategy chain falls through to OAuth, which returns only an all-100% availability row with no reset times (the known "availability-style fallback" payload).
After: cold start succeeds with full quota
Data returned ~3s after spawn, before the 15s deadline, straight from the
agyCLI HTTPS source (no OAuth fallback).Parity check: cli source == app source
Same machine, same account; JSON payloads from
--format jsoncompared programmatically:Only fetch-time-relative reset timestamps shift by the seconds between the two runs; all fixed-schedule values and all usage fractions are byte-identical.
Test
swift test --filter 'AntigravityCLIHTTPSFetchStrategyTests|AntigravityWarmAgyReuseTests|AntigravityCLISessionTests'- 98 tests passedmake check- 0 violations, 0 seriousCI
All checks green on this PR: swift-test-macos (2 shards), build-linux-cli (arm64/x64/musl), lint, lint-build-test, changes, GitGuardian Security Checks.