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>
7.3 KiB
Magentic E2E Implementation Review
Review Scope
This review compares the current implementation against the original plan in MagenticE2E_TestPlan.md.
Reviewed files:
dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/MagenticE2E_TestPlan.mddotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/MagenticOrchestrationTests.csdotnet/src/Microsoft.Agents.AI.Workflows/Specialized/Magentic/MagenticOrchestrator.cs
Summary
The current changes implement a significant subset of the Magentic E2E test plan and also fix one production bug uncovered by the first E2E test. The implemented tests run against fully-built MagenticWorkflowBuilder.Build() workflows and cover the core orchestrator branches: basic completion, plan signoff disabled, plan approval, plan revision/replan, multi-round delegation, empty and invalid next speaker handling, progress ledger event emission, round limit termination, and stall-triggered reset.
The plan estimated roughly 31 tests across all categories. The current implementation contains 11 E2E tests.
Production Code Change
MagenticOrchestrator output declaration
Implemented:
MagenticOrchestrator.ConfigureProtocol()now declares.YieldsOutput<List<ChatMessage>>().
Assessment:
- This is a valid fix.
MagenticOrchestrator.PrepareFinalAnswerAsync()yieldsList<ChatMessage>viacontext.YieldOutputAsync(...), but the protocol previously did not declare that output type. - Without this declaration, a fully-built workflow failed at runtime with an error like:
Cannot output object of type List'1. Expecting one of []. - This fix aligns the protocol declaration with existing orchestrator behavior.
Implemented Test Coverage
| Original Plan Area | Planned Test | Implemented Test | Status |
|---|---|---|---|
| Happy Path | Task_Completes_When_RequestSatisfied |
Task_Completes_When_RequestSatisfied |
✅ Complete |
| Happy Path | PlanSignoff_Disabled_Proceeds_Immediately |
PlanSignoff_Disabled_Proceeds_Immediately |
✅ Complete |
| Happy Path | Task_Completes_After_Multiple_Rounds |
Task_Completes_After_Multiple_Rounds |
✅ Complete |
| Plan Review | PlanReview_Approved_Proceeds |
PlanReview_Approved_Proceeds |
✅ Complete |
| Plan Review | PlanReview_Revised_Triggers_Replan |
PlanReview_Revised_Triggers_Replan |
✅ Complete |
| Limit Enforcement | MaxRoundLimit_Terminates_Workflow |
MaxRoundLimit_Terminates_Workflow |
✅ Complete |
| Stall Detection | MaxStallCount_Triggers_Reset |
MaxStallCount_Triggers_Reset |
✅ Complete |
| Next Speaker | NextSpeaker_Empty_Falls_Back_To_First |
NextSpeaker_Empty_Falls_Back_To_First |
✅ Complete |
| Next Speaker | NextSpeaker_Invalid_Triggers_FinalAnswer |
NextSpeaker_Invalid_Triggers_FinalAnswer |
✅ Complete |
| Event Emission | Initial_Plan_Emits_PlanCreatedEvent |
Initial_Plan_Emits_PlanCreatedEvent |
✅ Complete |
| Progress Ledger / Events | ProgressLedger_Updated_Event_Emitted |
ProgressLedger_Updated_Event_Emitted |
✅ Complete |
Original Plan Coverage Status
1. Happy Path Tests (3 of 4 implemented)
Implemented:
Task_Completes_When_RequestSatisfiedPlanSignoff_Disabled_Proceeds_ImmediatelyTask_Completes_After_Multiple_Rounds
Not yet implemented:
Task_Delegates_To_Correct_Agent
2. Plan Review Tests (2 of 4 implemented)
Implemented:
PlanReview_Approved_ProceedsPlanReview_Revised_Triggers_Replan
Not yet implemented:
PlanReview_Multiple_RevisionsPlanReview_On_Stall_Replan
3. Limit Enforcement Tests (1 of 3 implemented)
Implemented:
MaxRoundLimit_Terminates_Workflow
Not yet implemented:
MaxResetLimit_Terminates_WorkflowMaxStallCount_Triggers_Reset(as a limit test; stall-triggered reset is covered separately)
4. Stall Detection Tests (1 of 4 implemented)
Implemented:
MaxStallCount_Triggers_Reset(coversConsecutive_Stalls_Trigger_Resetwith MaxStallCount=1)
Not yet implemented:
Stall_IsInLoop_Increments_StallCount(stall counting directly)Stall_NoProgress_Increments_StallCountProgress_Made_Decrements_StallCount
5. Progress Ledger Validation Tests (1 of 3 implemented)
Implemented:
ProgressLedger_Updated_Event_Emitted
Not yet implemented:
ProgressLedger_Retry_On_Parse_FailureProgressLedger_Max_Retries_Triggers_Reset
6. Next Speaker Validation Tests (2 of 3 implemented)
Implemented:
NextSpeaker_Invalid_Triggers_FinalAnswerNextSpeaker_Empty_Falls_Back_To_First
Not yet implemented:
NextSpeaker_Valid_Delegates_Correctly(partially covered byTask_Completes_After_Multiple_Rounds)
7. Event Emission Tests (2 of 3 implemented)
Implemented:
Initial_Plan_Emits_PlanCreatedEventProgressLedger_Updated_Event_EmittedMagenticReplannedEventemission is verified inPlanReview_Revised_Triggers_ReplanandMaxStallCount_Triggers_Reset
Not yet implemented:
- Broader
Warning_Events_On_Errors(partially covered byNextSpeaker_Invalid_Triggers_FinalAnswerandNextSpeaker_Empty_Falls_Back_To_First)
8. Checkpoint/Resume Tests (partial)
Implemented:
- Indirect coverage via
PlanReview_Approved_ProceedsandPlanReview_Revised_Triggers_Replan, which both resume from checkpoints.
Not yet implemented:
Checkpoint_Saves_TaskContextCheckpoint_Resume_Continues_CorrectlyCheckpoint_Preserves_ProgressLedger
9. Edge Cases (0 of 4 implemented)
Not yet implemented:
Empty_Team_HandlingSingle_Agent_TeamInstruction_Message_Sent_When_PresentTerminated_Context_Rejects_New_Messages
Success Criteria Review
| Success Criterion | Status | Notes |
|---|---|---|
All logical forks in MagenticOrchestrator are covered by at least one test |
Mostly met | Round limit, reset/stall, empty speaker fallback, invalid speaker, plan signoff, plan revision, multi-round delegation, and satisfied completion are all covered. Remaining: reset limit, progress ledger parse failure/retry, and edge cases. |
Tests use the same patterns as HandoffOrchestrationTests |
Met | Tests use StreamingRun, CheckpointManager, RequestInfoEvent, WorkflowOutputEvent, and helper-based workflow execution patterns. |
| Tests run against fully-built workflows, not isolated components | Met | All 11 tests use MagenticWorkflowBuilder(...).Build(). |
| Each test verifies specific event emissions and state changes | Met | Event tests verify emitted events (PlanCreated, Replanned, ProgressLedgerUpdated, Warning); limit tests verify termination messages; plan review tests verify checkpoint/resume flow. |
Tests cover both requirePlanSignoff=true and false paths |
Met | PlanReview_Approved_Proceeds and PlanReview_Revised_Triggers_Replan use true; happy path tests use false. |
| Checkpoint/resume functionality is verified | Partially met | Plan review tests exercise checkpoint/resume, but direct state persistence assertions for MagenticTaskContext are not yet implemented. |
Overall Assessment
The current implementation covers the majority of the critical orchestrator decision paths and has grown from 5 to 11 E2E tests. The remaining ~20 tests from the original plan are primarily: additional edge cases, direct checkpoint state verification, progress ledger parse retry/failure, and stall counting granularity. The most impactful orchestrator branches are now covered.