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

* Fix declarative workflows edge predicates after checkpoint restore

* Update test names to  make them clearer and more discoverable.

* Update dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Kit/PortableValuePredicateTests.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Kit/PortableValuePredicateTests.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Peter Ibekwe
2026-04-17 08:18:15 -07:00
committed by GitHub
Unverified
parent b03cb324d5
commit c85d24da44
4 changed files with 206 additions and 4 deletions
@@ -27,9 +27,11 @@ internal sealed class InvokeAzureAgentExecutor(InvokeAzureAgent model, ResponseA
public static string Resume(string id) => $"{id}_{nameof(Resume)}";
}
public static bool RequiresInput(object? message) => message is ExternalInputRequest;
public static bool RequiresInput(object? message) =>
message is ExternalInputRequest || (message is PortableValue pv && pv.IsType(out ExternalInputRequest? _));
public static bool RequiresNothing(object? message) => message is ActionExecutorResult;
public static bool RequiresNothing(object? message) =>
message is ActionExecutorResult || (message is PortableValue pv && pv.IsType(out ActionExecutorResult? _));
private AzureAgentUsage AgentUsage => Throw.IfNull(this.Model.Agent, $"{nameof(this.Model)}.{nameof(this.Model.Agent)}");
private AzureAgentInput? AgentInput => this.Model.Input;
@@ -46,12 +46,14 @@ internal sealed class InvokeMcpToolExecutor(
/// <summary>
/// Determines if the message indicates external input is required.
/// </summary>
public static bool RequiresInput(object? message) => message is ExternalInputRequest;
public static bool RequiresInput(object? message) =>
message is ExternalInputRequest || (message is PortableValue pv && pv.IsType(out ExternalInputRequest? _));
/// <summary>
/// Determines if the message indicates no external input is required.
/// </summary>
public static bool RequiresNothing(object? message) => message is ActionExecutorResult;
public static bool RequiresNothing(object? message) =>
message is ActionExecutorResult || (message is PortableValue pv && pv.IsType(out ActionExecutorResult? _));
/// <inheritdoc/>
protected override bool EmitResultEvent => false;