Skip to content

JobMonitor: emit failed work item errors as Azure DevOps task.logissue entries#16879

Open
Copilot wants to merge 4 commits into
mainfrom
copilot/add-job-monitor-timeline-logging
Open

JobMonitor: emit failed work item errors as Azure DevOps task.logissue entries#16879
Copilot wants to merge 4 commits into
mainfrom
copilot/add-job-monitor-timeline-logging

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 23, 2026

Failed Helix work item details were previously easy to miss in Azure DevOps timeline issue surfacing. This change now emits explicit Azure DevOps error issue commands (##vso[task.logissue type=error]) for failed work items (including console links), while preserving error-level logging.

To double check:

  • Problem addressed

    • Failed work item console-link output is now emitted in Azure DevOps issue-command format so it is surfaced in timeline errors.
  • Code changes

    • /src/Microsoft.DotNet.Helix/JobMonitor/JobMonitorRunner.cs
      • LogFailedWorkItemConsoleLinks(...) now writes failed work item messages to stderr using:
        • ##vso[task.logissue type=error]❌ Work item ...
        • ##vso[task.logissue type=error]Console: ...
      • Keeps corresponding LogError(...) output aligned with the same format.
    • /src/Microsoft.DotNet.Helix/Sdk.Tests/Microsoft.DotNet.Helix.Sdk.Tests/JobMonitorRunnerTests.cs
      • Updated CompletedHelixJob_LogsFailedWorkItemConsoleLinks to validate error messages contain ##vso[task.logissue type=error].
  • Example

    Console.Error.WriteLine($"##vso[task.logissue type=error]❌ Work item '{workItem.Name}' in job '{helixJob.DisplayName}' failed ({state}).");
    Console.Error.WriteLine($"##vso[task.logissue type=error]Console: {consoleOutputText}");
  • The right tests are in and the right validation has happened. Guidance: https://github.com/dotnet/arcade/blob/main/Documentation/Validation.md

Copilot AI requested review from Copilot and removed request for Copilot May 23, 2026 01:43
Agent-Logs-Url: https://github.com/dotnet/arcade/sessions/bfd5dce1-f05b-456b-a8f2-c54b074bd9ba

Co-authored-by: mmitche <8725170+mmitche@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot May 23, 2026 01:48
Copilot AI changed the title [WIP] Add job monitor errors to AzDO build timeline JobMonitor: promote failed work item console links to error timeline entries May 23, 2026
Copilot AI requested a review from mmitche May 23, 2026 01:52
premun
premun previously approved these changes May 25, 2026
@premun premun marked this pull request as ready for review May 25, 2026 09:00
Copilot AI review requested due to automatic review settings May 25, 2026 09:00
@premun
Copy link
Copy Markdown
Member

premun commented May 25, 2026

@copilot the timeline still doesn't have the error about the failed work item. Maybe you need to use the ##[error] notation (or how is it exactly)?

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 improves Helix JobMonitor diagnostics in Azure DevOps by emitting failed work item console-link details at error level so they surface in timeline error reporting, rather than being easy-to-miss informational output.

Changes:

  • Promoted per-failed-work-item console-link logging from LogInformation to LogError.
  • Updated the test logger to capture error-level messages and added an assertion verifying the failed work item message is logged as an error.

Reviewed changes

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

File Description
src/Microsoft.DotNet.Helix/JobMonitor/JobMonitorRunner.cs Logs failed work item console links via LogError to improve visibility in Azure DevOps timeline error surfacing.
src/Microsoft.DotNet.Helix/Sdk.Tests/Microsoft.DotNet.Helix.Sdk.Tests/JobMonitorRunnerTests.cs Extends the recording logger to track error messages and asserts the failure console-link output is emitted at error level.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 25, 2026

@copilot the timeline still doesn't have the error about the failed work item. Maybe you need to use the ##[error] notation (or how is it exactly)?

Addressed in 8ab2acf. Failed work items now emit explicit Azure DevOps error lines using ##[error] (for both the failure summary line and the console-link line), and tests were updated to assert those lines are written.

Assert.Contains(logger.Messages, message =>
message.Contains($"Work item 'wi-fail' in job 'helix-linux' failed (Finished, exit code 1).{Environment.NewLine}Console: https://helix.example/wi-fail/console", StringComparison.Ordinal));
Assert.Contains(logger.ErrorMessages, message =>
message.Contains($"Work item 'wi-fail' in job 'helix-linux' failed (Finished, exit code 1).{Environment.NewLine}Console: https://helix.example/wi-fail/console", StringComparison.Ordinal));
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.

@copilot Validate that the error messages contain: '##vso[task.logissue type=error]'

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated in 967c155 and 9b337ee. The failed work item error assertions now validate ##vso[task.logissue type=error], and the monitor now writes those task.logissue error lines directly to stderr for Azure DevOps parsing.

@mmitche
Copy link
Copy Markdown
Member

mmitche commented May 26, 2026

When writing the error, you need to put in '##vso[task.logissue type=error]'. to get it to show in the timeline.

Copilot AI requested review from Copilot and removed request for Copilot May 26, 2026 15:01
Copilot AI changed the title JobMonitor: promote failed work item console links to error timeline entries JobMonitor: emit failed work item errors as Azure DevOps task.logissue entries May 26, 2026
Copilot AI requested a review from mmitche May 26, 2026 15:02
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.

Job Monitor errors and failed work item info should make it into the timeline

4 participants