fix(api): eliminate schema mismatches in Responses compact endpoint#5909
fix(api): eliminate schema mismatches in Responses compact endpoint#5909EleanorWho wants to merge 4 commits into
Conversation
✱ Stainless preview buildsThis PR will update the Edit this comment to update it. It will appear in the SDK's changelogs. ✅ llama-stack-client-openapi studio · code · diff
✅ llama-stack-client-node studio · code · diff
✅ llama-stack-client-python studio · code · diff
✅ llama-stack-client-go studio · conflict
This comment is auto-generated by GitHub Actions and is automatically kept up to date as you push. |
Make CompactResponseRequest.model nullable (str | None) to match OpenAI's ModelIdsCompaction type and add post-generation schema transforms that inject a ModelIdsResponses reference and restructure the input field's anyOf to nest string + array inside a oneOf wrapper, matching the OpenResponses spec structure. Reduces /responses/compact conformance issues from 3 to 1 and improves the Responses category score from 88.8% to 89.7%. BREAKING CHANGE: the generated OpenAPI schema for CompactResponseRequest restructures the input and model fields to match OpenAI's spec. No runtime API behavior changes. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> Signed-off-by: Eleanor Hu <[email protected]>
2c0d8f7 to
29d28ad
Compare
|
This pull request has merge conflicts that must be resolved before it can be merged. @EleanorWho please rebase it. https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork |
…conformance Signed-off-by: Eleanor Hu <[email protected]> # Conflicts: # docs/docs/api-openai/conformance.mdx # docs/static/openai-coverage.json
Signed-off-by: Eleanor Hu <[email protected]>
Replace empty-string fallback with an early validation error when neither the request model nor summarization_model is configured. Also use summarization_model for the stored response when the request model is null. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> Signed-off-by: Eleanor Hu <[email protected]>
mattf
left a comment
There was a problem hiding this comment.
@EleanorWho which spec are you using as a reference?
https://www.openresponses.org/reference#compaction-endpoint and https://developers.openai.com/api/reference/resources/responses/methods/compact both show the model as required.
Hi @mattf , I use The model field on As for the reference links you mentioned, I guess the rendered docs pages appear to simplify this by hiding the nullable annotation. |
|
This pull request has merge conflicts that must be resolved before it can be merged. @EleanorWho please rebase it. https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork |
|
@EleanorWho PTAL at the conflicts here |
@EleanorWho this is tough -
and empirically it's required - looks like a bug in the openai/openai-openai spec. @cdoern where does our copy of the spec come from? |
Summary
CompactResponseRequest.modelnullable (str | None) to match OpenAI'sModelIdsCompactiontypeModelIdsResponsesreference into the model field and restructure the input field'sanyOfto neststring + arrayinside aoneOfwrapper, matching the OpenResponses spec structure/responses/compactconformance issues from 3 to 1 and improves the Responses category score from 88.8% to 89.7%What was fixed
modelType added: ['string']; Union variants removed: 3inputUnion variants added: 2; removed: 1output.itemsUnion variants added: 4Why
output.itemscannot be fully resolvedThe remaining issue (
Union variants added: 4) has two causes:Structural: OGX uses a nested
anyOf[oneOf[8 discriminated types], ref, ref, ref]generated by Pydantic'sleft_to_rightunion mode, while OpenAI uses a flatoneOf[25]. Flattening the union and renaming components to match changes the issue toremoved: 14but doesn't reduce the issue count — the score stays the same.Missing tool types: OpenAI's
ItemFieldincludes 14 tool types not implemented in OGX:ToolSearchCall,ToolSearchOutput,ImageGenToolCall,ComputerToolCall,ComputerToolCallOutput,CodeInterpreterToolCall,LocalShellToolCall,LocalShellToolCallOutput,FunctionShellCall,FunctionShellCallOutput,ApplyPatchToolCall,ApplyPatchToolCallOutput,CustomToolCall,CustomToolCallOutput.If needed, stub Pydantic models (just
type: Literal["xxx"]+model_config = ConfigDict(extra="allow")) could be added for these 14 types to fully eliminate the issue.Why this triggers oasdiff breaking change detection
The structural changes (anyOf → oneOf wrapping for input, adding ModelIdsResponses variant to model) are flagged by oasdiff as breaking changes because the schema structure differs from the previous generated output. The API accepts and returns the same data — no runtime behavior changes.
Test plan
uv run pre-commit run --all-files— all hooks pass exceptapi-conformance(expected, see above)uv run pytest tests/unit/ -x --tb=short— 2367 tests passuv run ./scripts/run_openapi_generator.sh— all specs generate and validatePATH="$HOME/go/bin:$PATH" uv run python scripts/openai_coverage.py --update --generate-docs— Responses score 88.8% → 89.7%, compact issues 3 → 1🤖 Generated with Claude Code