#21835: fix: apply schema cleaning for google-antigravity in normalizeToolParameters
agents
size: XS
Cluster:
Tool Schema Fixes and Enhancements
## Problem
PR #20124 fixed `sanitizeToolsForGoogle` to include `google-antigravity`, but the error persisted because there is a **second cleaning path** in `normalizeToolParameters` (`pi-tools.schema.ts`) that was still skipping schema cleaning for `google-antigravity`.
Users still report `patternProperties` 400 errors even on the latest beta.
## Root Cause
In `normalizeToolParameters`, `google-antigravity` was explicitly listed in `isAnthropicProvider`:
```typescript
const isAnthropicProvider =
options?.modelProvider?.toLowerCase().includes("anthropic") ||
options?.modelProvider?.toLowerCase().includes("google-antigravity");
```
Since `google-antigravity` also matches `isGeminiProvider` (contains `"google"`), the guard `isGeminiProvider && !isAnthropicProvider` evaluated to `false`, skipping `cleanSchemaForGemini` on all three code paths.
But `google-antigravity` routes through Cloud Code Assist's OpenAPI 3.03 `parameters` field, which has the **same restrictions as Gemini** — not Anthropic's native API. It needs schema cleaning.
## Fix
Remove `google-antigravity` from the `isAnthropicProvider` check:
```diff
const isAnthropicProvider =
- options?.modelProvider?.toLowerCase().includes("anthropic") ||
- options?.modelProvider?.toLowerCase().includes("google-antigravity");
+ options?.modelProvider?.toLowerCase().includes("anthropic");
```
This allows all 3 occurrences of `isGeminiProvider && !isAnthropicProvider` to correctly apply `cleanSchemaForGemini` for `google-antigravity`.
## Testing
- Verified locally by patching the compiled dist files and restarting the daemon
- The change is minimal and only affects provider classification logic, no tool behavior changes
Fixes #20163
Related to #19860, #20124
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Removes `google-antigravity` from the `isAnthropicProvider` check in `normalizeToolParameters`. This fix allows `google-antigravity` to correctly receive schema cleaning via `cleanSchemaForGemini` in all three code paths where the condition `isGeminiProvider && !isAnthropicProvider` is evaluated.
- Before: `google-antigravity` was excluded from schema cleaning because it matched both `isGeminiProvider` (contains "google") and `isAnthropicProvider` (explicitly listed), causing the guard `isGeminiProvider && !isAnthropicProvider` to be false
- After: `google-antigravity` now only matches `isGeminiProvider`, allowing it to properly receive schema cleaning for Cloud Code Assist's OpenAPI 3.03 `parameters` field
- Completes the fix started in PR #20124 by addressing the second cleaning path
- Resolves `patternProperties` 400 errors for users on the latest beta
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk
- The change is surgical and correct: it removes `google-antigravity` from `isAnthropicProvider` check, allowing it to receive proper schema cleaning. The logic is well-documented, the fix addresses a confirmed bug with user reports, and it completes the work started in PR #20124. The change affects only provider classification logic and has clear test coverage via the related e2e tests in `google.e2e.test.ts`.
- No files require special attention
<sub>Last reviewed commit: fd76813</sub>
<!-- greptile_other_comments_section -->
<sub>(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#22214: fix(tools): sanitize google-antigravity schemas for Gemini-compatib...
by Kansodata · 2026-02-20
92.1%
#22321: fix: sanitize tool schemas for all Cloud Code Assist providers
by Sr-0w · 2026-02-21
87.7%
#17841: fix(google): include 'google' provider in tool schema sanitization
by zerone0x · 2026-02-16
85.4%
#4445: fix: resolve Antigravity "unsupported version" and tool_use schema ...
by harry2690 · 2026-01-30
82.4%
#23507: fix(tools): strip patternProperties from schemas for OpenAI-compati...
by long-pham · 2026-02-22
80.4%
#5011: fix(gemini): strip JSON thoughtSignature from tool calls for Gemini 3+
by shayan919293 · 2026-01-30
79.4%
#13831: fix(agents): include Anthropic in tool call ID sanitization
by lailoo · 2026-02-11
79.0%
#15205: fix(models): normalize google-antigravity api field from google-gem...
by wboudy · 2026-02-13
79.0%
#20249: fix(schema): ensure normalizeToolParameters always includes propert...
by aldoeliacim · 2026-02-18
78.6%
#13976: fix(anthropic): include Anthropic in tool call ID sanitization
by omair445 · 2026-02-11
78.1%