Repository navigation
fix(rate-limits): cool down usage reads that open agy's browser sign-in - #33297
Merged
Merged
Conversation
Contributor
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 2 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…sage poll A signed-out agy -p /usage starts interactive OAuth and opens a browser sign-in page. Orca killed it at 30s, called it a slow CLI (status error), and retried on every poll and window focus, so the page kept reopening. Classify a timed-out read whose stderr is agy's sign-in prompt as signed out, and generalize Claude's skip-automated-fetch gate so automated cycles skip Antigravity while it is signed out. A user-directed refresh still rechecks. Fixes #26484
nwparker
force-pushed
the
nwparker/agint-antigravity-usage-signin-popup
branch
from
October 24, 2026 23:29
04114ae to
882f36a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary (ELI5)
If you have the Antigravity CLI (
agy) installed but aren't signed in, Orca's usage meter kept opening a "Continue to Google Antigravity" sign-in page in your browser. It happened again on every usage refresh. Now, when a quota read reaches agy's browser sign-in, Orca waits an hour before checking again on its own. It shows "Sign in withagy; Orca checks again within an hour, or when you refresh" until then, and recovers on the next poll after the hour.Root cause
agy -p /usage --output-format json --print-timeout 20s(src/main/rate-limits/antigravity-usage-command.ts).printmode.go:403 not authenticated, trying silent auth→printmode.go:409 silent auth failed→printmode.go:426 triggering interactive OAuth→browser.go:56 consumerOAuth: starting OAuth flow. It then calls the OS opener (open <accounts.google.com/o/oauth2/auth?...>on macOS; the agy changelog saysrundll32on Windows), printsAuthentication required. Please visit the URL to log in:andWaiting for authentication (timeout 60s)..., and blocks.authentication required. Run 'agy' to log inand opens nothing. That case is unchanged by this PR.timedOutfirst, so it reportedstatus: 'error'/ "did not answer in time". Errors are retried on window activation and on every poll, and each retry opened the browser again.What changed
Authentication required. Please visit the URLoraccounts.google.com/o/oauth2) now returnsunavailable/missing-credentialswithretryAtMs = now + 1h. Fast-exit sign-outs carry noretryAtMs, so they keep polling exactly as on main.shouldSkipAutomatedClaudeFetchtoshouldSkipAutomatedFetch(provider, limits). It is(claude || antigravity) && isRetryAfterActive(limits), so Claude's behavior does not change. The gate is used in the activation refresh plan, the Claude-only cycle and the full cycle. During the cooldown a skipped Antigravity read keeps its previous snapshot and is never marked "fetching". Forced (user-directed) refreshes bypass it, the same way they bypass Claude's Retry-After. When the hour is up, the next automated poll rechecks.Verification
Real
agy1.4.2 against an isolated signed-out HOME, undersandbox-exec./usr/bin/securitywas denied so the real keychain could not be read, and/usr/bin/openplus LaunchServices were denied. A PATH stub logged eachopen <url>call instead of launching a browser. I wired the realfetchAntigravityRateLimitsintoRateLimitServiceand drove automated (non-forced) cycles.With a controlling TTY (the case that opens the browser):
error"did not answer in time"unavailable, cooldown setok, recovered (2 reads / 1 open)Without a TTY (agy fails fast and opens nothing), this branch polls on every cycle with no cooldown, the same as main: 3 cycles, 3 reads, 0 opens.
These were temporary harnesses and are not checked in. The regression tests that are checked in:
antigravity-usage-fetcher.test.ts: the OAuth-prompt timeout gets a 1hretryAtMs; a fast-exit sign-out gets none.service-antigravity-usage.test.ts: focus events and polls inside the cooldown do not call agy; the first poll after it does, and recovers took.I also ran
pnpm tc:node, targeted rate-limit tests, andpnpm run check:code-quality:changed.Risk
Fixes #26484