Revert "fix: flatten remaining anyOf/oneOf in Gemini schema cleaning"

This reverts commit 06b961b037.
This commit is contained in:
Gustavo Madeira Santana
2026-02-16 20:33:53 -05:00
parent c0c367fde7
commit a1538ea637
4 changed files with 52 additions and 66 deletions

View File

@@ -1,7 +1,8 @@
import { EventEmitter } from "node:events";
import type { AgentMessage, AgentTool } from "@mariozechner/pi-agent-core";
import type { SessionManager } from "@mariozechner/pi-coding-agent";
import type { TSchema } from "@sinclair/typebox";
import { EventEmitter } from "node:events";
import type { TranscriptPolicy } from "../transcript-policy.js";
import { registerUnhandledRejectionHandler } from "../../infra/unhandled-rejections.js";
import {
hasInterSessionUserProvenance,
@@ -20,7 +21,6 @@ import {
stripToolResultDetails,
sanitizeToolUseResultPairing,
} from "../session-transcript-repair.js";
import type { TranscriptPolicy } from "../transcript-policy.js";
import { resolveTranscriptPolicy } from "../transcript-policy.js";
import { log } from "./logger.js";
import { describeUnknownError } from "./utils.js";
@@ -245,7 +245,11 @@ export function sanitizeToolsForGoogle<
tools: AgentTool<TSchemaType, TResult>[];
provider: string;
}): AgentTool<TSchemaType, TResult>[] {
if (params.provider !== "google-antigravity" && params.provider !== "google-gemini-cli") {
// 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") {
return params.tools;
}
return params.tools.map((tool) => {