Skip to content

fix(oauth): add google-antigravity to OAuth 401 replay and force-refresh providers #3575

Description

@agentHits

Client or integration

Direct HTTP/API client

Area

Authentication and account pool

Summary

When Google Antigravity OAuth session tokens expire, desynchronize, or are invalidated upstream by Google, incoming requests to OpenCodeX fail immediately with 401 instead of being refreshed and replayed transparently.

While other OAuth providers (xai, github-copilot, kiro) participate in automatic upstream 401 recovery (isOAuth401ReplayProvider and FORCE_REFRESH_PROVIDERS), google-antigravity is missing from both sets. Consequently, any 401 from upstream terminates the request immediately and leaves the stale token in ~/.opencodex/auth.json until a manual command or request triggers a refresh.

Reproduction

  1. Configure google-antigravity as an OAuth provider in OpenCodeX (ocx login google-antigravity).
  2. Allow the session token to expire, rotate in another environment, or become invalidated upstream.
  3. Send a request to /v1/chat/completions or /v1/responses for model google-antigravity/gemini-3.8-flash.
  4. Upstream Google API returns 401 UNAUTHENTICATED (Request had invalid authentication credentials).
  5. OpenCodeX aborts immediately and forwards the 401 error to the caller, without attempting to refresh the token or replay the request.

Expected behavior: OpenCodeX should catch the upstream 401, execute forceRefreshOAuthAccessSnapshot (refreshing credentials and re-discovering the Cloud Code Assist project), and replay the request to completion.

Version

dev / 2.36.1+

Operating system

macOS 15.5 / Linux / Windows

Provider and model

google-antigravity / gemini-3.8-flash

Logs or error output

[opencodex] HTTP 401 Unauthorized from daily-cloudcode-pa.googleapis.com
authentication_error: Request had invalid authentication credentials.

Redacted configuration

{
  "defaultProvider": "google-antigravity",
  "providers": {
    "google-antigravity": {
      "adapter": "google",
      "baseUrl": "https://daily-cloudcode-pa.googleapis.com",
      "authMode": "oauth",
      "googleMode": "cloud-code-assist",
      "models": ["gemini-3.8-flash"]
    }
  }
}

Checks

  • I searched existing issues and documentation.
  • I removed secrets, tokens, account details, request credentials, and personal data.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    account-poolOAuth, credentials, Codex pool, quota, failover, plansbugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions