fix(tools): flatten nested anyOf schemas for Vertex AI compatibility#409
Closed
carlulsoe wants to merge 1 commit intoopenclaw:mainfrom
Closed
fix(tools): flatten nested anyOf schemas for Vertex AI compatibility#409carlulsoe wants to merge 1 commit intoopenclaw:mainfrom
carlulsoe wants to merge 1 commit intoopenclaw:mainfrom
Conversation
Contributor
Author
AI Assistance Disclosure 🤖Per CONTRIBUTING.md requirements:
|
Claude API on Vertex AI (Cloud Code Assist) rejects nested anyOf schemas as invalid JSON Schema draft 2020-12. This change: - Add tryFlattenLiteralAnyOf() to convert Type.Union([Type.Literal(...)]) patterns from anyOf with const values to flat enum arrays - Update stringEnum helper in bash-tools to use Type.Unsafe with flat enum - Flatten BrowserActSchema from discriminated union to single object - Simplify TelegramToolSchema to use Type.String() for IDs Fixes 400 errors when sending messages through WhatsApp/Telegram providers.
f535e53 to
e9c834f
Compare
Contributor
Author
Response to GPT-5.2-codex reviewHigh (text for wait): The Medium (relaxed validation): Acceptable tradeoff. The browser control server validates requests and returns clear error messages for invalid combinations. The LLM uses the schema as guidance, and runtime errors are handled gracefully. Low (dropped metadata): Fixed in e9c834f - |
Contributor
|
Thanks ! Welcome to the Clawtributors! Say hi on Discord! |
steipete
added a commit
that referenced
this pull request
Jan 7, 2026
Contributor
|
Landed on main as c3b3f57 + a2b3f2c. Added a README co-author credit commit (a882beb) so @carlulsoe shows up in the contributors graph. Closing PR. |
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
anyOfschemas from TypeBoxType.Union([Type.Literal(...)])patterns were being rejected as invalid JSON Schema draft 2020-12tryFlattenLiteralAnyOf()to automatically convert literal unions to flat enum arraysBrowserActSchemafrom discriminated union to single merged objectTelegramToolSchemato useType.String()for IDsTest plan
npx vitest run src/agents)bun run tsc --noEmit)🤖 Generated with Claude Code