Skip to content

JobMonitor: Consider work items with failed tests as failed - #17042

Merged
premun merged 19 commits into
dotnet:mainfrom
premun:prvysoky/failed-tests
Jun 25, 2026
Merged

premun merged 19 commits into
dotnet:mainfrom
premun:prvysoky/failed-tests

Conversation

@premun

@premun premun commented Jun 24, 2026

Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings June 24, 2026 13:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 AllPassed signal) 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.

Copilot AI review requested due to automatic review settings June 24, 2026 14:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 6 comments.

Comment thread azure-pipelines-pr.yml Resolved
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Copilot AI review requested due to automatic review settings June 24, 2026 15:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 4 comments.

@mmitche mmitche left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copilot AI review requested due to automatic review settings June 25, 2026 07:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.

Copilot AI review requested due to automatic review settings June 25, 2026 12:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.

Copilot AI review requested due to automatic review settings June 25, 2026 13:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Copilot AI review requested due to automatic review settings June 25, 2026 14:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ? "✅" : "❌",

@premun

premun commented Jun 25, 2026

Copy link
Copy Markdown
Member Author

@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)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could upload a test run attachment with a list of failed tests in each work item

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did that in a454022

Copilot AI review requested due to automatic review settings June 25, 2026 15:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Copilot AI review requested due to automatic review settings June 25, 2026 15:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.

@premun
premun enabled auto-merge (squash) June 25, 2026 19:26
@premun

premun commented Jun 25, 2026

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@premun
premun merged commit 7013d9d into dotnet:main Jun 25, 2026
9 of 10 checks passed
@premun
premun deleted the prvysoky/failed-tests branch June 26, 2026 08:10
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-preview7 milestone Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants