Skip to content

fix(console): normalize root composition tool schemas - #41128

Open
zcxGGmu wants to merge 1 commit into
anomalyco:devfrom
zcxGGmu:root-oneof-schema
Open

fix(console): normalize root composition tool schemas#41128
zcxGGmu wants to merge 1 commit into
anomalyco:devfrom
zcxGGmu:root-oneof-schema

Conversation

@zcxGGmu

@zcxGGmu zcxGGmu commented Aug 7, 2026

Copy link
Copy Markdown

Issue for this PR

Fixes #41110

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Normalizes OpenAI-compatible incoming tool schemas whose root uses oneOf / anyOf / allOf object branches but omits a top-level type.

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 typecheck in packages/console/app
  • bun run lint packages/console/app/src/routes/zen/util/provider/openai-compatible.ts packages/console/app/test/providerUsage.test.ts
  • git diff --check

Note: bun test ./test/providerUsage.test.ts currently has two pre-existing Google usage expectation failures on outputTokens (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.ts parse error unrelated to this diff, so I pushed with --no-verify after the focused checks passed.

Screenshots / recordings

Not a UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@anujbolewar anujbolewar left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OpenCode Go rejects Codex tool schemas with a root-level oneOf

3 participants