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:
@@ -173,6 +173,7 @@ Docs: https://docs.openclaw.ai
|
|||||||
|
|
||||||
### Fixes
|
### 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.
|
- 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.
|
- 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.
|
- 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.
|
||||||
|
|||||||
@@ -33,4 +33,37 @@ describe("sanitizeToolsForGoogle", () => {
|
|||||||
expect(params.additionalProperties).toBeUndefined();
|
expect(params.additionalProperties).toBeUndefined();
|
||||||
expect(params.properties?.foo?.format).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<string, { format?: unknown }>;
|
||||||
|
};
|
||||||
|
|
||||||
|
expect(params.patternProperties).toBeUndefined();
|
||||||
|
expect(params.properties?.foo?.format).toBeUndefined();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -247,11 +247,11 @@ export function sanitizeToolsForGoogle<
|
|||||||
tools: AgentTool<TSchemaType, TResult>[];
|
tools: AgentTool<TSchemaType, TResult>[];
|
||||||
provider: string;
|
provider: string;
|
||||||
}): AgentTool<TSchemaType, TResult>[] {
|
}): AgentTool<TSchemaType, TResult>[] {
|
||||||
// google-antigravity serves Anthropic models (e.g. claude-opus-4-6-thinking),
|
// Cloud Code Assist uses the OpenAPI 3.03 `parameters` field for both Gemini
|
||||||
// NOT Gemini. Applying Gemini schema cleaning strips JSON Schema keywords
|
// AND Claude models. This field does not support JSON Schema keywords such as
|
||||||
// (minimum, maximum, format, etc.) that Anthropic's API requires for
|
// patternProperties, additionalProperties, $ref, etc. We must clean schemas
|
||||||
// draft 2020-12 compliance. Only clean for actual Gemini providers.
|
// for every provider that routes through this path.
|
||||||
if (params.provider !== "google-gemini-cli") {
|
if (params.provider !== "google-gemini-cli" && params.provider !== "google-antigravity") {
|
||||||
return params.tools;
|
return params.tools;
|
||||||
}
|
}
|
||||||
return params.tools.map((tool) => {
|
return params.tools.map((tool) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user