close
Skip to content

.NET: fix fan-in barrier checkpoint state - #6491

Merged
Peter Ibekwe (peibekwe) merged 1 commit into
microsoft:mainfrom
he-yufeng:fix/fanin-barrier-checkpoint
Jun 17, 2026
Merged

.NET: fix fan-in barrier checkpoint state#6491
Peter Ibekwe (peibekwe) merged 1 commit into
microsoft:mainfrom
he-yufeng:fix/fanin-barrier-checkpoint

Conversation

@he-yufeng

Copy link
Copy Markdown
Contributor

Summary

Fixes #6372.

The in-process runner was checkpointing a runner-owned EdgeMap, while message delivery and fan-in buffering actually use the EdgeMap owned by InProcessRunnerContext. That meant a checkpoint taken after one side of a fan-in barrier had arrived could persist an empty edge state, then lose the buffered message on resume.

This changes checkpoint export/import to go through the live runner context edge map and adds a regression test that pauses with one fan-in input buffered, resumes, replies to the pending request, and verifies the barrier releases both pre-checkpoint and post-resume contributions.

Validation

  • git diff --check
  • dotnet run --project .\tests\Microsoft.Agents.AI.Workflows.UnitTests\Microsoft.Agents.AI.Workflows.UnitTests.csproj -f net10.0 -- --filter-method Microsoft.Agents.AI.Workflows.UnitTests.CheckpointResumeTests.Checkpoint_Resume_PreservesFanInBarrierBufferedMessagesAsync --no-progress
  • dotnet run --project .\tests\Microsoft.Agents.AI.Workflows.UnitTests\Microsoft.Agents.AI.Workflows.UnitTests.csproj -f net10.0 -- --filter-class Microsoft.Agents.AI.Workflows.UnitTests.CheckpointResumeTests --no-progress
  • dotnet build .\tests\Microsoft.Agents.AI.Workflows.UnitTests\Microsoft.Agents.AI.Workflows.UnitTests.csproj --no-restore --tl:off
  • dotnet format .\src\Microsoft.Agents.AI.Workflows\Microsoft.Agents.AI.Workflows.csproj --verify-no-changes --no-restore --verbosity minimal
  • dotnet format .\tests\Microsoft.Agents.AI.Workflows.UnitTests\Microsoft.Agents.AI.Workflows.UnitTests.csproj --verify-no-changes --no-restore --verbosity minimal

Copilot AI review requested due to automatic review settings June 12, 2026 05:54
@moonbox3 Evan Mattson (moonbox3) added .NET Usage: [Issues, PRs], Target: .Net workflows Usage: [Issues, PRs], Target: Workflows labels Jun 12, 2026

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.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds coverage and runtime support for preserving fan-in barrier buffered edge state across checkpoint/resume in the in-process workflow runner.

Changes:

  • Added a new unit test that checkpoints with a partially satisfied fan-in barrier and verifies buffered contributions are released after resume.
  • Exposed edge-state export/import on InProcessRunnerContext.
  • Updated InProcessRunner to use RunContext for edge-state serialization during checkpoint/restore.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/CheckpointResumeTests.cs Adds a regression test and local executors/events to validate fan-in barrier buffering across resume.
dotnet/src/Microsoft.Agents.AI.Workflows/InProc/InProcessRunnerContext.cs Adds context-level methods to export/import edge state with checkpoint lifecycle checks.
dotnet/src/Microsoft.Agents.AI.Workflows/InProc/InProcessRunner.cs Routes checkpoint/restore edge-state handling through RunContext instead of a runner-owned EdgeMap.

@he-yufeng
Yufeng He (he-yufeng) force-pushed the fix/fanin-barrier-checkpoint branch from 4ed6147 to b0bbb9f Compare June 12, 2026 11:08
@he-yufeng

Copy link
Copy Markdown
Contributor Author

Rebased onto current main; no code changes beyond replaying the existing commit.

Validated locally on Windows with the focused checkpoint regression:

dotnet test --project ./tests/Microsoft.Agents.AI.Workflows.UnitTests/Microsoft.Agents.AI.Workflows.UnitTests.csproj -f net10.0 -c Debug -v Normal --report-xunit-trx --ignore-exit-code 8 --filter-method "*Checkpoint_Resume_PreservesFanInBarrierBufferedMessagesAsync"
dotnet test --project ./tests/Microsoft.Agents.AI.Workflows.UnitTests/Microsoft.Agents.AI.Workflows.UnitTests.csproj -f net472 -c Debug -v Normal --report-xunit-trx --ignore-exit-code 8 --filter-method "*Checkpoint_Resume_PreservesFanInBarrierBufferedMessagesAsync"
git diff --check upstream/main..HEAD

Both target frameworks passed the focused test (2 theory cases each).

@he-yufeng
Yufeng He (he-yufeng) force-pushed the fix/fanin-barrier-checkpoint branch from b0bbb9f to e79f945 Compare June 12, 2026 15:14
@he-yufeng

Copy link
Copy Markdown
Contributor Author

Rebased this branch onto current main and pushed head e79f94591.

Validation run locally from dotnet/:

  • git diff --check upstream/main..HEAD -> passed
  • dotnet build .\tests\Microsoft.Agents.AI.Workflows.UnitTests\Microsoft.Agents.AI.Workflows.UnitTests.csproj --no-restore --tl:off -> passed, 0 warnings/errors
  • dotnet run --project .\tests\Microsoft.Agents.AI.Workflows.UnitTests\Microsoft.Agents.AI.Workflows.UnitTests.csproj -f net10.0 -- --filter-method Microsoft.Agents.AI.Workflows.UnitTests.CheckpointResumeTests.Checkpoint_Resume_PreservesFanInBarrierBufferedMessagesAsync --no-progress -> passed, 2 tests
  • dotnet run --project .\tests\Microsoft.Agents.AI.Workflows.UnitTests\Microsoft.Agents.AI.Workflows.UnitTests.csproj -f net472 -- --filter-method Microsoft.Agents.AI.Workflows.UnitTests.CheckpointResumeTests.Checkpoint_Resume_PreservesFanInBarrierBufferedMessagesAsync --no-progress -> passed, 2 tests

@he-yufeng
Yufeng He (he-yufeng) force-pushed the fix/fanin-barrier-checkpoint branch 3 times, most recently from bbc0157 to 2354d74 Compare June 16, 2026 19:14
@peibekwe
Peter Ibekwe (peibekwe) added this pull request to the merge queue Jun 17, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks Jun 17, 2026
@peibekwe
Peter Ibekwe (peibekwe) added this pull request to the merge queue Jun 17, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 17, 2026
@peibekwe
Peter Ibekwe (peibekwe) added this pull request to the merge queue Jun 17, 2026
Merged via the queue into microsoft:main with commit 6163153 Jun 17, 2026
27 checks passed
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 workflows Usage: [Issues, PRs], Target: Workflows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.NET: [Bug]: Fan-in barrier (AddFanInBarrierEdge) loses buffered messages across checkpoint/resume

5 participants