fix: strip unsupported JSON Schema keywords for Claude via Cloud Code Assist (openclaw#20124) thanks @ephraimm

Verified:
- pnpm install --frozen-lockfile
- pnpm build
- pnpm check (fails on existing unrelated type error: src/agents/subagent-announce.format.e2e.test.ts:71)
- pnpm test:e2e src/agents/pi-embedded-runner/google.e2e.test.ts
- pnpm test:macmini (fails on existing unrelated test: src/agents/subagent-registry.steer-restart.test.ts)

Co-authored-by: ephraimm <2803669+ephraimm@users.noreply.github.com>
Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
This commit is contained in:
Ephraim Moss
2026-02-20 06:31:20 +02:00
committed by GitHub
parent f91034aa6b
commit 59e58bf81c
3 changed files with 39 additions and 5 deletions

View File

@@ -247,11 +247,11 @@ export function sanitizeToolsForGoogle<
tools: AgentTool<TSchemaType, TResult>[];
provider: string;
}): AgentTool<TSchemaType, TResult>[] {
// 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) => {