Skip to content

.NET: Fix declarative resume edge predicates to recognize both direct and PortableValue-wrapped forms after checkpoint restore#5323

Merged
peibekwe merged 4 commits intomainfrom
peibekwe/declarative-portable-value-fix
Apr 17, 2026
Merged

.NET: Fix declarative resume edge predicates to recognize both direct and PortableValue-wrapped forms after checkpoint restore#5323
peibekwe merged 4 commits intomainfrom
peibekwe/declarative-portable-value-fix

Conversation

@peibekwe
Copy link
Copy Markdown
Contributor

@peibekwe peibekwe commented Apr 17, 2026

Motivation and Context

After a JSON checkpoint round-trip, queued messages are restored as PortableValue wrappers. Edge predicates in evaluate Message directly, so predicates like RequiresInput and RequiresNothing fail to match path.

Fixes #5307

Description

  • Update impacted declarative edge predicates to handle PortableValue. Also harden ActionExecutorResult to unwrap PortableValue as a second line of defense once a message reaches the target executor path.
  • Added relevant unit tests.

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.

@moonbox3 moonbox3 added .NET workflows Related to Workflows in agent-framework labels Apr 17, 2026
@github-actions github-actions Bot changed the title Fix declarative resume edge predicates to recognize both direct and PortableValue-wrapped forms after checkpoint restore .NET: Fix declarative resume edge predicates to recognize both direct and PortableValue-wrapped forms after checkpoint restore Apr 17, 2026
@peibekwe peibekwe marked this pull request as ready for review April 17, 2026 05:46
Copilot AI review requested due to automatic review settings April 17, 2026 05:46
@peibekwe peibekwe requested review from alliscode and lokitoth April 17, 2026 05:47
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 declarative workflow resume routing after JSON checkpoint restore by ensuring edge predicates and executor result handling recognize PortableValue-wrapped messages, preventing mismatched transitions and “no handler found” failures.

Changes:

  • Updated declarative edge predicates (RequiresInput / RequiresNothing) to match both direct messages and PortableValue-wrapped equivalents.
  • Hardened ActionExecutorResult.ThrowIfNot to unwrap PortableValue-wrapped ActionExecutorResult instances.
  • Added unit tests covering predicate behavior and ThrowIfNot unwrapping/throwing scenarios.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/ObjectModel/InvokeAzureAgentExecutor.cs Makes routing predicates tolerant of PortableValue-wrapped ExternalInputRequest / ActionExecutorResult.
dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/ObjectModel/InvokeMcpToolExecutor.cs Aligns MCP tool executor routing predicates with checkpoint-restored PortableValue wrappers.
dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Kit/ActionExecutorResult.cs Unwraps PortableValue in ThrowIfNot as a defensive backstop when messages reach executors.
dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Kit/PortableValuePredicateTests.cs Adds targeted unit coverage for PortableValue predicate matching and result unwrapping behavior.

peibekwe and others added 2 commits April 16, 2026 23:00
…ts/Kit/PortableValuePredicateTests.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ts/Kit/PortableValuePredicateTests.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@peibekwe peibekwe self-assigned this Apr 17, 2026
@peibekwe peibekwe added this pull request to the merge queue Apr 17, 2026
Merged via the queue into main with commit c85d24d Apr 17, 2026
21 checks passed
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: [Bug]: Declarative workflow throws NotSupportedException when resumed from JSON checkpoint

5 participants