mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
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>
This commit is contained in:
committed by
GitHub
Unverified
parent
8a6a5948ed
commit
c0bd2a33eb
@@ -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<ChatMessage> factsResponse = CreatePlanResponse("Task facts");
|
||||
List<ChatMessage> planResponse = CreatePlanResponse("Step 1: Execute immediately");
|
||||
List<ChatMessage> progressLedgerResponse = CreateProgressLedgerResponse(
|
||||
isRequestSatisfied: true,
|
||||
isInLoop: false,
|
||||
isProgressBeingMade: true,
|
||||
nextSpeaker: "Worker",
|
||||
instructionOrQuestion: "Go");
|
||||
List<ChatMessage> finalAnswerResponse = CreateFinalAnswerResponse("Immediate completion");
|
||||
|
||||
TestReplayAgent manager = new(
|
||||
[factsResponse, planResponse, progressLedgerResponse, finalAnswerResponse],
|
||||
name: "Manager");
|
||||
TestEchoAgent worker = new(name: "Worker");
|
||||
|
||||
List<WorkflowEvent> 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<RequestInfoEvent>().Should().BeEmpty();
|
||||
runResult.Result.Should().NotBeNull();
|
||||
runResult.Result![0].Text.Should().Contain("Immediate completion");
|
||||
}
|
||||
|
||||
#region Helper Methods
|
||||
|
||||
private sealed record WorkflowRunResult(
|
||||
|
||||
Reference in New Issue
Block a user