-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Claude translated output schemas can falsely claim strict compatibility #6005
Copy link
Copy link
Closed
Labels
bugSomething isn't workingSomething isn't workingpriority: P2Medium: provider/client-specific bug with a workaround, bounded enhancement tied to a tracked issue,Medium: provider/client-specific bug with a workaround, bounded enhancement tied to a tracked issue,providerProvider adapters, OpenAI-compat presets, upstream API quirksProvider adapters, OpenAI-compat presets, upstream API quirksprovider-compatibilityProvider compatibility reportsProvider compatibility reports
Description
Activity
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingpriority: P2Medium: provider/client-specific bug with a workaround, bounded enhancement tied to a tracked issue,Medium: provider/client-specific bug with a workaround, bounded enhancement tied to a tracked issue,providerProvider adapters, OpenAI-compat presets, upstream API quirksProvider adapters, OpenAI-compat presets, upstream API quirksprovider-compatibilityProvider compatibility reportsProvider compatibility reports
Summary
The Anthropic-to-Responses translation added in #5901 can emit
strict: truefor an incomplete object schema such as{ "type": "object" }.Reproduction
Send an Anthropic Messages request with:
{ "output_config": { "format": { "type": "json_schema", "schema": { "type": "object" } } } }isAnthropicOutputSchemaaccepts this because its compatibility probe normalizes a clone.satisfiesOpenAiStrictSchemathen sees no existingpropertiesmap to inspect, returns true, andformatFromOutputConfigforwards the unchanged schema withstrict: true.Impact
The translated Responses request claims strict compatibility but lacks the required object closure and required-field contract, so a conforming OpenAI Structured Outputs endpoint can reject it instead of applying the intended best-effort fallback.
Official OpenAI documentation requires the root to be an object, every object to use
additionalProperties: false, and every declared field to be required. Unsupported composition must not be marked strict: https://developers.openai.com/api/docs/guides/structured-outputs#supported-schemasExpected behavior
strict: falsefor bare, open, malformed, optional-field, root-union, or unsupported-composition schemas.Regression coverage
Cover the helper, Anthropic inbound translation, and the parsed Responses request, including recursive nested schemas and literal/property names that resemble schema keywords.