diff --git a/CHANGELOG.md b/CHANGELOG.md index eae5c0167fa..cbd0b2012c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -173,6 +173,7 @@ Docs: https://docs.openclaw.ai ### Fixes +- Agents/Google: clean tool JSON Schemas for `google-antigravity` the same as `google-gemini-cli` before Cloud Code Assist requests, preventing Claude tool calls from failing with `patternProperties` 400 errors. (#19860) - Tests/Telegram: add regression coverage for command-menu sync that asserts all `setMyCommands` entries are Telegram-safe and hyphen-normalized across native/custom/plugin command sources. (#19703) Thanks @obviyus. - Agents/Image: collapse resize diagnostics to one line per image and include visible pixel/byte size details in the log message for faster triage. - Auth/Cooldowns: clear all usage stats fields (`disabledUntil`, `disabledReason`, `failureCounts`) in `clearAuthProfileCooldown` so manual cooldown resets fully recover billing-disabled profiles without requiring direct file edits. (#19211) Thanks @nabbilkhan. diff --git a/src/agents/pi-embedded-runner/google.e2e.test.ts b/src/agents/pi-embedded-runner/google.e2e.test.ts index 30c8c7f8da6..f5e331b1428 100644 --- a/src/agents/pi-embedded-runner/google.e2e.test.ts +++ b/src/agents/pi-embedded-runner/google.e2e.test.ts @@ -33,4 +33,37 @@ describe("sanitizeToolsForGoogle", () => { expect(params.additionalProperties).toBeUndefined(); expect(params.properties?.foo?.format).toBeUndefined(); }); + + it("strips unsupported schema keywords for google-antigravity", () => { + const tool = { + name: "test", + description: "test", + parameters: { + type: "object", + patternProperties: { + "^x-": { type: "string" }, + }, + properties: { + foo: { + type: "string", + format: "uuid", + }, + }, + }, + execute: async () => ({ ok: true, content: [] }), + } as unknown as AgentTool; + + const [sanitized] = sanitizeToolsForGoogle({ + tools: [tool], + provider: "google-antigravity", + }); + + const params = sanitized.parameters as { + patternProperties?: unknown; + properties?: Record; + }; + + expect(params.patternProperties).toBeUndefined(); + expect(params.properties?.foo?.format).toBeUndefined(); + }); }); diff --git a/src/agents/pi-embedded-runner/google.ts b/src/agents/pi-embedded-runner/google.ts index 07ad4a51895..7a6a0bf76cc 100644 --- a/src/agents/pi-embedded-runner/google.ts +++ b/src/agents/pi-embedded-runner/google.ts @@ -247,11 +247,11 @@ export function sanitizeToolsForGoogle< tools: AgentTool[]; provider: string; }): AgentTool[] { - // google-antigravity serves Anthropic models (e.g. claude-opus-4-6-thinking), - // NOT Gemini. Applying Gemini schema cleaning strips JSON Schema keywords - // (minimum, maximum, format, etc.) that Anthropic's API requires for - // draft 2020-12 compliance. Only clean for actual Gemini providers. - if (params.provider !== "google-gemini-cli") { + // Cloud Code Assist uses the OpenAPI 3.03 `parameters` field for both Gemini + // AND Claude models. This field does not support JSON Schema keywords such as + // patternProperties, additionalProperties, $ref, etc. We must clean schemas + // for every provider that routes through this path. + if (params.provider !== "google-gemini-cli" && params.provider !== "google-antigravity") { return params.tools; } return params.tools.map((tool) => {