Skip to content

Conversation

@stephentoub
Copy link
Member

@stephentoub stephentoub commented Oct 20, 2025

Microsoft Reviewers: Open in CodeFlow

@stephentoub stephentoub requested a review from a team as a code owner October 20, 2025 16:56
Copilot AI review requested due to automatic review settings October 20, 2025 16:56
@github-actions github-actions bot added the area-ai Microsoft.Extensions.AI libraries label Oct 20, 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 fixes a bug in the coalescing logic for TextReasoningContent objects that contain ProtectedData. The issue was that when merging consecutive TextReasoningContent items, the ProtectedData from the last item in a merge sequence was not being preserved in the coalesced result.

Key changes:

  • Updated the merge factory function to preserve ProtectedData from the last item in a merge sequence
  • Added debug assertions to validate merge preconditions
  • Added comprehensive test coverage for the new coalescing behavior with ProtectedData

Reviewed Changes

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

File Description
ChatResponseExtensions.cs Fixed the coalescing logic to preserve ProtectedData from the last item when merging TextReasoningContent, and added debug assertions
ChatResponseUpdateExtensionsTests.cs Added test case verifying correct coalescing behavior when TextReasoningContent items have ProtectedData

Copy link
Member

@jeffhandley jeffhandley left a comment

Choose a reason for hiding this comment

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

I appreciate the Debug.Asserts there.

@stephentoub stephentoub merged commit 9ad9b28 into dotnet:main Oct 20, 2025
7 checks passed
jeffhandley pushed a commit to jeffhandley/extensions that referenced this pull request Oct 21, 2025
jeffhandley pushed a commit to jeffhandley/extensions that referenced this pull request Oct 21, 2025
jeffhandley pushed a commit to jeffhandley/extensions that referenced this pull request Oct 21, 2025
This was referenced Nov 13, 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.

2 participants