From 6dc748e12ef94bc8c2b9608a40a4e3ec85ec8119 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 14 May 2026 02:23:01 +0000 Subject: [PATCH] Update error messages per review comments in MagenticOrchestrator and MagenticWorkflowBuilder Agent-Logs-Url: https://github.com/microsoft/agent-framework/sessions/053e5ded-81e3-4e56-acf1-2a8a939a04b0 Co-authored-by: lokitoth <6936551+lokitoth@users.noreply.github.com> --- .../Microsoft.Agents.AI.Workflows/MagenticWorkflowBuilder.cs | 2 +- .../Specialized/Magentic/MagenticOrchestrator.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows/MagenticWorkflowBuilder.cs b/dotnet/src/Microsoft.Agents.AI.Workflows/MagenticWorkflowBuilder.cs index ad620f6fc1..4470c4ee9a 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows/MagenticWorkflowBuilder.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows/MagenticWorkflowBuilder.cs @@ -145,7 +145,7 @@ public class MagenticWorkflowBuilder(AIAgent managerAgent) { if (this._team.Count == 0) { - throw new InvalidOperationException("At least one participant must be added before building a Magentic workflow."); + throw new InvalidOperationException("At least one participant must be added via AddParticipants() before building the workflow."); } return this.ReduceToWorkflowBuilder().Build(); 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 f18106b4d4..30a93c6850 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows/Specialized/Magentic/MagenticOrchestrator.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows/Specialized/Magentic/MagenticOrchestrator.cs @@ -147,7 +147,7 @@ internal class MagenticOrchestrator(AIAgent managerAgent, List team, Ta if (this._taskContext.IsTerminated) { - throw new InvalidOperationException("Magentic Orchestration has already been terminated and cannot process new messages. Please start a new session."); + throw new InvalidOperationException("This Magentic orchestration has already terminated. To process new messages, create a new workflow instance."); } if (response.IsApproved) @@ -190,7 +190,7 @@ internal class MagenticOrchestrator(AIAgent managerAgent, List team, Ta { if (this._taskContext?.IsTerminated == true) { - throw new InvalidOperationException("Magentic Orchestration has already been terminated and cannot process new messages. Please start a new session."); + throw new InvalidOperationException("This Magentic orchestration has already terminated. To process new messages, create a new workflow instance."); } if (this._taskContext == null)