Skip to content

Python: .NET: [Bug]: Magentic jumps to the final answer when the progress ledger names an unknown participant #10072

Open

Description

@compilandoideas

Observed Behavior

When the progress ledger's next_speaker.answer is a name that is not a participant, MagenticOrchestrator raises WorkflowWarningEvent("Invalid next speaker: <name>") and immediately calls PrepareFinalAnswerAsync, so the run completes with a "final answer" for a task that was never done. (With an empty next_speaker it silently picks the first participant.)

Expected Behavior

Treat an unknown speaker like an unparsable ledger: retry the progress ledger (up to MaxProgressLedgerRetryCount), then reset/replan, or fail the run, instead of producing a final answer. This is what the Python side now does: #9178 was fixed by #9181 ("Retry the Magentic progress ledger when it names an unknown agent"), and #9025/#9026 do the same for Group Chat. Asking for parity in .NET.

Steps to Reproduce

  1. Build a Magentic workflow with one participant named Worker and RequirePlanSignoff(false).
  2. Use a manager whose progress ledger answers next_speaker = "Ghost" (the repro scripts it).
  3. Run it and inspect run.OutgoingEvents.
  4. dotnet run -- speaker with the code below.

Minimal Reproduction

Public repro repo: https://github.com/compilandoideas/maf-magentic-repro (dotnet run -- speaker; the repro GitHub Actions workflow runs both scenarios on Linux, see the Actions tab). Full code: Program.cs and MagenticRepro.csproj in that repo (single file, ~70 lines).

Error Messages and Stack Traces

No error. Output of `dotnet run -- speaker`:

[warning] Invalid next speaker: Ghost
[output]  from=MagenticOrchestrator type=List`1 tags=[]: FINAL ANSWER (task was never completed)
[status]  Idle

Package Versions

Microsoft.Agents.AI 1.27.0, Microsoft.Agents.AI.Workflows 1.27.0 (first seen on 1.19.0; Specialized/Magentic/* is unchanged on main for this path)

.NET Version

.NET 10.0 (SDK 10.0.102)

Operating System

macOS

Regression

No

Additional Context

Code path: Specialized/Magentic/MagenticOrchestrator.cs, the nextAgent == null branch after team.FirstOrDefault(agent => agent.Name == nextSpeaker).

Duplicate search (open and closed issues and PRs: "next_speaker", "Invalid next speaker", "unknown participant", "unknown agent", "progress ledger", "Magentic final answer"): only the Python reports above; nothing for .NET.

Verified on macOS with SDK 10.0.102, and on Linux in the repro repo's GitHub Actions run.


Generated by Claude Code

Acknowledgements

  • I searched existing issues and did not find a duplicate.
  • I personally verified this behavior and the reproduction details are authentic.
  • I will wait for explicit maintainer agreement before starting implementation of a non-trivial change.

Activity

  1. added
    pythonUsage: [Issues, PRs], Target: Python
    triageUsage: [Issues], Target: All issues that still need to be triaged
    on Nov 4, 2026
  2. changed the title [-].NET: [Bug]: Magentic jumps to the final answer when the progress ledger names an unknown participant[/-] [+]Python: .NET: [Bug]: Magentic jumps to the final answer when the progress ledger names an unknown participant[/+] on Nov 4, 2026
  3. added
    reproducedUsage: [Issues], Target: all issues that can be reproduced by the triage workflow
    on Nov 4, 2026
  4. github-actions commented on Nov 4, 2026

    @github-actions
    Contributor

    🤖 Automated triage reproduction notes (agent-authored — trust but verify)

    Agent analysis

    The defect is in dotnet/src/Microsoft.Agents.AI.Workflows/Specialized/Magentic/MagenticOrchestrator.cs::RunCoordinationRoundAsync at lines 343-349, where an unknown non-empty NextSpeaker triggers PrepareFinalAnswerAsync. Minimal repro: run NextSpeaker_Invalid_DoesNotTriggerFinalAnswerAsync, which scripts an unsatisfied ledger naming NonExistentAgent and observes an incorrect final result.

    • Failing test: dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/MagenticOrchestrationTests.cs
    • Files examined: dotnet/src/Microsoft.Agents.AI.Workflows/Specialized/Magentic/MagenticOrchestrator.cs, dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/MagenticOrchestrationTests.cs, dotnet/nuget/nuget-package.props
    • Tests run: NextSpeaker_Invalid_Triggers_FinalAnswerAsync, NextSpeaker_Invalid_DoesNotTriggerFinalAnswerAsync
    • Reported version: 1.27.0
    • Current version: 1.27.0
  5. added
    workflowsUsage: [Issues, PRs], Target: Workflows
    and removed
    triageUsage: [Issues], Target: All issues that still need to be triaged
    on Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

.NETUsage: [Issues, PRs], Target: .NetpythonUsage: [Issues, PRs], Target: PythonreproducedUsage: [Issues], Target: all issues that can be reproduced by the triage workflowworkflowsUsage: [Issues, PRs], Target: Workflows

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions