From 79afda1a6c4103baa5ae3a42b3004a9e1d28f892 Mon Sep 17 00:00:00 2001 From: westey <164392973+westey-m@users.noreply.github.com> Date: Thu, 9 Apr 2026 09:46:20 +0100 Subject: [PATCH] Samples fixes (#5169) --- dotnet/eng/verify-samples/AgentsSamples.cs | 4 ++-- .../FileSystemJsonCheckpointStore.cs | 2 +- .../FileSystemJsonCheckpointStoreTests.cs | 19 +++++++++++++++++++ 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/dotnet/eng/verify-samples/AgentsSamples.cs b/dotnet/eng/verify-samples/AgentsSamples.cs index f44dd2f1f6..7a1ab8eaff 100644 --- a/dotnet/eng/verify-samples/AgentsSamples.cs +++ b/dotnet/eng/verify-samples/AgentsSamples.cs @@ -246,7 +246,7 @@ internal static class AgentsSamples ExpectedOutputDescription = [ "The output should contain information about both the current time and the weather in Seattle.", - "The weather information should reference the plugin result: cloudy with a high of 15°C.", + "The weather information should be similar to: cloudy with a high of 15°C. Exact phrasing may vary.", "The output should not contain error messages or stack traces.", ], }, @@ -521,7 +521,7 @@ internal static class AgentsSamples OptionalEnvironmentVariables = ["AZURE_AI_MODEL_DEPLOYMENT_NAME"], ExpectedOutputDescription = [ - "The output should demonstrate server-side conversation sessions with non-streaming and streaming turns.", + "The output should contain multiple joke responses showing a multi-turn conversation.", "The output should not contain error messages or stack traces.", ], }, diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows/Checkpointing/FileSystemJsonCheckpointStore.cs b/dotnet/src/Microsoft.Agents.AI.Workflows/Checkpointing/FileSystemJsonCheckpointStore.cs index c47298f112..9a2ecd8c23 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows/Checkpointing/FileSystemJsonCheckpointStore.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows/Checkpointing/FileSystemJsonCheckpointStore.cs @@ -168,7 +168,7 @@ public sealed class FileSystemJsonCheckpointStore : JsonCheckpointStore, IDispos string filePath = Path.Combine(this.Directory.FullName, fileName); if (!this.CheckpointIndex.Contains(key) || - !File.Exists(fileName)) + !File.Exists(filePath)) { throw new KeyNotFoundException($"Checkpoint '{key.CheckpointId}' not found in store at '{this.Directory.FullName}'."); } diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/FileSystemJsonCheckpointStoreTests.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/FileSystemJsonCheckpointStoreTests.cs index 10fbfddd64..f0058e7390 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/FileSystemJsonCheckpointStoreTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/FileSystemJsonCheckpointStoreTests.cs @@ -178,4 +178,23 @@ public sealed class FileSystemJsonCheckpointStoreTests Func createCheckpointAction = async () => await store.CreateCheckpointAsync(runId, TestData); await createCheckpointAction.Should().NotThrowAsync(); } + + [Fact] + public async Task RetrieveCheckpointAsync_ShouldReturnPersistedDataAsync() + { + // Arrange + using TempDirectory tempDirectory = new(); + using FileSystemJsonCheckpointStore store = new(tempDirectory); + + string sessionId = Guid.NewGuid().ToString("N"); + JsonElement originalData = JsonSerializer.SerializeToElement(new { name = "test", value = 42 }); + + // Act + CheckpointInfo checkpoint = await store.CreateCheckpointAsync(sessionId, originalData); + JsonElement retrieved = await store.RetrieveCheckpointAsync(sessionId, checkpoint); + + // Assert + retrieved.GetProperty("name").GetString().Should().Be("test"); + retrieved.GetProperty("value").GetInt32().Should().Be(42); + } }