Repository navigation
GPT-OSS auto tool grammar: read the repair's sibling type as a render hint - #2714
Merged
Merged
Conversation
… hint The auto grammar compiled the type the schema repair writes beside a union naming one of its branches, a mixed enum, a not or an if as a hard type, so a string-or-integer argument could only be written as a string. Drop that type before compiling (QwenParserLiteralReading.rendersSiblingType, the rule the call parser and the strict check already read). Declarations without such a type compile exactly as before; forced choices, the prompt and validation are unchanged.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…ing null The strict check admits null at a node marked nullable even when its type is a render hint. Once the hint is dropped, carry that null in the node's union or enum so the grammar admits it too.
CI on the red control shows the previous grammar already left unions and mixed enums beside the render type free; only a not of the render type was held to it. Say so in the changelog and the architecture note.
This was referenced Nov 24, 2026
This branch was successfully deployed
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
Under
tool_choice: "auto", GPT-OSS's call grammar (GPTOSSAutoToolConstraint) compiles each tool's arguments from its declaration. Where the schema repair writes atypebeside anotof that type ({"not": {"type": "string"}, "type": "string"}), the grammar held the argument to that type, which the declaration refuses. The call parser and the strict check already read such a sibling type as a render hint (QwenParserLiteralReading.rendersSiblingType, #2640); the grammar now does too, and keepsnullwhere the node is markednullable.The red control's CI shows that unions and mixed enums beside the render type were already compiled to free arguments, so OR-FUZZ G1's
"-4200"does not come from this grammar. The new tests pin that those shapes stay free.Base
Stacked on #2689 (
939db0b3d5). Commitsc1f154c7d8,ff4f9d67d9(a hinted node markednullablekeeps admitting null),713d506429(tests: a contradictedenum, anotof the render type) and084adbfbdf(changelog and architecture note state what changes).What changes
GPTOSSAutoToolGrammar.compiledArgumentscompiles each declaration afterwithoutRenderHintTypes. That pass drops a node'stypeexactly whererendersSiblingTypeholds: beside ananyOf/oneOfthat names it among its branches, a mixedenum, anotof that type, or anif/then/elsetyped otherwise. It walksproperties,patternProperties,items,prefixItems,additionalProperties, the unions,not/if/then/elseand$defs/definitions, to the compiler's depth.nullable: truekeeps admitting null, as the strict check reads it: once the hint is dropped, a null branch is added to itsanyOf/oneOfandnullto itsenumwhere they lack one.notof the render type is no longer held to that type; unions and mixed enums stay free, as before.required/named compile the request's tools, not this path);Test plan
GPTOSSAutoToolRenderHintTests:{anyOf|oneOf: [string, integer], type: string}admits-4200and"-4200";enumwithtype: stringadmits-1and"inherit";enumof integers besidetype: stringadmits2;{not: {type: string}, type: string}admits5andtrue;nullable(two-branchanyOf, one-branchoneOf, mixedenum) admitsnulland its typed members;anyOfwithout a sibling, plain integer, nullable type list, a consistent sibling (type: objectbeside typelessanyOfbranches) and Pydantic's routed nullable unions. The pass returns the declaration unchanged (except the nullable unions), and the compiled arguments describe identically to the previous exact-or-widened result;requiredcompiles the request's tools exactly asToolConstraintSchemaCompiler.compiledoes.bothMembersCompleteTheKeyPreludeAndReleaseOnlyAfterTheirOwnersExitin an unrelated suite); the union, nullable and enum tests pass on both, as these shapes were already free.4f2c4b9901) or GPT-OSS call recovery off by default (do not merge unless the #2694 gate fails) #2700 (418e5964e1);git merge-treeis clean with both.Components touched
Protocol / interface changes
Documentation impact
docs/architecture/inference.md(GPT-OSS auto tool calls).Changelog
changelog.d/gptoss-auto-grammar-render-hints.md;python3 scripts/changelog.py checkpasses.Before And After