.NET: Fix FileSystemJsonCheckpointStore.RetrieveCheckpointAsync using wrong path in File.Exists#5169
Merged
westey-m merged 1 commit intomicrosoft:mainfrom Apr 9, 2026
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a checkpoint restore failure in the .NET workflow checkpoint store by ensuring checkpoint files are checked for existence using the store’s directory path (not the process CWD), and adds a roundtrip unit test to prevent regressions.
Changes:
- Fix
FileSystemJsonCheckpointStore.RetrieveCheckpointAsyncto callFile.Existswith the full checkpoint file path. - Add a unit test validating create → retrieve roundtrip behavior.
- Relax two
verify-samplesexpected-output descriptions to be less brittle for non-deterministic output verification.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| dotnet/src/Microsoft.Agents.AI.Workflows/Checkpointing/FileSystemJsonCheckpointStore.cs | Corrects checkpoint existence check to use the full path in the configured store directory. |
| dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/FileSystemJsonCheckpointStoreTests.cs | Adds a regression test ensuring persisted checkpoint data can be retrieved successfully. |
| dotnet/eng/verify-samples/AgentsSamples.cs | Updates AI-verification expectation text to tolerate natural output variability. |
SergeyMenshykh
approved these changes
Apr 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Three declarative workflow samples (
Workflow_Declarative_FunctionTools,Workflow_Declarative_InvokeFunctionTool,Workflow_Declarative_ToolApproval) crash withKeyNotFoundExceptionduring theWORKFLOW: Restorestep after a successfulWORKFLOW: Yield.Discovered via the nightly verify-samples run.
Root Cause
Bug in
FileSystemJsonCheckpointStore.RetrieveCheckpointAsync(line 171):File.Exists(fileName)resolves relative to the process current working directory — not the checkpoint store directory. When CWD ≠ store directory (as in CI), the file is never found, even though line 176 correctly usesfilePathto open it.Fix
File.Exists(fileName)→File.Exists(filePath)on line 171RetrieveCheckpointAsync_ShouldReturnPersistedDataAsyncroundtrip unit test (existing tests only coveredCreateCheckpointAsync)Testing