Skip to content

fix: include google-generative-ai in sanitizeToolsForGoogle#23954

Open
miloudbelarebia wants to merge 1 commit intoopenclaw:mainfrom
miloudbelarebia:fix/sanitize-tools-google-generative-ai
Open

fix: include google-generative-ai in sanitizeToolsForGoogle#23954
miloudbelarebia wants to merge 1 commit intoopenclaw:mainfrom
miloudbelarebia:fix/sanitize-tools-google-generative-ai

Conversation

@miloudbelarebia
Copy link
Contributor

@miloudbelarebia miloudbelarebia commented Feb 22, 2026

Summary

  • Add google-generative-ai to the provider check in sanitizeToolsForGoogle()
  • Previously only google-gemini-cli and google-antigravity were sanitized, leaving google-generative-ai with unsupported JSON Schema keywords

Test plan

  • Verify tools are properly sanitized when using the google-generative-ai provider
  • Verify no regression for google-gemini-cli and google-antigravity providers

Fixes #20197

Greptile Summary

This PR adds google-generative-ai to the provider check in sanitizeToolsForGoogle(), so that tool schemas are properly cleaned of unsupported JSON Schema keywords (e.g., patternProperties, additionalProperties, $ref) before being sent to the Google Generative AI provider. Previously, only google-gemini-cli and google-antigravity were handled.

  • The core fix in sanitizeToolsForGoogle is correct and addresses the reported issue (sanitizeToolsForGoogle() does not sanitize tools for google-generative-ai provider #20197)
  • Issue found: The companion function logToolSchemasForGoogle (line 312) was not updated to include google-generative-ai, meaning schema violation diagnostics will be silently skipped for this provider
  • No test was added for the new google-generative-ai provider path in google.test.ts (existing tests only cover google-gemini-cli and google-antigravity)

Confidence Score: 3/5

  • The core fix is correct but incomplete — a sibling function was missed, reducing diagnostic coverage for the new provider.
  • The change to sanitizeToolsForGoogle is correct and fixes the reported bug. However, logToolSchemasForGoogle in the same file was not updated to include google-generative-ai, which means schema violation warnings won't be logged for this provider. Additionally, no test was added for the new provider path.
  • src/agents/pi-embedded-runner/google.tslogToolSchemasForGoogle on line 312 needs the same google-generative-ai provider addition

Last reviewed commit: ee318bf

The provider check only matched `google-gemini-cli` and
`google-antigravity`, so tools routed through the
`google-generative-ai` provider were sent with unsupported JSON
Schema keywords (patternProperties, additionalProperties, $ref),
causing API errors.

Fixes openclaw#20197
@openclaw-barnacle openclaw-barnacle bot added agents Agent runtime and tooling size: XS labels Feb 22, 2026
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 22, 2026

Additional Comments (1)

src/agents/pi-embedded-runner/google.ts
logToolSchemasForGoogle missing google-generative-ai

sanitizeToolsForGoogle was updated to include google-generative-ai, but the sibling function logToolSchemasForGoogle (line 312) was not. Both functions are called together in attempt.ts:400-405 and compact.ts:388-390 with the same provider value. As a result, unsupported schema keyword violations won't be logged when using the google-generative-ai provider.

  if (params.provider !== "google-antigravity" && params.provider !== "google-gemini-cli" && params.provider !== "google-generative-ai") {
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/agents/pi-embedded-runner/google.ts
Line: 312

Comment:
**`logToolSchemasForGoogle` missing `google-generative-ai`**

`sanitizeToolsForGoogle` was updated to include `google-generative-ai`, but the sibling function `logToolSchemasForGoogle` (line 312) was not. Both functions are called together in `attempt.ts:400-405` and `compact.ts:388-390` with the same `provider` value. As a result, unsupported schema keyword violations won't be logged when using the `google-generative-ai` provider.

```suggestion
  if (params.provider !== "google-antigravity" && params.provider !== "google-gemini-cli" && params.provider !== "google-generative-ai") {
```

How can I resolve this? If you propose a fix, please make it concise.

@openclaw-barnacle
Copy link

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle bot added the stale Marked as stale due to inactivity label Feb 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling size: XS stale Marked as stale due to inactivity

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sanitizeToolsForGoogle() does not sanitize tools for google-generative-ai provider

1 participant