.NET: Fixes for durable agents integration tests (#4952)

* Fixing for durable agents integration tests

* Add further fixes
This commit is contained in:
westey
2026-03-27 17:38:23 +00:00
committed by GitHub
Unverified
parent 6b47cdbf52
commit ca6cdd142e
4 changed files with 14 additions and 11 deletions
@@ -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
@@ -77,13 +77,15 @@ static async Task<object> 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<object> 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<object> 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<object> 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<object> RunOrchestratorAsync(TaskOrchestrationContext context,
{
message = "Content rejected by human reviewer. Incorporating feedback and regenerating...",
humanFeedback = humanResponse,
content
contentTitle = content.Title,
});
// Incorporate human feedback and regenerate
@@ -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
@@ -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);