Skip to content

feat(auth): add Google Antigravity browser OAuth - #70

Open
yan-ad wants to merge 1 commit into
Blankeos:mainfrom
yan-ad:feat/gemini-browser-auth
Open

yan-ad wants to merge 1 commit into
Blankeos:mainfrom
yan-ad:feat/gemini-browser-auth

Conversation

@yan-ad

@yan-ad yan-ad commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add Google Antigravity browser OAuth under /connect, using a generated Google authorization URL followed by a pasted full localhost callback URL.
  • Show open/copy-link controls, callback input, inline validation errors, submission state, and explicit cancellation. Keep the API-key option available and retain internal provider ID google for config/credential compatibility.
  • Validate callback origin/path/state, use PKCE, exchange and persist credentials, discover/onboard a managed project, and refresh credentials before outbound generations (including subagents).
  • Add the Antigravity Gemini transport with streaming text/reasoning/tool calls, image inputs, usage/finish handling, bounded stream reads, cancellation, and persisted thought-signature replay across tool loops and later turns.
  • Rename provider display labels to Google Antigravity, including old cached catalog/snapshot views, and expose OAuth-compatible Gemini model IDs using existing catalog metadata.
  • Add terminal ACP login support and document the flow and unofficial-service/account-eligibility caveat.

OAuth client configuration

No Google OAuth client ID or secret is bundled, persisted in config, or compiled into the binary. Set CRABCODE_ANTIGRAVITY_CLIENT_ID and CRABCODE_ANTIGRAVITY_CLIENT_SECRET in the runtime environment. The OAuth client must be authorized for the requested Google scopes/service and use http://localhost:51121/oauth-callback as its redirect URI. An arbitrary new Google Cloud OAuth client does not guarantee Antigravity access. Existing refresh tokens remain bound to their original client.

Missing/invalid settings fail with setup instructions without echoing values. Unit tests inject fake clients and do not mutate global environment variables.

Validation

  • 1,896 unit tests and 7 ACP integration tests passed (3 pre-existing ignored tests).

  • cargo test --offline -- --test-threads=1

  • cargo build --offline --bin crabcode

  • cargo fmt --all -- --check

  • bash scripts/check-aisdk-boundary.sh

  • git diff --check

OAuth, refresh, project onboarding, HTTP/SSE, signed-history, dialog, and cancellation tests use local fixtures; no Google token exchange or account authorization was performed during development. Live Google/Antigravity account eligibility and service availability still require a manual smoke test.

Two existing test fixtures were made environment-independent while running the suite: the edit-rendering fixture now uses the current checkout path, and the ACP stdio fixture explicitly avoids live Ollama discovery.

Manual smoke test

  1. Run /connect → Google Antigravity → Gemini via Antigravity (browser).
  2. Open/copy the generated authorization link and authorize an eligible Google account.
  3. Copy the full http://localhost:51121/oauth-callback?... URL from the address bar even if the localhost page cannot load.
  4. Paste into the callback input and submit; confirm Gemini models are selectable and a text/tool turn works.
  5. Confirm invalid state is rejected inline and Esc cancels without saving credentials.

This integration uses an unofficial Antigravity transport; Google account eligibility, service terms, and restrictions apply.

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