Skip to content

fix(google-antigravity): discoverAntigravityProject fails with missing_project when project is not auto-discovered, rejecting valid tokens #7382

Open

Description

@yobushka

Client or integration

  • OpenCodex dashboard
  • Direct HTTP/API client

Area

  • Authentication and account pool
  • Provider adapter

Version

2.83.0 (commit 33b321853aff76045617824793cc7cbc1d4084e7)

Operating system

Linux (Ubuntu 26.04 LTS / Docker)

Provider and model

google-antigravity

Summary

During Google Antigravity OAuth or account import (createAntigravityAccountImportAdapter), OpenCodex mandates discovery of a Cloud Code Assist projectId via discoverAntigravityProject:

const projectId = await discoverAntigravityProject(creds.access, this.ctrl.signal);
if (!projectId) {
  throw new Error("Antigravity login could not discover a Cloud Code Assist project for this account. Ensure the account has Antigravity/Cloud Code Assist access and try again.");
}

In src/oauth/account-import/google-antigravity-adapter.ts:

if (typeof credential.projectId !== "string" || credential.projectId.length === 0) {
  return { status: "failed", code: "missing_project" };
}

If Google's loadCodeAssist or onboardUser endpoints do not return a project identifier matching the parser's specific expectations (e.g. accounts with existing consumer tiers or established aicode-consumers project mapping), discoverAntigravityProject returns undefined.

As a result, OpenCodex rejects the entire authentication attempt (code: missing_project) and discards the valid refresh token, even though the token works properly when configured with the standard Antigravity project (aicode-consumers).

Reproduction

  1. Attempt an OAuth login or cockpit import (POST /api/oauth/accounts/import) for a Google account whose loadCodeAssist API response does not populate cloudaicompanionProject or matches consumer project configurations.
  2. The authorization exchange succeeds and issues valid access_token and refresh_token.
  3. discoverAntigravityProject runs loadCodeAssist -> fails/returns no recognized key, then runs onboardUser -> returns undefined.
  4. The import/login fails with missing_project / credential_rejected.
  5. If the same refresh token is persisted in auth.json with "projectId": "aicode-consumers", requests to /v1/chat/completions (e.g. gemini-3.8-flash) succeed with HTTP 200.

Expected behaviour

  1. discoverAntigravityProject should fall back to a standard default project ID (such as aicode-consumers) if discovery endpoints do not return an explicit enterprise project.
  2. The account import payload (CockpitAccountRecord) and manual OAuth parameters should allow an optional project_id override so accounts are not rejected outright when discovery fails.
  3. A failed discovery should not discard otherwise valid OAuth credentials.

Checks

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

Activity

  1. github-actions commented on Oct 19, 2026

    @github-actions
    Contributor

    Automated translation bookkeeping — detected language: English.

  2. added
    bug
    account-pool
    on Oct 19, 2026
  3. Ingwannu commented on Oct 19, 2026

    @Ingwannu
    Owner

    Current dev 79fa97b still requires a discovered project for this login/import contract. The parser already accepts cloudaicompanionProject, projectId or project as a string or an object with id, and loadCodeAssist falls back to onboardUser. That establishes the failure path, but not which unhandled response shape produced your missing_project result.

    Please provide only redacted response structure/status for loadCodeAssist and onboarding/polling: HTTP status, key names, value types, done/error presence and where an account-bound project appears; replace every project/account value with a placeholder and omit tokens, headers and account dumps. Also separate provider errors, an unfinished operation and a successful response without a project. That is enough for a deterministic parser regression without using another real account.

    I will not hardcode a shared aicode-consumers project from one reported success or silently persist a partially admitted account: default-project admission, an explicit validated override and pending-credential retention are separate auth/product decisions. A verified missing parser shape can be fixed narrowly within the existing discovery owner. Leaving this open pending the structural evidence/owner decision; no import, token write, onboarding or model call was executed.

  4. lidge-jun commented on Oct 28, 2026

    @lidge-jun
    Owner

    Current dev@fdc6dd82d has advanced beyond the original import example. Discovery accepts three project keys as strings or objects with an id and uses onboarding when necessary (src/oauth/google-antigravity.ts:91-101,137-180). Login still requires a discovered project (google-antigravity.ts:251-257). Import now accepts an operator-supplied fallback only after an account-bound quota probe; automatic discovery wins and a missing/unverified project still blocks persistence (src/oauth/account-import/google-antigravity-adapter.ts:25-36,77-101). Re-proposing an unchecked override would lose that admission contract.

    Three options remain: wait for the already requested redacted shape and then fix an evidenced parser omission; add a safe discovery-outcome diagnostic now; or admit a default/pending project without discovery. The parser fix is smallest once a concrete missing shape exists. Diagnostics can distinguish failure classes without asserting what the reporter received. Default/pending admission changes authentication policy and is not justified by the report.

    I recommend diagnostics while preserving the existing project requirement and the maintainer’s evidence request. The current load path collapses non-success HTTP, unusable JSON and invalid root shapes to absence; onboarding can also finish without a recognized project or exhaust its polling budget (google-antigravity.ts:112-115,151-164). A diagnostic should distinguish those outcomes instead of claiming that every absence is a parser defect.

    A minimal proposed result is stage, numeric HTTP status, root category, done/error presence and allowlisted project-field value types. Restrict field names to the parser’s known keys and fixed containers; arbitrary upstream keys can themselves contain private values. Never emit tokens, headers, project/account identifiers, operation names, raw errors, raw bodies or credential dumps. Preserve abort propagation and existing request/poll budgets. Unknown shapes stay unknown, with no generic deep traversal to discover a plausible project.

    The smallest slice is a pure src/oauth/antigravity-discovery-diagnostics.ts called from src/oauth/google-antigravity.ts, adding only a bounded sanitized summary to failed-login diagnostics. Leave the existing import result codes and fallback admission unchanged. A proposed tests/adapters/google/google-antigravity-discovery-diagnostics.test.ts should cover HTTP refusal, malformed JSON, pending operation, done-with-error, done-without-project, accepted shapes and cancellation. Inject secret sentinels in values and arbitrary key names and assert none appear in summaries; prove missing-project login still cannot persist an account. Parser expansion remains blocked on structural evidence, not on running another real account.

  5. lidge-jun commented on Oct 30, 2026

    @lidge-jun
    Owner

    Status check against current dev (3ea8965).

    PR #7888, merged as 6c49278, landed the diagnostics slice proposed above: a sanitized summary of each discovery stage (stage, HTTP status, root category, done/error presence, and value types of the three allowlisted project fields at the root and the fixed response container), recorded for both loadCodeAssist and onboarding (src/oauth/antigravity-discovery-diagnostics.ts, src/oauth/google-antigravity.ts). Its tests cover HTTP refusal, malformed JSON, a pending operation, done-with-error, done-without-project, the accepted field shapes, cancellation, secret sentinels, and that a failed login still persists nothing. Login still requires a discovered project, and import accepts an explicit fallback project only after an account-bound verification probe.

    What remains is the reporter-specific failure. Please run the login or import again on a build that includes #7888 and share only the sanitized discovery diagnostic it prints (or the redacted response structure and status), with every project and account value replaced and no tokens, headers, raw bodies or account details. A concrete unrecognized shape can then get a narrow parser fix with a regression test. Admitting a default project without discovery remains a separate policy decision and is not planned from this report.

    Keeping this open for that evidence.

  6. lidge-jun commented on Nov 15, 2026

    @lidge-jun
    Owner

    A build with #7888 prints a sanitized discovery diagnostic (stage, status, field value types) when project discovery fails. Could you run it against the failing account and post that line?

  7. added
    needs-info
    on Nov 15, 2026
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-poolbugneeds-info

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions