From c0bd2a33ebdf00a2920b4e5282688da190f6bd36 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 13 May 2026 22:00:48 +0000 Subject: [PATCH] Add PlanSignoff_Disabled_Proceeds_Immediately E2E test Agent-Logs-Url: https://github.com/microsoft/agent-framework/sessions/6e8bca46-448d-4f21-a7e9-240179571970 Co-authored-by: lokitoth <6936551+lokitoth@users.noreply.github.com> --- .../MagenticOrchestrationTests.cs | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/MagenticOrchestrationTests.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/MagenticOrchestrationTests.cs index 5e1c596da5..2872af66bb 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/MagenticOrchestrationTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/MagenticOrchestrationTests.cs @@ -220,6 +220,45 @@ public class MagenticOrchestrationTests ledgerEvent.ProgressLedger.IsRequestSatisfied.Should().BeTrue(); } + [Fact] + public async Task PlanSignoff_Disabled_Proceeds_Immediately() + { + // Arrange: requirePlanSignoff=false should mean no plan review request + List factsResponse = CreatePlanResponse("Task facts"); + List planResponse = CreatePlanResponse("Step 1: Execute immediately"); + List progressLedgerResponse = CreateProgressLedgerResponse( + isRequestSatisfied: true, + isInLoop: false, + isProgressBeingMade: true, + nextSpeaker: "Worker", + instructionOrQuestion: "Go"); + List finalAnswerResponse = CreateFinalAnswerResponse("Immediate completion"); + + TestReplayAgent manager = new( + [factsResponse, planResponse, progressLedgerResponse, finalAnswerResponse], + name: "Manager"); + TestEchoAgent worker = new(name: "Worker"); + + List collectedEvents = []; + + Workflow workflow = new MagenticWorkflowBuilder(manager) + .AddParticipants(worker) + .RequirePlanSignoff(false) + .Build(); + + // Act + WorkflowRunResult runResult = await RunMagenticWorkflowAsync( + workflow, + [new ChatMessage(ChatRole.User, "Do it now")], + eventCollector: collectedEvents); + + // Assert: No plan review request, workflow completes immediately + runResult.PendingRequests.Should().BeEmpty("plan signoff is disabled, so no review should be requested"); + collectedEvents.OfType().Should().BeEmpty(); + runResult.Result.Should().NotBeNull(); + runResult.Result![0].Text.Should().Contain("Immediate completion"); + } + #region Helper Methods private sealed record WorkflowRunResult(