Skip to content

fix: include response.output on /v1/responses response.completed for streamed turns - #120

Merged
KochC merged 1 commit into
mainfrom
fix/responses-completed-output
Nov 11, 2026
Merged

KochC merged 1 commit into
mainfrom
fix/responses-completed-output

Conversation

@KochC

@KochC KochC commented Nov 11, 2026

Copy link
Copy Markdown
Owner

Problem

Both streaming branches of POST /v1/responses omitted the final output array from the response.completed event, even though response.created always sends one (empty).

Client SDKs that aggregate the turn from response.output — e.g. langchainjs-openai, which does response.output.map(...) — crash on undefined.

Fix

  • Tool-call branch: collects the completed function_call items it already emits via response.output_item.done and includes them as output.
  • Text branch: builds the completed assistant message (with its output_text content) and sends it as the single output entry. Its response.output_item.done now carries that same content instead of a bare message stub.

This matches the non-streaming createResponsesApiResponse() shape, which already includes output.

Tests

  • Added regression tests for both the text and tool-call streaming paths asserting response.completed.data.response.output.
  • Updated the stream conformance fixture for openai-responses to reflect the new payload.

Notes

The original attempt at this (branch fix/responses-output-and-idle-timeout) never landed; its still-relevant half is this output fix. The Bun idle-timeout half is already on main.

…streamed turns

Both streaming branches of POST /v1/responses omitted the final `output`
array from response.completed, even though response.created always sends one
(empty). Client SDKs that aggregate the turn from response.output - e.g.
langchainjs-openai, which does `response.output.map(...)` - crashed on
undefined.

The tool-call branch now collects the completed function_call items it already
emits via response.output_item.done and includes them as `output`. The text
branch builds the completed assistant message (with its output_text content)
and sends it as the single `output` entry; response.output_item.done for the
text turn now carries that same content instead of a bare message stub.

Updated the stream conformance fixture and added regression tests asserting
response.completed.data.response.output for both the text and tool-call paths.
@KochC
KochC merged commit 09224c0 into main Nov 11, 2026
4 checks passed
@KochC
KochC deleted the fix/responses-completed-output branch November 11, 2026 00:44
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.

1 participant