fix(codex): accumulate output items from stream events#2437
Open
grearsl wants to merge 1 commit intosipeed:mainfrom
Open
fix(codex): accumulate output items from stream events#2437grearsl wants to merge 1 commit intosipeed:mainfrom
grearsl wants to merge 1 commit intosipeed:mainfrom
Conversation
The Codex/OpenAI Responses streaming API sends output items via response.output_item.done events during the stream, but the final response.completed event arrives with an empty Output array. This caused all Codex provider responses to return empty content despite the model successfully generating a reply. Fix by accumulating output items as they arrive and merging them into the response when response.completed has none. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
response.output_item.doneevents, but the finalresponse.completedevent arrives with an emptyOutputarrayresponse.completedhas noneReproduction
auth_method: "oauth"(Codex provider)Root cause
In
codex_provider.go, the streaming loop only capturedevt.Responsefrom terminal events (response.completed), but the OpenAI Responses API does not populateResponse.Outputin that event — output items are delivered separately viaresponse.output_item.doneevents.Test plan
gpt-5.4via OAuth — responses now returned correctlygpt-5.3-codexvia OAuth — same fix appliescodex_provider.go)🤖 Generated with Claude Code