[PR #13738] fix(provider): sanitize tool schemas for strict validators #14794

Closed
opened 2026-02-16 18:19:33 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/13738

State: closed
Merged: No


Fixes #13737
Related: #11413, #8184, #13618

Tool schemas have two issues that cause 400s on strict validators (Codex, Vertex AI, SGLang): optional properties missing from required when additionalProperties: false is set, and non-standard keywords ($schema, ref) from Zod meta.

Added a recursive sanitize() step in ProviderTransform.schema() that strips the bad keywords and ensures all properties are in required when additionalProperties is false. Runs before provider-specific transforms.

Tested against Codex and Vertex AI endpoints — both previously 400, now work. 6 new unit tests, all 104 existing tests pass.

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/13738 **State:** closed **Merged:** No --- Fixes #13737 Related: #11413, #8184, #13618 Tool schemas have two issues that cause 400s on strict validators (Codex, Vertex AI, SGLang): optional properties missing from `required` when `additionalProperties: false` is set, and non-standard keywords (`$schema`, `ref`) from Zod meta. Added a recursive `sanitize()` step in `ProviderTransform.schema()` that strips the bad keywords and ensures all properties are in `required` when `additionalProperties` is false. Runs before provider-specific transforms. Tested against Codex and Vertex AI endpoints — both previously 400, now work. 6 new unit tests, all 104 existing tests pass.
yindo added the pull-request label 2026-02-16 18:19:33 -05:00
yindo closed this issue 2026-02-16 18:19:33 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#14794