Skip to content

.NET: Workflows - Support fidelity when converting to and from ChatMessage in declarative workflows - #3505

Merged
Peter Ibekwe (peibekwe) merged 7 commits into
mainfrom
crickman/messaging-handling-fix-declarative-workflows
Jan 30, 2026
Merged

.NET: Workflows - Support fidelity when converting to and from ChatMessage in declarative workflows#3505
Peter Ibekwe (peibekwe) merged 7 commits into
mainfrom
crickman/messaging-handling-fix-declarative-workflows

Conversation

@peibekwe

Copy link
Copy Markdown
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-microsoftMark Wallace (markwallace-microsoft) added .NET Usage: [Issues, PRs], Target: .Net workflows Usage: [Issues, PRs], Target: Workflows labels Jan 29, 2026
@github-actionsgithub-actionsBot 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 workflowsJan 29, 2026
@peibekwe
Peter Ibekwe (peibekwe) marked this pull request as ready for review January 29, 2026 18:38
CopilotAI review requested due to automatic review settings January 29, 2026 18:38

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

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
FileDescription
ChatMessageExtensions.csAdded System.IO import, MessageId extraction, MediaType parameter handling, and InferMediaType helper method
AddConversationMessageExecutor.csUpdated ToContent call to pass MediaType from content model
ChatMessageExtensionsTests.csAdded round-trip tests for ChatMessage as Record and Table, with custom equivalence assertions
MediaInputTest.csRefactored to test two workflow variants, updated test parameters and assertions
MediaInputConversation.yamlNew workflow using conversation-based message handling
MediaInputAutoSend.yamlNew workflow using autoSend for message handling

@peibekwe
Peter Ibekwe (peibekwe) added this pull request to the merge queueJan 29, 2026
github-merge-queueBot 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 <crickman@microsoft.com>
@github-merge-queue
github-merge-queueBot removed this pull request from the merge queue due to failed status checks Jan 30, 2026
@peibekwe
Peter Ibekwe (peibekwe) added this pull request to the merge queueJan 30, 2026
Merged via the queue into main with commit ff7041bJan 30, 2026
26 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

.NETUsage: [Issues, PRs], Target: .NetworkflowsUsage: [Issues, PRs], Target: Workflows

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

@peibekwe@TaoChenOSU@alliscode@markwallace-microsoft@crickman