Repository navigation
JobMonitor: Consider work items with failed tests as failed - #17042
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates Helix JobMonitor behavior to treat work items as failed when Azure DevOps test uploads report failed tests (even if the Helix exit code is 0), and adds logic/tests around retry behavior and deduplication across repeated monitor invocations for the same build.
Changes:
- Add AzDO-side discovery of failed test work items and incorporate them into the retry/resubmission pass.
- Change test-result upload to return per-work-item upload summaries (including an
AllPassedsignal) and feed those summaries back into monitoring state. - Add/extend unit tests covering: (1) test-only failures causing exit code 1, (2) retry pass resubmitting “exit-code-pass but test-failed” work items, and (3) behavior when jobs were processed by a prior monitor attempt.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Microsoft.DotNet.Helix/Sdk.Tests/Microsoft.DotNet.Helix.Sdk.Tests/JobMonitorRunnerTests.cs | Adds tests for previously-processed job behavior and for test-only failures influencing exit code and retry pass. |
| src/Microsoft.DotNet.Helix/Sdk.Tests/Microsoft.DotNet.Helix.Sdk.Tests/Fakes/FakeAzureDevOpsService.cs | Extends fake AzDO service to simulate failed uploads and previously recorded failed tests; updates upload API shape. |
| src/Microsoft.DotNet.Helix/JobMonitor/TestResultUploadQueue.cs | Plumbs upload summaries into monitor state after uploads complete. |
| src/Microsoft.DotNet.Helix/JobMonitor/Services/AzureDevOpsService.cs | Implements failed-test work item discovery from AzDO runs; updates upload API to return per-work-item summaries. |
| src/Microsoft.DotNet.Helix/JobMonitor/MonitorState.cs | Adds ObserveTestResults to mark work items failed based on uploaded test failures. |
| src/Microsoft.DotNet.Helix/JobMonitor/JobMonitorRunner.cs | Uses AzDO failed-test work item discovery during retry pass; adjusts reconciliation skip behavior for processed jobs. |
| src/Microsoft.DotNet.Helix/JobMonitor/Interfaces/IAzureDevOpsService.cs | Adds GetFailedTestWorkItemsAsync and changes upload API to return upload summaries. |
| src/Microsoft.DotNet.Helix/AzureDevOpsTestPublisher/AzureDevOpsResultPublisher.cs | Minor adjustment to TestResultUploadSummary construction (named arguments). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
…for better immutability
mmitche
left a comment
There was a problem hiding this comment.
Some questionable locking and also some questions about the rest run API
# Conflicts: # src/Microsoft.DotNet.Helix/JobMonitor/JobMonitorRunner.cs # src/Microsoft.DotNet.Helix/JobMonitor/MonitorState.cs # src/Microsoft.DotNet.Helix/JobMonitor/Services/AzureDevOpsService.cs # src/Microsoft.DotNet.Helix/Sdk.Tests/Microsoft.DotNet.Helix.Sdk.Tests/Fakes/FakeAzureDevOpsService.cs
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
src/Microsoft.DotNet.Helix/JobMonitor/StatusReporter.cs:107
- With FailWorkItemsWithFailedTests enabled, a job can still end up failing due to uploaded test results even when all work items exited 0. LogJobCompleted currently logs "✅ … succeeded" purely based on Helix exit codes (WorkItemSummary.IsFailed), which can become misleading under the new behavior.
int failedWorkItemCount = workItems.Count(wi => wi.IsFailed);
int successfulWorkItemCount = workItems.Count - failedWorkItemCount;
_logger.LogInformation("{Icon} Job '{JobName}' {Status} ({PassedCount} passed, {FailedCount} failed){nl}{JobUri}",
failedWorkItemCount == 0 ? "✅" : "❌",
|
@mmitche the locking comes from the fact that we touch the state from the upload threads |
| return processed; | ||
| } | ||
|
|
||
| public async Task<IReadOnlyDictionary<string, IReadOnlySet<string>>> GetFailedTestWorkItemsAsync(CancellationToken cancellationToken) |
There was a problem hiding this comment.
This seems a really inefficienct way to do things. The monitor should be able to understand that a test result failed and update the returned result in the following ways:
- As it processes test results that have not been processed, it can inspect test results and note failures. This is efficient as we're already downloading and reading the results.
- Upon upload, we're tagging test runs with the work item names. Additionally, tag work item failure in some way.
- On retry, we query for appropriate tags and do not need to query for individual test results.
There was a problem hiding this comment.
Maybe we could upload a test run attachment with a list of failed tests in each work item
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
No description provided.