Fix ComputerCallResponseItem using Item.Id instead of CallId#7446
Merged
Fix ComputerCallResponseItem using Item.Id instead of CallId#7446
Conversation
The non-streaming and streaming paths for ComputerCallResponseItem were using the response item Id (e.g. cu_123) instead of CallId (e.g. call_456) when constructing ToolCallContent. This made the CallId inconsistent with the corresponding ComputerCallOutputResponseItem's CallId, breaking the call/result pairing. Updated tests to assert the exact CallId value rather than just NotNull. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes tool call/result correlation for OpenAI “computer_use” response items by ensuring ToolCallContent.CallId is derived from the OpenAI call_id field (e.g., call_...) rather than the response item id (e.g., cu_...). This aligns ComputerCallResponseItem tool calls with ComputerCallOutputResponseItem tool results so call/result pairing works consistently across non-streaming and streaming conversions.
Changes:
- Use
ComputerCallResponseItem.CallIdwhen constructingToolCallContentin both batch (non-streaming) and streaming conversion paths. - Tighten tests to assert exact expected
CallIdvalues for computer tool calls in non-streaming and streaming scenarios. - Update conversion tests to match tool call IDs by
call_idrather than response itemid.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/Libraries/Microsoft.Extensions.AI.OpenAI/OpenAIResponsesChatClient.cs |
Switch ToolCallContent construction for ComputerCallResponseItem from Item.Id to CallId in both non-streaming and streaming paths. |
test/Libraries/Microsoft.Extensions.AI.OpenAI.Tests/OpenAIResponseClientTests.cs |
Update assertions to validate ToolCallContent.CallId equals the OpenAI call_id from the recorded payloads. |
test/Libraries/Microsoft.Extensions.AI.OpenAI.Tests/OpenAIConversionTests.cs |
Update expected call IDs and message content selection to use call_... for computer tool calls. |
stephentoub
approved these changes
Apr 2, 2026
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.
The non-streaming and streaming paths for ComputerCallResponseItem were using the response item Id (e.g. cu_123) instead of CallId (e.g. call_456) when constructing ToolCallContent. This made the CallId inconsistent with the corresponding ComputerCallOutputResponseItem's CallId, breaking the call/result pairing.
Microsoft Reviewers: Open in CodeFlow