fix(console): normalize root composition tool schemas - #41128
Open
zcxGGmu wants to merge 1 commit into
Open
Conversation
anujbolewar
reviewed
Aug 7, 2026
anujbolewar
left a comment
There was a problem hiding this comment.
makes sense, composition params (oneOf/anyOf/allOf) without a type were getting rejected by strict validators downstream, and the every() guard keeps it conservative so it only touches clearly-object branches. tiny nit: that every() line is a bit long, but totally fine.
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.
Issue for this PR
Fixes #41110
Type of change
What does this PR do?
Normalizes OpenAI-compatible incoming tool schemas whose root uses
oneOf/anyOf/allOfobject branches but omits a top-leveltype.For these schemas, the proxy now adds
type: "object"while preserving the composition branches and$defs. This matches the minimal compatibility workaround described in the issue without changing non-object composition schemas.How did you verify your code works?
bun test ./test/providerUsage.test.ts --test-name-pattern 'adds object type to root oneOf tool parameter schemas'bun typecheckinpackages/console/appbun run lint packages/console/app/src/routes/zen/util/provider/openai-compatible.ts packages/console/app/test/providerUsage.test.tsgit diff --checkNote:
bun test ./test/providerUsage.test.tscurrently has two pre-existing Google usage expectation failures onoutputTokens(expected 3, received 5) that are unrelated to this diff. The focused regression above passes.Also note: repo-wide pre-push typecheck is currently blocked by an existing
@opencode-ai/enterprise/src/custom-elements.d.tsparse error unrelated to this diff, so I pushed with--no-verifyafter the focused checks passed.Screenshots / recordings
Not a UI change.
Checklist