Repository navigation
fix: read the output items the ChatGPT backend streams - #256
Merged
Merged
Conversation
The Codex backend now ends every stream with a `response.completed` whose `output` is empty; each item arrives only in its own `response.output_item.done` event. `readResponsesStream` returned the terminal response alone, so every generative call on the subscription failed with "Responses API response had no output text". The call had completed, so it never reached the API-key fallback either. Keep the streamed items by output index and use them when the terminal output is empty. A terminal response that carries its own output, as the public API's does, is returned unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Merged
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.
Problem
The ChatGPT subscription backend (
https://chatgpt.com/backend-api/codex) now ends every Responses stream with aresponse.completedwhoseoutputis[]. Each item (message, function call, reasoning) arrives only in its ownresponse.output_item.doneevent.readResponsesStreamreturned the terminal event's response alone, so every generative role on anauth: "chatgpt"provider failed withResponses API response had no output text. That coversderive,expansion,answer,visionand maintenance. The stream had completed with HTTP 200, so the call never reached thefallbackprovider.A live probe against the backend confirmed the shape. A one-word answer and a single function call each arrived as one
response.output_item.doneevent, followed byresponse.completedwithoutput: [].Fix
response.output_item.doneitems byoutput_index.outputis empty, use the streamed items instead.Tests
ModelClient.chatanswers from an item streamed apart from an emptyresponse.completed. This reproduces the production failure, and the new tests fail onmain.Locally, build, typecheck, lint, knip and
check:repositorypass, and so doeschatgpt.test.ts. Thirteen tests iningest.test.tstime out on PDF extraction in this machine's sandbox. They fail the same way on unmodifiedmain, so CI's macOS runner is the authority there.Changeset:
@tenphi/akno-corepatch (fixed group, so all four packages go to 0.21.1).🤖 Generated with Claude Code