fix(antigravity): drop requestType "agent" to avoid false 429 RESOURCE_EXHAUSTED

This commit is contained in:
BFLabsAI
2026-09-22 15:04:03 +07:00
committed by decolua
parent 782c137b1f
commit 5798b30841
2 changed files with 15 additions and 6 deletions

View File

@@ -293,12 +293,19 @@ export class AntigravityExecutor extends BaseExecutor {
this._lastSessionId = transformedRequest.sessionId; // cached for buildHeaders (base.execute order) this._lastSessionId = transformedRequest.sessionId; // cached for buildHeaders (base.execute order)
// Official Antigravity client omits `requestType` entirely on the agent
// (chat) path. Sending `requestType: "agent"` here (or leaking it through
// from an upstream envelope via the ...body spread below) makes Google
// bucket the request and return a detail-free 429 RESOURCE_EXHAUSTED even
// with quota available. `image_gen` and
// `search` buckets are unaffected and keep their own requestType.
delete body.requestType;
return { return {
...body, ...body,
project: projectId, project: projectId,
model: body.model || model, model: body.model || model,
userAgent: "antigravity", userAgent: "antigravity",
requestType: "agent",
requestId: buildIdeRequestId({ body, request: transformedRequest, credentials, model, requestType: "agent" }), requestId: buildIdeRequestId({ body, request: transformedRequest, credentials, model, requestType: "agent" }),
request: transformedRequest request: transformedRequest
}; };

View File

@@ -279,10 +279,11 @@ function wrapInCloudCodeEnvelope(model, geminiCLI, credentials = null, isAntigra
} }
}; };
// Antigravity specific fields // Antigravity specific fields.
if (isAntigravity) { // NOTE: the official Antigravity client omits `requestType` entirely on the
envelope.requestType = "agent"; // agent (chat) path. Sending `requestType: "agent"` triggers a detail-free
} else { // 429 RESOURCE_EXHAUSTED even with quota available.
if (!isAntigravity) {
// Keep safetySettings for Gemini CLI // Keep safetySettings for Gemini CLI
envelope.request.safetySettings = geminiCLI.safetySettings; envelope.request.safetySettings = geminiCLI.safetySettings;
} }
@@ -305,7 +306,8 @@ function wrapInCloudCodeEnvelopeForClaude(model, claudeRequest, credentials = nu
model: model, model: model,
userAgent: "antigravity", userAgent: "antigravity",
requestId: `agent-${generateUUID()}`, requestId: `agent-${generateUUID()}`,
requestType: "agent", // NOTE: official Antigravity client omits `requestType` on the agent (chat)
// path — see the note in wrapInCloudCodeEnvelope() above.
request: { request: {
sessionId: toNumericSessionId(credentials?._clientSessionId) || deriveSessionId(credentials?.email || credentials?.connectionId), sessionId: toNumericSessionId(credentials?._clientSessionId) || deriveSessionId(credentials?.email || credentials?.connectionId),
contents: [], contents: [],