Skip to content

Conversation

@stephentoub
Copy link
Member

@stephentoub stephentoub commented Nov 25, 2025

@stephentoub stephentoub requested a review from a team as a code owner November 25, 2025 22:43
Copilot AI review requested due to automatic review settings November 25, 2025 22:43
@github-actions github-actions bot added the area-ai Microsoft.Extensions.AI libraries label Nov 25, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements a workaround for an OpenAI SDK bug where streaming error events are sent in a format different from the documented specification. The OpenAI service embeds error information in a nested error object, but the SDK deserializes it at the top level, causing the properties to be null.

Key changes:

  • Added fallback logic to extract error details from raw JSON when SDK deserialization fails
  • Added comprehensive test coverage for three error format scenarios: documented format, actual undocumented format, and missing error information

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/Libraries/Microsoft.Extensions.AI.OpenAI/OpenAIResponsesChatClient.cs Implements workaround to extract error information from raw JSON Patch when OpenAI SDK fails to deserialize error properties correctly
test/Libraries/Microsoft.Extensions.AI.OpenAI.Tests/OpenAIResponseClientTests.cs Adds three test cases validating error parsing for documented format, undocumented/alternative format, and graceful handling when no error information is present

@stephentoub stephentoub merged commit cffc5cb into dotnet:main Nov 26, 2025
12 of 13 checks passed
@stephentoub stephentoub deleted the fixerrorinfo branch November 26, 2025 22:14
@bryansusu
Copy link

Thanks a lot for fixing this, looking forward to test it.
When is this fix scheduled for release?

@stephentoub
Copy link
Member Author

Should be Tuesday

This was referenced Dec 11, 2025
This was referenced Dec 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-ai Microsoft.Extensions.AI libraries

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Empty ErrorContent object

3 participants