Skip to content

Commit eb3132e

Browse files
committed
fix(antigravity): drop synthetic x-goog-api-client header on onboarding
- Remove synthetic x-goog-api-client header from Antigravity onboardUser requests. - Decompilation of Antigravity IDE 2.5.5 (language_server_macos_arm) confirmed x-goog-api-client is never sent on the wire (0 ADRP hits across all SetHTTPHeaders variants). - Pass ANTIGRAVITY_IDE_VERSION for metadata.ide_version instead of the full User-Agent string. - Remove obsolete ANTIGRAVITY_GOOG_API_CLIENT_UA export and test.
1 parent 3d67ac2 commit eb3132e

4 files changed

Lines changed: 12 additions & 11 deletions

File tree

‎src/adapters/client-fingerprint.ts‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ export function claudeCodeSessionId(token: string | undefined): string {
4545
export const ANTIGRAVITY_IDE_VERSION = "2.5.5";
4646
const ANTIGRAVITY_IDE_CLIENT_NAME = "aidev_client";
4747
const ANTIGRAVITY_IDE_PLATFORM = "windows/amd64";
48-
/** Secondary Google API client UA the Antigravity client library reports. */
49-
export const ANTIGRAVITY_GOOG_API_CLIENT_UA = "google-api-nodejs-client/10.3.0";
5048

5149
/**
5250
* The real Antigravity IDE User-Agent, e.g.

‎src/oauth/google-antigravity.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import { OAuthCallbackFlow, type OAuthCallbackFlowOptions } from "./callback-server";
1313
import { generatePKCE } from "./pkce";
1414
import type { OAuthController, OAuthCredentials } from "./types";
15-
import { antigravityUserAgent, ANTIGRAVITY_GOOG_API_CLIENT_UA } from "../adapters/client-fingerprint";
15+
import { ANTIGRAVITY_IDE_VERSION, antigravityUserAgent } from "../adapters/client-fingerprint";
1616

1717
const CLIENT_ID = process.env.GOOGLE_ANTIGRAVITY_CLIENT_ID
1818
|| "1071006060591-tmhssin2h21lcre235vtolojh4g403ep.apps.googleusercontent.com";
@@ -110,8 +110,8 @@ async function onboardProject(accessToken: string, signal?: AbortSignal): Promis
110110
if (signal?.aborted) throw signal.reason ?? new Error("Antigravity onboarding aborted");
111111
const response = await fetch(`${DAILY_API}/${API_VERSION}:onboardUser`, {
112112
method: "POST",
113-
headers: { Authorization: `Bearer ${accessToken}`, Accept: "*/*", "Content-Type": "application/json", "User-Agent": antigravityUserAgent(), "x-goog-api-client": ANTIGRAVITY_GOOG_API_CLIENT_UA },
114-
body: JSON.stringify({ tier_id: "free-tier", metadata: { ide_type: "ANTIGRAVITY", ide_name: "antigravity", ide_version: antigravityUserAgent() } }),
113+
headers: { Authorization: `Bearer ${accessToken}`, Accept: "*/*", "Content-Type": "application/json", "User-Agent": antigravityUserAgent() },
114+
body: JSON.stringify({ tier_id: "free-tier", metadata: { ide_type: "ANTIGRAVITY", ide_name: "antigravity", ide_version: ANTIGRAVITY_IDE_VERSION } }),
115115
signal: requestSignal(signal),
116116
});
117117
if (!response.ok) {

‎tests/client-fingerprint.test.ts‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { describe, expect, test } from "bun:test";
22
import {
33
ANTIGRAVITY_IDE_VERSION,
4-
ANTIGRAVITY_GOOG_API_CLIENT_UA,
54
CLAUDE_CODE_HEADERS,
65
antigravityUserAgent,
76
claudeCodeSessionId,
@@ -42,10 +41,6 @@ describe("client fingerprint — helpers", () => {
4241
}
4342
});
4443

45-
test("secondary google api client UA is pinned", async () => {
46-
expect(ANTIGRAVITY_GOOG_API_CLIENT_UA).toMatch(/^google-api-nodejs-client\/[\d.]+$/);
47-
});
48-
4944
test("claude session id is a stable v4-shaped uuid per token", async () => {
5045
const a = claudeCodeSessionId("tok-abc");
5146
const b = claudeCodeSessionId("tok-abc");

‎tests/google-antigravity-oauth.test.ts‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { afterEach, describe, expect, spyOn, test } from "bun:test";
2+
import { ANTIGRAVITY_IDE_VERSION } from "../src/adapters/client-fingerprint";
23
import { discoverAntigravityProject, refreshAntigravityToken } from "../src/oauth/google-antigravity";
34
import { mkdirSync, rmSync } from "node:fs";
45
import { tmpdir } from "node:os";
@@ -37,7 +38,14 @@ describe("antigravity project discovery", () => {
3738

3839
test("falls back to onboardUser poll loop (not-done then done)", async () => {
3940
let onboardCalls = 0;
40-
routeFetch((url) => {
41+
routeFetch((url, init) => {
42+
if (url.includes(":onboardUser")) {
43+
const headers = (init?.headers ?? {}) as Record<string, string>;
44+
expect(headers["x-goog-api-client"]).toBeUndefined();
45+
expect(headers["User-Agent"]).toMatch(/^antigravity\/ide\//);
46+
const body = JSON.parse(String(init?.body ?? "{}"));
47+
expect(body.metadata?.ide_version).toBe(ANTIGRAVITY_IDE_VERSION);
48+
}
4149
if (url.includes(":loadCodeAssist")) return new Response(JSON.stringify({}), { status: 200 }); // no project
4250
if (url.includes(":onboardUser")) {
4351
onboardCalls++;

0 commit comments

Comments
 (0)