Thanks to visit codestin.com
Credit goes to github.com

Skip to content

.NET: Add Magentic E2E workflow coverage#5833

Merged
lokitoth merged 47 commits into
mainfrom
copilot/add-e2e-tests-for-magentic-again
May 14, 2026
Merged

.NET: Add Magentic E2E workflow coverage#5833
lokitoth merged 47 commits into
mainfrom
copilot/add-e2e-tests-for-magentic-again

Conversation

Copilot AI commented May 14, 2026

Copy link
Copy Markdown
Contributor

Motivation and Context

This PR completes the Magentic end-to-end workflow coverage described in MagenticE2E_TestPlan.md and summarized in MagenticE2E_ImplementationReview.md.

The Magentic orchestrator has several user-visible branches that are difficult to validate with isolated unit tests: planning and replanning, human plan review, participant routing, stall/reset handling, progress-ledger retry behavior, final-answer termination, checkpoint/resume, and invalid or erroneous workflow inputs. This change adds fully built workflow tests that exercise those behaviors through MagenticWorkflowBuilder.Build() and the in-process streaming workflow runtime.

It also fixes minor issues discovered while adding the E2E tests:

  • Empty Magentic teams now fail during workflow build instead of producing a workflow that can fail later during execution.
  • New top-level messages sent after Magentic termination now surface the orchestrator's terminal-state error as a workflow error, even though the workflow framework accepts queued messages.

Description

This PR adds a Magentic E2E test suite and supporting implementation updates.

Key changes:

  • Added MagenticOrchestrationTests.cs with 23 end-to-end tests that run fully built Magentic workflows through the streaming workflow runtime.
  • Covered happy-path completion, participant delegation, multi-round coordination, plan signoff, plan approval/revision flows, multiple revisions, stall-triggered replanning, checkpoint/resume behavior, round/reset limits, progress-ledger retry/reset handling, next-speaker validation, warning/event emission, instruction-message flow, empty-team validation, and post-termination message rejection.
  • Updated MagenticWorkflowBuilder.Build() to throw InvalidOperationException when no participants have been added.
  • Updated MagenticOrchestrator.TakeTurnAsync() to reject new messages after the Magentic task context is terminated, matching the existing terminal-state protection on plan-review responses.
  • Aligned Magentic orchestration behavior with the expected coordination loop: normal participant returns resume progress-ledger coordination instead of replanning.
  • Ensured stall handling uses the intended StallCount > MaxStallCount semantics and preserves stall context for plan review when replanning after a stall.
  • Ensured the orchestrator declares the final-answer output protocol used by fully built workflow execution.

Validation performed:

  • dotnet build tests/Microsoft.Agents.AI.Workflows.UnitTests/Microsoft.Agents.AI.Workflows.UnitTests.csproj -f net10.0
  • dotnet test --project tests/Microsoft.Agents.AI.Workflows.UnitTests/Microsoft.Agents.AI.Workflows.UnitTests.csproj -f net10.0 --filter-class '*MagenticOrchestrationTests'
  • Parallel validation completed with no review comments or security alerts.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • [ ] Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

Copilot AI and others added 30 commits May 13, 2026 20:22
@moonbox3 moonbox3 added orchestration Usage: [Issues, PRs], Target: multi-agent orchestration (high-level patterns) and removed agent orchestration labels Jun 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

.NET Usage: [Issues, PRs], Target: .Net orchestration Usage: [Issues, PRs], Target: multi-agent orchestration (high-level patterns) workflows Usage: [Issues, PRs], Target: Workflows

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

6 participants