fix: include google-generative-ai in sanitizeToolsForGoogle#23954
Open
miloudbelarebia wants to merge 1 commit intoopenclaw:mainfrom
Open
fix: include google-generative-ai in sanitizeToolsForGoogle#23954miloudbelarebia wants to merge 1 commit intoopenclaw:mainfrom
miloudbelarebia wants to merge 1 commit intoopenclaw:mainfrom
Conversation
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
Contributor
Additional Comments (1)
Prompt To Fix With AIThis 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. |
|
This pull request has been automatically marked as stale due to inactivity. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
google-generative-aito the provider check insanitizeToolsForGoogle()google-gemini-cliandgoogle-antigravitywere sanitized, leavinggoogle-generative-aiwith unsupported JSON Schema keywordsTest plan
Fixes #20197
Greptile Summary
This PR adds
google-generative-aito the provider check insanitizeToolsForGoogle(), 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, onlygoogle-gemini-cliandgoogle-antigravitywere handled.sanitizeToolsForGoogleis correct and addresses the reported issue (sanitizeToolsForGoogle() does not sanitize tools for google-generative-ai provider #20197)logToolSchemasForGoogle(line 312) was not updated to includegoogle-generative-ai, meaning schema violation diagnostics will be silently skipped for this providergoogle-generative-aiprovider path ingoogle.test.ts(existing tests only covergoogle-gemini-cliandgoogle-antigravity)Confidence Score: 3/5
sanitizeToolsForGoogleis correct and fixes the reported bug. However,logToolSchemasForGooglein the same file was not updated to includegoogle-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.ts—logToolSchemasForGoogleon line 312 needs the samegoogle-generative-aiprovider additionLast reviewed commit: ee318bf