Skip to content

Commit 47a39c8

Browse files
alltomatosclaude
andcommitted
fix(providers): send the IDE-Node client fingerprint on Antigravity onboarding calls
loadCodeAssist/onboardUser had no User-Agent or X-Goog-Api-Client header at all — analyzed against D:\dev\OmniRoute's antigravityHeaders.ts, which sends a distinct "IDE-Node" fingerprint (google-api-nodejs-client User-Agent + X-Goog-Api-Client: gl-node/22.21.1) specifically for these onboarding calls on the "ide" profile, separate from both the CLI and native-IDE User-Agents used for actual chat calls. Google's onboarding endpoints likely gate on client identity headers, not just request body metadata, which would explain why the ideType/pluginType metadata fix alone didn't resolve the anomalyco#3501 license error. Scoped to "ide" only, "cli" untouched. Co-Authored-By: Claude Sonnet 5 <[email protected]>
1 parent 33140b3 commit 47a39c8

1 file changed

Lines changed: 27 additions & 18 deletions

File tree

‎packages/core/src/plugin/provider/google-antigravity.ts‎

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -87,18 +87,38 @@ const OnboardUserResponse = Schema.Struct({
8787
response: Schema.optional(Schema.Struct({ cloudaicompanionProject: Schema.optional(Schema.String) })),
8888
})
8989

90-
function post<S extends Schema.Top>(http: HttpClient.HttpClient, url: string, token: string, body: unknown, schema: S) {
90+
function post<S extends Schema.Top>(
91+
http: HttpClient.HttpClient,
92+
url: string,
93+
token: string,
94+
body: unknown,
95+
schema: S,
96+
headers?: Record<string, string>,
97+
) {
9198
return HttpClient.filterStatusOk(http)
9299
.execute(
93100
HttpClientRequest.post(url).pipe(
94101
HttpClientRequest.acceptJson,
95102
HttpClientRequest.bearerToken(token),
96103
HttpClientRequest.bodyJsonUnsafe(body),
104+
HttpClientRequest.setHeaders(headers ?? {}),
97105
),
98106
)
99107
.pipe(Effect.flatMap(HttpClientResponse.schemaBodyJson(schema)))
100108
}
101109

110+
// Google's onboarding endpoints (unlike generateContent) appear to gate on
111+
// client identity headers, not just the request body: OmniRoute's
112+
// reverse-engineered client sends this exact "IDE-Node" fingerprint —
113+
// distinct from both the CLI User-Agent and the native IDE Electron
114+
// User-Agent — specifically for loadCodeAssist/onboardUser on the "ide"
115+
// profile. Confirmed live: onboardUser 403s without it even with correct
116+
// body metadata.
117+
const ideNodeOnboardingHeaders = {
118+
"User-Agent": "antigravity/2.1.1 darwin/arm64 google-api-nodejs-client/10.3.0",
119+
"X-Goog-Api-Client": "gl-node/22.21.1",
120+
}
121+
102122
function get<S extends Schema.Top>(http: HttpClient.HttpClient, url: string, token: string, schema: S) {
103123
return HttpClient.filterStatusOk(http)
104124
.execute(HttpClientRequest.get(url).pipe(HttpClientRequest.acceptJson, HttpClientRequest.bearerToken(token)))
@@ -110,25 +130,13 @@ function get<S extends Schema.Top>(http: HttpClient.HttpClient, url: string, tok
110130
// alone isn't enough. Best-effort: a failure here still leaves the account
111131
// usable, since onboarding can complete lazily on the first real request.
112132
function discoverProject(http: HttpClient.HttpClient, accessToken: string, clientProfile: ClientProfile) {
113-
// The IDE surface's onboardUser rejects `pluginType: "GEMINI"` with a bare
114-
// 403 PermissionDenied — confirmed live (the account onboards fine through
115-
// the real Antigravity IDE app, just not through this metadata shape).
116-
// OmniRoute's reverse-engineered client uses `ideType: "ANTIGRAVITY"`
117-
// instead; kept scoped to the "ide" profile since "cli" is confirmed
118-
// working today with the GEMINI tag and there's no reason to risk
119-
// regressing it on an untested guess.
120-
// The IDE surface's onboardUser rejects auto-provisioning with a bare 403
121-
// PermissionDenied for both `{pluginType: "GEMINI"}` and
122-
// `{ideType: "ANTIGRAVITY"}` (OmniRoute's reverse-engineered metadata
123-
// shape) — confirmed live on an account that DOES onboard successfully
124-
// through the real Antigravity IDE app. That app likely links a Google
125-
// Cloud project through an interactive step (choose/create project in
126-
// browser) this API call alone doesn't replicate; not something a
127-
// metadata tweak can fix. Kept as ideType since it's no worse than the
128-
// old value and matches the real client's own shape.
133+
// pluginType: "GEMINI" is the CLI's onboarding metadata; ideType:
134+
// "ANTIGRAVITY" (OmniRoute's reverse-engineered shape) is what the real
135+
// IDE app sends. Scoped to "ide" only — "cli" is confirmed working today.
129136
const metadata = clientProfile === "ide" ? { ideType: "ANTIGRAVITY" } : { pluginType: "GEMINI" }
137+
const headers = clientProfile === "ide" ? ideNodeOnboardingHeaders : undefined
130138
return Effect.gen(function* () {
131-
const loaded = yield* post(http, loadCodeAssistUrl, accessToken, { metadata }, LoadCodeAssistResponse)
139+
const loaded = yield* post(http, loadCodeAssistUrl, accessToken, { metadata }, LoadCodeAssistResponse, headers)
132140
if (loaded.cloudaicompanionProject) {
133141
return { projectID: loaded.cloudaicompanionProject, tier: loaded.currentTier?.id }
134142
}
@@ -138,6 +146,7 @@ function discoverProject(http: HttpClient.HttpClient, accessToken: string, clien
138146
accessToken,
139147
{ tierId: loaded.currentTier?.id ?? "free-tier", metadata },
140148
OnboardUserResponse,
149+
headers,
141150
)
142151
return { projectID: onboarded.response?.cloudaicompanionProject, tier: loaded.currentTier?.id }
143152
}).pipe(Effect.catch(() => Effect.succeed({ projectID: undefined, tier: undefined })))

0 commit comments

Comments
 (0)