Skip to content

Add example and docs for reasoning-message pairing constraint (#1791)#1808

Open
iammannu wants to merge 1 commit intoopenai:masterfrom
iammannu:fix/reasoning-pairing
Open

Add example and docs for reasoning-message pairing constraint (#1791)#1808
iammannu wants to merge 1 commit intoopenai:masterfrom
iammannu:fix/reasoning-pairing

Conversation

@iammannu
Copy link
Copy Markdown

@iammannu iammannu commented Apr 1, 2026

Fixes #1791

This PR adds guidance and an example for handling reasoning-message pairing
in multi-turn conversations using the Responses API.

Problem:
The API requires reasoning and message items to be passed as consecutive pairs,
but this is not clearly documented. A common pattern of filtering response.output
to only include messages leads to orphan messages and 400 errors.

Solution:

  • Added an example demonstrating safe handling of response.output
  • Updated documentation to clarify this constraint

This improves developer experience and helps prevent common multi-turn failures.

@iammannu iammannu requested a review from a team as a code owner April 1, 2026 21:38
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ab8a7306c6

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

input: 'Are semicolons optional in JavaScript?',
});

### Multi-turn conversations and reasoning items
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Close the TypeScript code block before new README section

The ### Multi-turn conversations and reasoning items heading is currently inside the preceding ```ts block, so Markdown renders the new guidance as code and makes the example snippet invalid when copied. This defeats the purpose of the documentation update because users won’t see it as prose and may paste broken sample code; insert a closing code fence before this heading.

Useful? React with 👍 / 👎.

@iammannu
Copy link
Copy Markdown
Author

iammannu commented Apr 1, 2026

Opened PR with docs + example for this: #1808

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants