Skip to content

Fix ComputerCallResponseItem using Item.Id instead of CallId#7446

Merged
jozkee merged 1 commit intomainfrom
dacantu/computer-call-id
Apr 2, 2026
Merged

Fix ComputerCallResponseItem using Item.Id instead of CallId#7446
jozkee merged 1 commit intomainfrom
dacantu/computer-call-id

Conversation

@jozkee
Copy link
Copy Markdown
Member

@jozkee jozkee commented Apr 2, 2026

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

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>
@jozkee jozkee requested a review from stephentoub April 2, 2026 20:26
@jozkee jozkee requested a review from a team as a code owner April 2, 2026 20:26
Copilot AI review requested due to automatic review settings April 2, 2026 20:26
@github-actions github-actions Bot added the area-ai Microsoft.Extensions.AI libraries label Apr 2, 2026
Copy link
Copy Markdown
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

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.CallId when constructing ToolCallContent in both batch (non-streaming) and streaming conversion paths.
  • Tighten tests to assert exact expected CallId values for computer tool calls in non-streaming and streaming scenarios.
  • Update conversion tests to match tool call IDs by call_id rather than response item id.

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.

@jozkee jozkee enabled auto-merge (squash) April 2, 2026 20:37
@jozkee jozkee merged commit 138bfd4 into main Apr 2, 2026
12 checks passed
@jozkee jozkee deleted the dacantu/computer-call-id branch April 2, 2026 21:36
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.

4 participants