Skip to content

fix(responses): correct finalResponse error message and drop duplicate spread - #2045

Closed
pouyashahrdami wants to merge 1 commit into
openai:mainfrom
pouyashahrdami:fix/responses-helper-cleanups
Closed

fix(responses): correct finalResponse error message and drop duplicate spread#2045
pouyashahrdami wants to merge 1 commit into
openai:mainfrom
pouyashahrdami:fix/responses-helper-cleanups

Conversation

@pouyashahrdami

Copy link
Copy Markdown

What

Two small fixes in the handwritten Responses helpers (src/lib/):

  1. ResponseStream.finalResponse() reported the wrong type. When the stream ends without producing a result, it threw OpenAIError('stream ended without producing a ChatCompletion') and its JSDoc read ...without producing a REsponse. This helper returns a Response, not a ChatCompletion — the message was copied from the Chat Completions helper. Corrected both the thrown message and the doc typo.

  2. Removed a redundant duplicate ...toolCall spread in ResponsesParser.parseToolCall. The object literal spread toolCall twice ({ ...toolCall, ...toolCall, parsed_arguments }). Spreading the same object twice is identical to spreading it once, so this is a pure no-op cleanup. It has been present since the file was first added.

Why

The ChatCompletion wording is misleading when debugging Responses streaming, and the duplicate spread is dead code.

Testing

  • prettier --check and eslint pass on both files.
  • tsc typechecks cleanly.
  • Existing tests/lib/ResponseStream.test.ts and tests/lib/ResponsesParser*.test.ts suites pass.

No behavioral change beyond the corrected error string.

…e spread

- ResponseStream.finalResponse() threw/documented 'ChatCompletion' when it
  returns a Response; the message was copied from the Chat Completions helper.
- Remove a redundant duplicate `...toolCall` spread in ResponsesParser's
  parseToolCall (no behavioral change; {...x, ...x} equals {...x}).
@pouyashahrdami
pouyashahrdami requested a review from a team as a code owner August 3, 2026 03:38
@pouyashahrdami

Copy link
Copy Markdown
Author

Closing in favor of #2022, which already fixes the same finalResponse() error message and docstring typo (and does more). The only unique piece here was a no-op duplicate-spread cleanup, not worth a separate PR.

@pouyashahrdami
pouyashahrdami deleted the fix/responses-helper-cleanups branch August 3, 2026 03:48
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