From 6a441e38eec1dad5efa9c2f377d4e6633996491c Mon Sep 17 00:00:00 2001 From: Yufeng He <40085740+he-yufeng@users.noreply.github.com> Date: Tue, 12 May 2026 19:59:21 +0800 Subject: [PATCH] fix: declare Magentic protocol messages --- .../Magentic/MagenticOrchestrator.cs | 5 +++- .../MagenticOrchestratorTests.cs | 26 +++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/MagenticOrchestratorTests.cs diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows/Specialized/Magentic/MagenticOrchestrator.cs b/dotnet/src/Microsoft.Agents.AI.Workflows/Specialized/Magentic/MagenticOrchestrator.cs index afd4e606e9..a08e0b542e 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows/Specialized/Magentic/MagenticOrchestrator.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows/Specialized/Magentic/MagenticOrchestrator.cs @@ -98,7 +98,10 @@ internal class MagenticOrchestrator(AIAgent managerAgent, List team, Ta protected override ProtocolBuilder ConfigureProtocol(ProtocolBuilder protocolBuilder) { - return base.ConfigureProtocol(protocolBuilder).ConfigureRoutes(ConfigureRoutes); + return base.ConfigureProtocol(protocolBuilder) + .SendsMessage() + .SendsMessage() + .ConfigureRoutes(ConfigureRoutes); void ConfigureRoutes(RouteBuilder routeBuilder) => routeBuilder.AddPortHandler( "RequestPlanReview", diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/MagenticOrchestratorTests.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/MagenticOrchestratorTests.cs new file mode 100644 index 0000000000..db091c9a95 --- /dev/null +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/MagenticOrchestratorTests.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft. All rights reserved. + +using System.Collections.Generic; +using FluentAssertions; +using Microsoft.Agents.AI.Workflows.Specialized.Magentic; +using Microsoft.Extensions.AI; + +namespace Microsoft.Agents.AI.Workflows.UnitTests; + +public class MagenticOrchestratorTests +{ + [Fact] + public void Test_MagenticOrchestrator_Protocol_Declares_SentMessages() + { + TestReplayAgent manager = new(name: nameof(MagenticOrchestrator)); + TestEchoAgent participant = new(name: "Echo"); + MagenticOrchestrator orchestrator = new(manager, [participant], new(), requirePlanSignoff: false); + + ProtocolDescriptor protocol = orchestrator.DescribeProtocol(); + + protocol.Sends.Should().Contain(typeof(List)); + protocol.Sends.Should().Contain(typeof(ChatMessage)); + protocol.Sends.Should().Contain(typeof(TurnToken)); + protocol.Sends.Should().Contain(typeof(ResetChatSignal)); + } +}