fix(openai): preserve reasoning item boundaries - #39278
Merged
ccurme (ccurme) merged 3 commits intoAug 18, 2026
Merged
Conversation
Alex Onufrak (alexonufrak)
requested review from
ccurme (ccurme) and
Mason Daugherty (mdrxy)
as code owners
August 5, 2026 19:28
Contributor
|
This PR has been automatically closed because it does not link to an approved issue. All external contributions must reference an approved issue or discussion. Opening a PR before maintainer approval and assignment is discouraged. Please:
Maintainers: reopen this PR or remove the |
29 tasks
Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com>
ccurme (ccurme)
approved these changes
Aug 18, 2026
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.
OpenAI Responses users can replay
output_version="v1"messages after LangGraph streaming without losing distinct reasoning items.The v1 projection explodes one Responses reasoning item into adjacent summary fragments.
_implode_reasoning_blockscorrectly reassembled those fragments, but it treated every adjacent reasoning fragment as part of the same item. When a stream contained two consecutive reasoning items, the second item's summary and replay metadata were folded into the first ID. A subsequent Responses tool turn could then be rejected because its required reasoning item was missing.This change only combines fragments whose IDs match. Two legacy fragments that both omit IDs retain the existing grouping behavior, while mixed or differing identities stay separate. The regression coverage also verifies encrypted content, item metadata, native Responses blocks, ordering, and legacy ID-less summaries. The full relevant OpenAI chat-model and Responses-stream unit suites pass with network access disabled.
Release note
Fixed OpenAI Responses replay so consecutive reasoning items keep their own IDs and metadata when converting LangChain v1 content blocks back into provider input.
This contribution was developed with AI-agent assistance and reviewed and tested by the contributor.