← Back to PRs

#22321: fix: sanitize tool schemas for all Cloud Code Assist providers

by Sr-0w open 2026-02-21 01:37 View on GitHub →
agents size: S
## Summary - `sanitizeToolsForGoogle` only stripped unsupported JSON Schema keywords (`patternProperties`, `additionalProperties`, etc.) when the provider was `google-gemini-cli` or `google-antigravity` - Providers like `openai-codex` and `google/*` also route through Google Cloud Code Assist, which rejects these keywords with a 400 error - The `exec` tool's `env` field (`Type.Record`) generates `patternProperties` in its schema, breaking every API call for affected providers - Removed the provider guard so schemas are always sanitized — matching the intent already described in the comment above the function ## Reproduction 1. Configure `openai-codex/gpt-5.3-codex` or `google/gemini-3-pro-preview` as primary model 2. Send any message via Discord/Signal channel 3. API returns: `Invalid JSON payload received. Unknown name "patternProperties" at 'request.tools[0].function_declarations[3].parameters.properties[2].value': Cannot find field.` ## Test plan - [x] Added test cases for `openai-codex` and `google/*` providers - [x] Existing tests for `google-gemini-cli` and `google-antigravity` still pass - [ ] Verify manually with `openai-codex` provider via Discord channel <!-- greptile_comment --> <h3>Greptile Summary</h3> Removes the provider guard in `sanitizeToolsForGoogle` so that tool schemas are always sanitized before being sent to Cloud Code Assist, fixing 400 errors for `openai-codex` and `google/*` providers whose requests were rejected due to unsupported JSON Schema keywords like `patternProperties`. - The old guard only sanitized for `google-gemini-cli` and `google-antigravity`, contradicting the comment above it that stated schemas should be cleaned "for every provider that routes through this path" - Providers like `openai-codex` and `google/*` also route through Cloud Code Assist and hit the same OpenAPI 3.03 schema restrictions - The `exec` tool's `env` field (using `Type.Record`) generates `patternProperties` in its schema, which triggered the 400 on every API call for affected providers - New tests cover `openai-codex` and `google/*` provider scenarios; existing tests continue to pass <h3>Confidence Score: 5/5</h3> - This PR is safe to merge — it's a minimal, well-scoped bug fix that aligns behavior with the stated intent. - The change is a 3-line removal of a provider guard that was already documented as incorrect by the comment above it. The sanitization logic (`cleanToolSchemaForGemini`) is non-destructive — it only strips optional JSON Schema constraint keywords while preserving the core schema structure. The fix is backed by new test cases and does not change behavior for previously-working providers. There are no security implications, no architectural changes, and no risk of regression. - No files require special attention. <sub>Last reviewed commit: 0329be4</sub> <!-- greptile_other_comments_section --> <sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub> <!-- /greptile_comment -->

Most Similar PRs