openai / openai/openai-openapi

Responses API: undocumented reasoning+message pairing constraint breaks multi-turn conversations across all SDKs

Open
#536 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

api bug enhancement specification
Dominant language
No language data
Stars
2.5k
Forks
527
Avg merge
1h 46m
Merged PRs (30d)
2

Description

Impact

Reasoning+message items must appear as consecutive pairs in input, but the spec doesn't document this. Filtering output items in any natural way silently produces orphaned items → 400 on the next turn. Affects all SDK languages identically.

This broke OpenClaw (64.9k forks) on gpt-5.3-codex. Required 3 PRs (#49301, #50852, #51358) and a dedicated downgradeOpenAIReasoningBlocks() workaround.

Also reported in:

  • openai/openai-python#2561: open since Aug 2025, no fix
  • openai/openai-agents-python#1660: Agents SDK breaks on GPT-5 + tool calls
  • pydantic/pydantic-ai#3230: downstream breakage
  • Community threads: 1, 2, 3

Root cause

The spec tells you to include reasoning items in input but doesn't document the pairing constraint:

  1. ReasoningItem description says "include these in your input" but doesn't say they must be consecutive pairs with message items. Sending a message without its preceding reasoning → 400. This is the OpenClaw bug.
  2. ItemResource (output schema) omits ReasoningItem (#491). The API returns reasoning items in responses, but the output type doesn't model them — so SDKs lack proper typing for the round-trip.
  3. EasyInputMessage.content only accepts string | InputMessageContentList — no output_text (#475). Can't pass assistant output back through the easy message path.

Repro

Tested in JS (v6.32.0), Python (v2.29.0), Go (v3.29.0), Java (v4.29.0), .NET (v2.9.1). Identical results — this is API-level, not SDK-specific:

Model A (all items) B (msgs only)
gpt-5.3-codex (reasoning=high) PASS FAIL
o4-mini PASS FAIL*

* Nondeterministic — o4-mini sometimes returns reasoning-only output (no message to orphan). Codex with reasoning=high reliably returns both items.

400: Item 'msg_...' of type 'message' was provided without its required preceding item of type 'reasoning'

SDK-specific issues:

  • openai/openai-python#3009 (Python)
  • openai/openai-node#1791 (Node/TypeScript)
  • openai/openai-dotnet#1050 (.NET)
  • openai/openai-go#631 (Go)
  • openai/openai-java#710 (Java)

Full cross-language repro guide (JS, Python, .NET, curl): https://gist.github.com/achandmsft/57886350885cec3af8ef3f456ed529cf

Fixes needed

  1. Document the reasoning+message pairing constraint in the spec
  2. Add ReasoningItem to ItemResource (#491)
  3. Accept output_text in EasyInputMessage (#475)
  4. Document item_reference as the preferred pattern for service-persisted items
  5. Add .toInput() / .as_input() helpers in SDKs to make the round-trip safe

Environment

  • openai Python v2.29.0, TypeScript v6.32.0, Go v3.29.0, .NET v2.9.1, Java v4.29.0
  • Tested on api.openai.com, March 2026

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Responses API definitions for ReasoningItem, ItemResource, and EasyInputMessage, then compare them with the linked cross-language repro and SDK-specific issues. Verify how the specification represents reasoning and message items, including item_reference and output_text. Done means the pairing constraint and supported round-trip shapes are documented and the identified schema gaps are addressed.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, go, java, openapi, python, typescript
Domain
api, backend-api-design, documentation
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.