diff --git a/dotnet/samples/04-hosting/DurableAgents/AzureFunctions/06_LongRunningTools/FunctionTriggers.cs b/dotnet/samples/04-hosting/DurableAgents/AzureFunctions/06_LongRunningTools/FunctionTriggers.cs index ed66be8bdd..b707240ba8 100644 --- a/dotnet/samples/04-hosting/DurableAgents/AzureFunctions/06_LongRunningTools/FunctionTriggers.cs +++ b/dotnet/samples/04-hosting/DurableAgents/AzureFunctions/06_LongRunningTools/FunctionTriggers.cs @@ -35,13 +35,15 @@ public static class FunctionTriggers int iterationCount = 0; while (iterationCount++ < input.MaxReviewAttempts) { + // NOTE: CustomStatus has a 16 KB UTF-16 limit in Durable Functions. + // Only include short metadata here - the full content is passed via activity inputs/outputs. context.SetCustomStatus( new { message = "Requesting human feedback.", approvalTimeoutHours = input.ApprovalTimeoutHours, iterationCount, - content + contentTitle = content.Title, }); // Step 2: Notify user to review the content @@ -63,7 +65,6 @@ public static class FunctionTriggers { message = $"Human approval timed out after {input.ApprovalTimeoutHours} hour(s). Treating as rejection.", iterationCount, - content }); throw new TimeoutException($"Human approval timed out after {input.ApprovalTimeoutHours} hour(s)."); } @@ -73,7 +74,7 @@ public static class FunctionTriggers context.SetCustomStatus(new { message = "Content approved by human reviewer. Publishing content...", - content + contentTitle = content.Title, }); // Step 4: Publish the approved content @@ -83,7 +84,7 @@ public static class FunctionTriggers { message = $"Content published successfully at {context.CurrentUtcDateTime:s}", humanFeedback = humanResponse, - content + contentTitle = content.Title, }); return new { content = content.Content }; } @@ -92,7 +93,7 @@ public static class FunctionTriggers { message = "Content rejected by human reviewer. Incorporating feedback and regenerating...", humanFeedback = humanResponse, - content + contentTitle = content.Title, }); // Incorporate human feedback and regenerate diff --git a/dotnet/samples/04-hosting/DurableAgents/ConsoleApps/06_LongRunningTools/Program.cs b/dotnet/samples/04-hosting/DurableAgents/ConsoleApps/06_LongRunningTools/Program.cs index 203edca308..7bb593ab29 100644 --- a/dotnet/samples/04-hosting/DurableAgents/ConsoleApps/06_LongRunningTools/Program.cs +++ b/dotnet/samples/04-hosting/DurableAgents/ConsoleApps/06_LongRunningTools/Program.cs @@ -77,13 +77,15 @@ static async Task RunOrchestratorAsync(TaskOrchestrationContext context, int iterationCount = 0; while (iterationCount++ < input.MaxReviewAttempts) { + // NOTE: CustomStatus has a 16 KB UTF-16 limit in Durable Functions. + // Only include short metadata here - the full content is passed via activity inputs/outputs. context.SetCustomStatus( new { message = "Requesting human feedback.", approvalTimeoutHours = input.ApprovalTimeoutHours, iterationCount, - content + contentTitle = content.Title, }); // Step 2: Notify user to review the content @@ -105,7 +107,6 @@ static async Task RunOrchestratorAsync(TaskOrchestrationContext context, { message = $"Human approval timed out after {input.ApprovalTimeoutHours} hour(s). Treating as rejection.", iterationCount, - content }); throw new TimeoutException($"Human approval timed out after {input.ApprovalTimeoutHours} hour(s)."); } @@ -115,7 +116,7 @@ static async Task RunOrchestratorAsync(TaskOrchestrationContext context, context.SetCustomStatus(new { message = "Content approved by human reviewer. Publishing content...", - content + contentTitle = content.Title, }); // Step 4: Publish the approved content @@ -125,7 +126,7 @@ static async Task RunOrchestratorAsync(TaskOrchestrationContext context, { message = $"Content published successfully at {context.CurrentUtcDateTime:s}", humanFeedback = humanResponse, - content + contentTitle = content.Title, }); return new { content = content.Content }; } @@ -134,7 +135,7 @@ static async Task RunOrchestratorAsync(TaskOrchestrationContext context, { message = "Content rejected by human reviewer. Incorporating feedback and regenerating...", humanFeedback = humanResponse, - content + contentTitle = content.Title, }); // Incorporate human feedback and regenerate diff --git a/dotnet/samples/04-hosting/DurableAgents/ConsoleApps/07_ReliableStreaming/Program.cs b/dotnet/samples/04-hosting/DurableAgents/ConsoleApps/07_ReliableStreaming/Program.cs index 3abc5c8701..9be3f4f659 100644 --- a/dotnet/samples/04-hosting/DurableAgents/ConsoleApps/07_ReliableStreaming/Program.cs +++ b/dotnet/samples/04-hosting/DurableAgents/ConsoleApps/07_ReliableStreaming/Program.cs @@ -285,6 +285,7 @@ async Task ReadStreamTask(string conversationId, string? cursor, CancellationTok if (chunk.Text != null) { Console.Write(chunk.Text); + Console.Out.Flush(); } // Always update lastCursor to track the latest entry ID, even if text is null diff --git a/dotnet/tests/Microsoft.Agents.AI.Hosting.AzureFunctions.IntegrationTests/SamplesValidation.cs b/dotnet/tests/Microsoft.Agents.AI.Hosting.AzureFunctions.IntegrationTests/SamplesValidation.cs index b15f6e8f42..ffd2e39ae2 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Hosting.AzureFunctions.IntegrationTests/SamplesValidation.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Hosting.AzureFunctions.IntegrationTests/SamplesValidation.cs @@ -35,7 +35,7 @@ public sealed class SamplesValidation(ITestOutputHelper outputHelper) : IAsyncLi .Build(); private static bool s_infrastructureStarted; - private static readonly TimeSpan s_orchestrationTimeout = TimeSpan.FromMinutes(1); + private static readonly TimeSpan s_orchestrationTimeout = TimeSpan.FromMinutes(2); // In CI, `dotnet run` builds the Functions project from scratch before the host starts, so 60s is not enough. private static readonly TimeSpan s_functionsReadyTimeout = TimeSpan.FromSeconds(180);