Skip to content

Conversation

@peibekwe
Copy link
Contributor

This is a rebase of PR #3021 to main. Initial description of the change is copied below and the credit for this change goes to Chris (The original PR author).

Motivation and Context

Ensures media-type and message id are persisted when converting between ChatMessage and the object model representation.

Fixes: #3020

Description

  • Makes use of update to Object Model update that supports MediaType
  • Tests added

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

@markwallace-microsoft markwallace-microsoft added .NET workflows Related to Workflows in agent-framework labels Jan 29, 2026
@github-actions github-actions bot changed the title Workflows - Support fidelity when converting to and from ChatMessage in declarative workflows .NET: Workflows - Support fidelity when converting to and from ChatMessage in declarative workflows Jan 29, 2026
@peibekwe peibekwe marked this pull request as ready for review January 29, 2026 18:38
Copilot AI review requested due to automatic review settings January 29, 2026 18:38
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 adds support for preserving MediaType and MessageId properties when converting between ChatMessage objects and their record representations in declarative workflows. The changes enable better fidelity in round-trip conversions, though the implementation relies partially on inference rather than explicit persistence.

Changes:

  • Added MessageId preservation when converting from records to ChatMessage
  • Added MediaType parameter support and inference logic for content conversion
  • Added comprehensive round-trip unit tests for ChatMessage conversions
  • Updated integration tests to support two workflow variants (conversation and auto-send)

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
ChatMessageExtensions.cs Added System.IO import, MessageId extraction, MediaType parameter handling, and InferMediaType helper method
AddConversationMessageExecutor.cs Updated ToContent call to pass MediaType from content model
ChatMessageExtensionsTests.cs Added round-trip tests for ChatMessage as Record and Table, with custom equivalence assertions
MediaInputTest.cs Refactored to test two workflow variants, updated test parameters and assertions
MediaInputConversation.yaml New workflow using conversation-based message handling
MediaInputAutoSend.yaml New workflow using autoSend for message handling

@peibekwe peibekwe added this pull request to the merge queue Jan 29, 2026
github-merge-queue bot pushed a commit that referenced this pull request Jan 29, 2026
…ssage in declarative workflows (#3505)

* Builds locally and tests pass

* Fix typo

* Updated

* Updated

* Fixed tests failing on net472 but not on dotnet10

---------

Co-authored-by: Chris Rickman <[email protected]>
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

.NET workflows Related to Workflows in agent-framework

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.NET Workflows - Make use of MediaType property for message content for Declarative Workflows

6 participants