[codex] Normalize MCP schema integer constraints - #420
Draft
lawyer112 wants to merge 1 commit into
Draft
Conversation
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
move_agent_to_cloned_rootschema and a preservation test for non-integer valuesProblem
Cursor app-control can send MCP input schemas through a protobuf
Struct. Protobuf numbers are decoded as floating-point values, so integer-only JSON Schema keywords such asminItems: 1can be serialized asminItems: 1.0.Strict OpenAI Responses-compatible validators reject the entire tool definition before the model can answer. The observed failure was:
The existing MCP normalizer already repairs the missing root
type: objectannotation used by this app-control schema, but returned before normalizing constraints on otherwise valid object schemas.Fix
Normalize non-negative, integral floating-point values for JSON Schema's integer-only size/count keywords into integer JSON numbers. The traversal is schema-aware and covers nested schemas in properties, unions, definitions, array items, and related schema containers.
Fractional values and other numeric constraints such as
minimum: 1.0remain unchanged.Validation
cargo test --package cursor-server --lib— 137 passedcargo clippy --package cursor-server --all-targets -- -D warningscargo fmt --all -- --checkgit diff --checkThe full
cargo test --package cursor-serverrun also passed all suites exceptevery_captured_mode_owns_and_renders_its_runtime_template. That assertion expects LF-only prompt text and fails on this Windows checkout; the identical failure was reproduced in a separate, unmodifiedorigin/mainworktree.