Skip to content

.NET: fix(dotnet): preserve pending Magentic plan review - #9797

Merged
Vincent Biret (baywet) merged 2 commits into
mainfrom
fix/magentic-pending-plan-review
Oct 28, 2026
Merged

Vincent Biret (baywet) merged 2 commits into
mainfrom
fix/magentic-pending-plan-review

Conversation

@baywet

@baywet Vincent Biret (baywet) commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Motivation & Context

Keep Magentic workflows paused consistently while a generated plan is awaiting review, including when a session is resumed.

Description & Review Guide

  • What are the major changes? Persist pending plan-review state, ignore unrelated turns with a workflow warning, and resume coordination after the matching approval. Discard buffered ordinary messages before processing review responses, while preserving explicit revision feedback. Preserve review state when restoring older checkpoints and document the expected interaction.
  • What is the impact of these changes? Initial and revised plans keep waiting for review across follow-up turns and serialized-session restores. Workflows without plan signoff and already-approved plans retain their normal progression.
  • What do you want reviewers to focus on? Review-state transitions, checkpoint compatibility, and the streaming/non-streaming regression coverage.

Commands run from dotnet:

  • dotnet test --project tests\Microsoft.Agents.AI.Workflows.UnitTests -f net10.0 --filter-method Microsoft.Agents.AI.Workflows.UnitTests.MagenticOrchestrationTests.PlanReview_Pending_Ignores_Unrelated_TurnsAsync --no-ansi --output Detailed --minimum-expected-tests 4: four behavioral failures before the fix; all four passed afterward.
  • dotnet test --project tests\Microsoft.Agents.AI.Workflows.UnitTests -f net10.0 --filter-method Microsoft.Agents.AI.Workflows.UnitTests.MagenticOrchestrationTests.PlanReview_Response_Discards_Unrelated_Buffered_MessagesAsync --no-ansi --output Detailed --minimum-expected-tests 4: four behavioral failures before the follow-up correction; all four passed afterward.
  • dotnet test --project tests\Microsoft.Agents.AI.Workflows.UnitTests -f net10.0 --no-ansi --minimum-expected-tests 884: passed, 884 tests, including the original regressions and mixed-response coverage.
  • dotnet build src\Microsoft.Agents.AI.Workflows\Microsoft.Agents.AI.Workflows.csproj --no-restore --tl:off: passed across all target frameworks with zero warnings and errors.
  • dotnet build src\Microsoft.Agents.AI.Workflows\Microsoft.Agents.AI.Workflows.csproj -c Release --tl:off: passed at the initial revision across all target frameworks with zero warnings and errors.
  • dotnet format src\Microsoft.Agents.AI.Workflows\Microsoft.Agents.AI.Workflows.csproj --no-restore: passed.
  • dotnet format tests\Microsoft.Agents.AI.Workflows.UnitTests\Microsoft.Agents.AI.Workflows.UnitTests.csproj --no-restore: passed.
  • dotnet build agent-framework-dotnet.slnx --tl:off: stopped after local disk exhaustion. Solution-wide unit tests were not run.

Related Issue

N/A - maintainer-directed bugfix; no public issue.

AI Assistance

  • No material AI assistance was used.
  • This is an AI-assisted contribution. I reviewed, understood, and verified all submitted content and accept responsibility for it.

AI assistance details: Implementation, regression tests, documentation, validation, and this PR description.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • All unit tests pass, and I have added new tests where possible
  • The PR follows the Contribution Guidelines
  • This PR links to an agreed issue with no competing open PR, or the Related Issue section documents a trivial-change or repository-automation exception.
  • This is not a breaking change. If it is a breaking change, add the breaking change label (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 1a97d677-e089-43e3-bdb9-03a64d2918bd
Copilot AI balanced review requested due to automatic review settings October 28, 2026 13:54
@agent-framework-automation agent-framework-automation Bot added documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs .NET Usage: [Issues, PRs], Target: .Net workflows Usage: [Issues, PRs], Target: Workflows labels Oct 28, 2026
@github-actions github-actions Bot changed the title fix(dotnet): preserve pending Magentic plan review .NET: fix(dotnet): preserve pending Magentic plan review Oct 28, 2026

This comment was marked as off-topic.

This comment was marked as off-topic.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MAF Automated Review — Iteration 1

Result: Findings reported
Scope: full PR (1 commit(s)): 749f508b5561
Model: gpt-5.6-sol

Overview

The change adds an explicit, checkpointed pending-review flag and uses it to reject ordinary turns until the active review is answered; request-ID correlation and restore tests provide strong protection against stale responses and checkpoint regressions. However, ordinary content submitted in the same invocation as an approval is buffered before the approval handler clears the flag, allowing that pre-approval content to enter coordination on a later turn.

Reviewed the supplied pull-request change set across correctness, security/reliability, architecture, and failure behavior.
1 verified finding remained after source verification (1 medium) across 1 file. Details are attached to the affected lines below.

Affected areas: dotnet/src/Microsoft.Agents.AI.Workflows/Specialized/Magentic/MagenticOrchestrator.cs

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are reported for the changes preserving pending plan reviews across workflow turns and session restoration.

No open issues 🎉

Review effort: Balanced

@github-code-quality

github-code-quality Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Code coverage overview

Languages: C#

C# / code-coverage/dotnet

main 6afcecd fix/magentic-pending... e582d4c +/-
86% 86% 0%
View coverage of the 3 most impacted files.
File main 6afcecd fix/magentic-pending... e582d4c +/-
/home/runner/wo...SessionStore.cs 100% 56% -44%
/home/runner/wo...Orchestrator.cs 97% 97% 0%
/home/runner/wo...kflowSession.cs 87% 87% 0%

ℹ️ Calculations represent line coverage. Results may change as calculations are updated.


Updated October 28, 2026 14:47 UTC

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 1a97d677-e089-43e3-bdb9-03a64d2918bd

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues block approval of the changes that keep Magentic workflows paused pending plan review.

No open issues 🎉

Review effort: Balanced

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MAF Automated Review — Iteration 2

Result: No findings
Scope: 1 net-new commit(s): e582d4c0a4a4
Model: gpt-5.6-sol

Overview

The incremental change clears executor-local ordinary messages before handling a correlated plan-review response while preserving explicit revision feedback in the response payload. It reuses the stateful executor's message-processing helper and adds regression coverage across approval, revision, streaming, non-streaming, and session-restore paths. Existing request correlation and awaiting-review guards further constrain the lifecycle. No Critical, High, or Medium residual risk was established.

Reviewed the supplied incremental change set across correctness, security/reliability, architecture, and failure behavior.
No publishable findings remained after source verification for this scope.

This branch was previously deployed

2 inactive deployments
github-app-auth — e582d4c0 Deployed Oct 28, 2026 by baywet via team_check #7884
integration — e582d4c0 Deployed Oct 28, 2026 by baywet via dotnet-foundry-hosted-it #31456
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs .NET Usage: [Issues, PRs], Target: .Net workflows Usage: [Issues, PRs], Target: Workflows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants