Skip to content

feat: support oneOf and allOf in tool input schemas#24118

Open
celia-oai wants to merge 3 commits into
mainfrom
dev/cc/support-allof
Open

feat: support oneOf and allOf in tool input schemas#24118
celia-oai wants to merge 3 commits into
mainfrom
dev/cc/support-allof

Conversation

@celia-oai
Copy link
Copy Markdown
Collaborator

@celia-oai celia-oai commented May 22, 2026

Why

Some connector golden schemas use JSON Schema composition keywords beyond anyOf, specifically top-level or nested oneOf and allOf. Codex currently needs to preserve those shapes when parsing MCP tool input schemas so connector tools do not lose valid schema structure during normalization.

To prevent an increased Responses API error rate, this PR will be merged after the Responses API supports top-level oneOf/allOf.

What Changed

  • Adds oneOf and allOf support to JsonSchema, matching the existing anyOf handling.
  • Traverses oneOf and allOf anywhere schema children are visited, including sanitization, definition reachability, description stripping, and deep schema compaction.
  • Adds a final large-schema compaction pass that prunes schema objects containing anyOf, oneOf, or allOf to {} if earlier compaction passes still leave the schema over budget.

Validation

Golden schema token validation over 2,025 schemas under golden_schemas, all parsed successfully. Token count is o200k_base over compact JSON from parse_tool_input_schema.

Percentile Before PR After oneOf/allOf After pruning
p0 9 9 9
p10 63 64 64
p25 86 87 87
p50 125 128 128
p75 203 206 206
p90 327 333 333
p95 460 473 473
p99 763 779 779
max 891 955 955

Totals:

Parser state Total tokens
Before PR 345,713
After oneOf/allOf 352,686
After pruning 352,686

The pruning column matches the oneOf/allOf column for this corpus because no parsed compact golden schema remains over the 4,000 compact-byte budget after the earlier compaction passes.

@celia-oai celia-oai force-pushed the dev/cc/support-allof branch from 15d0d63 to a850dfd Compare May 22, 2026 19:13
@celia-oai celia-oai changed the title changes Support oneOf and allOf in tool input schemas May 22, 2026
@celia-oai celia-oai changed the title Support oneOf and allOf in tool input schemas feat: support oneOf and allOf in tool input schemas May 22, 2026
@celia-oai celia-oai marked this pull request as ready for review May 22, 2026 19:34
@celia-oai celia-oai requested a review from pakrym-oai May 22, 2026 19:34
@celia-oai
Copy link
Copy Markdown
Collaborator Author

@codex review

@celia-oai celia-oai force-pushed the dev/cc/support-allof branch from a850dfd to b8d1742 Compare May 22, 2026 19:36
@chatgpt-codex-connector
Copy link
Copy Markdown
Contributor

Codex Review: Didn't find any major issues. What shall we delve into next?

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@celia-oai celia-oai force-pushed the dev/cc/support-allof branch from 044a09e to 2a0eef2 Compare May 22, 2026 23:59
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.

2 participants