From 99947c3cc8123437f6b664d60982d8b30612487d Mon Sep 17 00:00:00 2001 From: Matt Ellis Date: Fri, 31 Jul 2026 19:54:50 -0700 Subject: [PATCH] dotnet: wait for terminal task status in E2E test Keep polling until the background task reaches a removable terminal state instead of treating response content as completion. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: c70e0ca7-1826-462d-bcdb-d1bb4ef859f1 --- dotnet/test/E2E/RpcTasksAndHandlersE2ETests.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dotnet/test/E2E/RpcTasksAndHandlersE2ETests.cs b/dotnet/test/E2E/RpcTasksAndHandlersE2ETests.cs index 989fef7c55..a999981f3d 100644 --- a/dotnet/test/E2E/RpcTasksAndHandlersE2ETests.cs +++ b/dotnet/test/E2E/RpcTasksAndHandlersE2ETests.cs @@ -152,10 +152,10 @@ await TestHelper.WaitForConditionAsync( async () => { task = await FindAgentTaskAsync(session, started.AgentId); - return task?.LatestResponse?.Contains("TASK_AGENT_DONE", StringComparison.Ordinal) == true - || task?.Result?.Contains("TASK_AGENT_DONE", StringComparison.Ordinal) == true - || task?.Status == GitHub.Copilot.Rpc.TaskStatus.Completed - || task?.Status == GitHub.Copilot.Rpc.TaskStatus.Failed; + return task?.Status == GitHub.Copilot.Rpc.TaskStatus.Completed + || task?.Status == GitHub.Copilot.Rpc.TaskStatus.Failed + || task?.Status == GitHub.Copilot.Rpc.TaskStatus.Cancelled + || task?.Status == GitHub.Copilot.Rpc.TaskStatus.Idle; }, timeout: TimeSpan.FromSeconds(60), timeoutMessage: $"Background agent task '{started.AgentId}' did not produce a final observable state.");