Skip to content

fix(antigravity): discover ~/.gemini/bin/agy.exe for OAuth refresh and keep merged Gemini pool - #240

Merged
CodeZeno merged 1 commit into
CodeZeno:mainfrom
CharlyMatzu:fix/antigravity-oauth-refresh-and-gemini-pool
Nov 28, 2026
Merged

CodeZeno merged 1 commit into
CodeZeno:mainfrom
CharlyMatzu:fix/antigravity-oauth-refresh-and-gemini-pool

Conversation

@CharlyMatzu

Copy link
Copy Markdown
Contributor

Problem

  1. Antigravity OAuth token refresh fails with AuthRequired when agy.exe is installed under ~/.gemini/bin:
    installed_oauth_clients() only checked %LOCALAPPDATA%\Programs\Antigravity\resources\bin\language_server.exe, %LOCALAPPDATA%\agy\bin\agy.exe, and %ProgramFiles%\Antigravity\resources\bin\language_server.exe. On Windows installations where the Antigravity CLI lives at %USERPROFILE%\.gemini\bin\agy.exe (and the IDE at %LOCALAPPDATA%\Programs\Antigravity IDE), installed_oauth_clients() returned an empty list as soon as the cached access_token expired, causing immediate AuthRequired failures (! in the widget).
    Additionally, scanning the ~245 MB agy.exe binary from disk on every poll cycle is unnecessary once valid client metadata has been discovered.

  2. Merged Gemini pool dropped when its description mentions Argon (see Antigravity Gemini shows "--" in taskbar since the 21 Nov build (no limit is_active, top-level session/weekly unavailable) #231):
    When retrieveUserQuotaSummary reports a single "Gemini Models" group with generic gemini-* bucket IDs (gemini-5h, gemini-weekly) whose description mentions Argon, is_antigravity_separate_gemini_group() skips it unconditionally, leaving the top-level Gemini pool unavailable (--).

Changes

  • src/poller/antigravity.rs:
    • Extracted oauth_client_candidate_paths() and added %USERPROFILE%\.gemini\bin\agy.exe (resolved via known_folders::home_dir() with USERPROFILE fallback) and %LOCALAPPDATA%\Programs\Antigravity IDE\resources\bin\language_server.exe.
    • Cached discovered OAuth client pairings in memory (CACHED_OAUTH_CLIENTS) after the first successful scan so subsequent refreshes avoid re-reading agy.exe from disk (empty results are not cached so newly installed clients are still picked up).
    • Logged a specific diagnostic message when no installed OAuth client is found (Antigravity OAuth refresh failed: no installed OAuth client found).
    • Preserved a fallback for the main Gemini pool (has_generic_gemini_buckets()) when a group flagged by is_antigravity_separate_gemini_group() uses generic gemini-* bucket IDs (without "argon") and no other Gemini group answered, while keeping dedicated Argon pools (gemini-4-argon-*) isolated.
    • Added unit test oauth_client_candidate_paths_include_user_gemini_agy_binary.
  • src/poller/tests.rs:
    • Added unit test antigravity_merged_gemini_pool_that_mentions_argon_still_shows.

Verification

  • cargo fmt --all -- --check — passed
  • cargo clippy --all-targets -- -D warnings — passed (0 warnings)
  • cargo test — 670 passed, 0 failed (6 ignored)
  • cargo build --release — succeeded
  • Verified live on Windows 11 with Antigravity (~/.gemini/bin/agy.exe): OAuth refresh returns 200, loadCodeAssist and retrieveUserQuotaSummary succeed, and the taskbar widget displays both 5h and 7d Antigravity quotas.

…d keep merged Gemini pool

- Include %USERPROFILE%\.gemini\bin\agy.exe (via Windows Known Folders) and
  %LOCALAPPDATA%\Programs\Antigravity IDE\resources\bin\language_server.exe
  in installed_oauth_clients(), fixing AuthRequired failures when refreshing
  expired Antigravity OAuth tokens on installations where agy.exe lives under
  ~/.gemini/bin instead of %LOCALAPPDATA%\agy\bin.
- Cache discovered OAuth client pairings in memory after the first successful
  scan to avoid re-reading the ~245 MB agy.exe binary on every poll cycle, and
  log a specific diagnostic message when no installed OAuth client is found.
- Retain the merged "Gemini Models" group as a fallback for the main Gemini
  pool when its description mentions Argon but its buckets use generic
  gemini-* IDs (gemini-5h / gemini-weekly), matching issue CodeZeno#231.
- Add unit tests covering the new OAuth client candidate paths and the merged
  Gemini pool summary.
@CodeZeno
CodeZeno merged commit 33a36be into CodeZeno:main Nov 28, 2026
1 check passed
CodeZeno added a commit that referenced this pull request Nov 28, 2026
…live quota summary

The OAuth client cache from #240 never expired, so after an Antigravity
update that changed the sign-in client, token refresh kept failing until
the app restarted. Key the cache on the binary's path, size and
modification time: an unchanged install is not read again, an updated or
removed one is rescanned.

Add a regression test from the retrieveUserQuotaSummary groups reported
on #231 and #233, and update the Antigravity provider fixture to the
current response shape (one Gemini group whose description lists Argon,
plus the Claude and GPT group).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

2 participants