Skip to content

.NET: Clarify declarative workflow input serialization - #8046

Merged
Vincent Biret (baywet) merged 2 commits into
microsoft:mainfrom
UniversePeak:fix/8016-declarative-input-serialization
Sep 4, 2026
Merged

.NET: Clarify declarative workflow input serialization#8046
Vincent Biret (baywet) merged 2 commits into
microsoft:mainfrom
UniversePeak:fix/8016-declarative-input-serialization

Conversation

@UniversePeak

Copy link
Copy Markdown
Contributor

Motivation & Context

Issue #8016 reports that typed inputs to declarative workflows fall back to ToString(), while the documentation's serializer example focuses on checkpoint state. This makes it unclear how to reliably serialize an initial input and can lead to confusing expectations that checkpoint serializer registration also transforms that input.

Description & Review Guide

  • What are the major changes?
    • Update the AOT checkpointing sample to pass a typed WorkflowInput through DeclarativeWorkflowBuilder.Build with an explicit inputTransform.
    • Add a source-generated JsonSerializerContext for the sample's initial input and serialize it into a ChatMessage.
    • Document the separate responsibilities of inputTransform and checkpoint JsonSerializerOptions, including how to register user-defined checkpoint payloads.
  • What is the impact of these changes?
    • The sample provides a tested, copyable path for deterministic typed-input serialization under reflection-disabled System.Text.Json.
    • The documentation now makes clear that checkpoint serializer registration does not automatically transform the initial workflow input.
  • What do you want reviewers to focus on?
    • Whether the distinction between initial-input transformation and checkpoint-state serialization is clear and accurately reflects the current API behavior.

Related Issue

Fixes #8016

Contribution Checklist

  • The code builds clean without any errors or warnings
  • All unit tests pass, and I have added new tests where possible
  • The PR follows the Contribution Guidelines
  • This PR is linked to an issue and there is no other open PR for this issue (see Related Issue above).
  • This is not a breaking change. If it is a breaking change, add the breaking change label (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.

Copilot AI balanced review requested due to automatic review settings September 4, 2026 00:30
@agent-framework-automation agent-framework-automation Bot added documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs .NET Usage: [Issues, PRs], Target: .Net workflows Usage: [Issues, PRs], Target: Workflows labels Sep 4, 2026

Copilot AI 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.

🟡 Changes recommended

The new copyable README snippet is missing the namespace import required for Workflow.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Clarifies typed-input serialization for declarative .NET workflows under AOT constraints.

Changes:

  • Adds a source-generated serializer context and explicit input transform.
  • Documents the distinction between input transformation and checkpoint serialization.
File summaries
File Description
README.md Documents typed inputs and checkpoint serialization.
Program.cs Demonstrates AOT-safe typed-input serialization.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Balanced

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment thread dotnet/samples/03-workflows/Declarative/AotCheckpointing/README.md

@baywet Vincent Biret (baywet) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you for making the changes!

Copilot AI 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.

🟢 Approval recommended

The sample and documentation accurately reflect the current declarative workflow API behavior.

Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

auto-merge was automatically disabled September 4, 2026 18:47

Head branch was pushed to by a user without write access

@UniversePeak
宇宙的山峰 (UniversePeak) force-pushed the fix/8016-declarative-input-serialization branch from 38d13d4 to d5edf33 Compare September 4, 2026 18:47
@baywet
Vincent Biret (baywet) added this pull request to the merge queue Sep 4, 2026
Merged via the queue into microsoft:main with commit cc8c1fa Sep 4, 2026
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs .NET Usage: [Issues, PRs], Target: .Net workflows Usage: [Issues, PRs], Target: Workflows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.NET: [Bug]: serialization related bugs/inconsistency in implementation or documentation

3 participants