Skip to content

[release/10.0] Backport Helix Job Monitor - #17454

Merged
mmitche merged 56 commits into
release/10.0from
premun-backport-helix-job-monitor
Sep 1, 2026
Merged

mmitche merged 56 commits into
release/10.0from
premun-backport-helix-job-monitor

Conversation

@premun

@premun premun commented Aug 31, 2026

Copy link
Copy Markdown
Member

Backports the complete Helix Job Monitor feature from main to release/10.0, including the C# monitor implementation, Helix SDK integration, generated client support, Azure Pipelines templates, documentation, and tests. Release-branch adaptations preserve existing public APIs and .NET Framework support. Validated with the targeted Helix SDK test suite and a net472 JobSender build.

premun and others added 30 commits August 31, 2026 16:22
 - Add Helix job cancellation support via IHelixService
 - Fix work item failure detection (handle null ExitCode in WorkItemSummary)
 - Improve AzureDevOps rate limit handling to apply delays correctly
 - Fix test result file collection and post command directory handling
 - Enhance logging: collection URI/team project details, running queue info,
   and improved test result upload messages
 - Update documentation to clarify AzDO test run name markers vs tags
 - Remove unused toolSource parameter from helix-job-monitor template
 - Properly dispose HttpClient
 - Tweak Arcade PR pipeline step names and timeouts
…RL+C / SIGTERM) (#16877)

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: mmitche <[email protected]>
Co-authored-by: Přemek Vysoký <[email protected]>
…ut/cancellation (#16878)

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: mmitche <[email protected]>
Co-authored-by: Alexander Köplinger <[email protected]>
Co-authored-by: Matt Mitchell <[email protected]>
… and remove log emojis (#16952)

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: Premek Vysoky <[email protected]>
…ain refactor merge (#16973)

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: Michael Simons <[email protected]>
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Co-authored-by: Copilot <[email protected]>
…to Helix 404) (#17130)

Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
@premun

premun commented Aug 31, 2026

Copy link
Copy Markdown
Member Author

@copilot fix the proble mdescribed in #17454 (comment)

Copilot AI review requested due to automatic review settings August 31, 2026 15:36

Copilot AI commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

@copilot fix the proble mdescribed in #17454 (comment)

Fixed in 583d5ac: added VersionOverride="10.0.7" for Microsoft.Extensions.Logging.Abstractions in both RemoteExecutor csproj files, consistent with the other overrides there. Verified dotnet restore succeeds without NU1109 for both projects.

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.

🟡 Changes recommended

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (2)

src/Microsoft.DotNet.Helix/JobMonitor/Services/HelixService.cs:240

  • Job.DetailsAsync is invoked without the provided cancellationToken, preventing prompt cancellation during shutdown/timeout while resubmitting work items.
    src/Microsoft.DotNet.Helix/JobMonitor/Services/HelixService.cs:195
  • ListWorkItemsAsync accepts a cancellationToken but doesn't pass it to Helix WorkItem.ListAsync, so the request won't be cancelable during monitor shutdown/timeout.
  • Files reviewed: 102/105 changed files
  • Comments generated: 1
  • Review effort level: Lite

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

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.

🔵 Needs a closer look

Review details

Suppressed comments (3)

Previously missed (3) — in code that hasn't changed since the last review.

src/Microsoft.DotNet.Helix/JobMonitor/WorkItemExtensions.cs:18

  • IsFailed uses the lifted nullable comparison workItem.ExitCode != 0. When ExitCode is null this evaluates to true, so a work item with no exit code can be treated as failed even if its State is Finished. This can skew pass/fail counts and retry selection.

Consider explicitly checking HasValue/Value for the non-zero-exit-code case and using a case-insensitive state comparison.
src/Microsoft.DotNet.Helix/JobSender/JobDefinition.cs:263

  • This hardcoded Teams URL includes tenant/group identifiers and points to an internal channel that most repo consumers cannot access. Embedding this in build output can also unintentionally disclose internal routing details.

Consider removing the URL from the product or making it opt-in/configurable (e.g., empty by default on public builds).
src/Microsoft.DotNet.Helix/JobSender/JobDefinition.cs:312

  • Even if the link is retained, logging it unconditionally can be noisy and (if the URL is internal) unhelpful for most users. Gate this log line on the URL being set and avoid referencing an internal-only channel name in the message.
  • Files reviewed: 102/105 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

Copilot AI review requested due to automatic review settings August 31, 2026 15:51

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.

🟡 Changes recommended

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (4)

Previously missed (1) — in code that hasn't changed since the last review.

src/Microsoft.DotNet.Helix/JobSender/HelixApiExtensions.cs:33

  • The new two-callback SendAsync extension drops logging entirely for non-JobDefinition implementations when log is null but queueStatsLog is provided, because it always delegates using only log. This can unintentionally suppress all logs for legacy/custom IJobDefinition implementations.

src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Aggregate.cs:639

  • This endpoint appends Properties using Client.Serialize(properties), which does not match the dictionary-style query encoding required for Helix property filters (Properties[key]=value). As a result, property-based filtering will not work correctly here.
            if (properties != default(IImmutableDictionary<string, string>))
            {
                _url.AppendQuery("Properties", Client.Serialize(properties));
            }

src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Aggregate.cs:887

  • properties is being appended via Client.Serialize(properties) instead of the dictionary-based query encoding (Properties[key]=value). This likely results in an unusable filter on the service side.
            if (properties != default(IImmutableDictionary<string, string>))
            {
                _url.AppendQuery("Properties", Client.Serialize(properties));
            }

src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Aggregate.cs:1069

  • The Properties query parameter is being added as a serialized blob (Client.Serialize(properties)) instead of the expected dictionary query format (Properties[key]=value). This will prevent property filtering from working for this call.
            if (properties != default(IImmutableDictionary<string, string>))
            {
                _url.AppendQuery("Properties", Client.Serialize(properties));
            }
  • Files reviewed: 102/105 changed files
  • Comments generated: 3
  • Review effort level: Lite

Comment on lines +520 to +523
if (properties != default(IImmutableDictionary<string, string>))
{
_url.AppendQuery("Properties", Client.Serialize(properties));
}
Comment thread tests/UnitTests.proj
Comment on lines +19 to +24
<!-- Use the standalone Helix Job Monitor pipeline job to publish test results,
instead of the in-build Python reporter. The corresponding monitor job is
configured in the Arcade pipeline YAML. -->
<EnableHelixJobMonitor>true</EnableHelixJobMonitor>

<EnableShowHelixQueueStats>true</EnableShowHelixQueueStats>
Comment on lines 14 to 21
<PropertyGroup>
<HelixType>test/product/</HelixType>
<TestRunNamePrefix>$(AGENT_JOBNAME)</TestRunNamePrefix>
<IncludeXHarnessCli>true</IncludeXHarnessCli>
<EnableAzurePipelinesReporter>true</EnableAzurePipelinesReporter>
<HelixBaseUri>https://helix.dot.net</HelixBaseUri>
<EnableHelixJobMonitor>true</EnableHelixJobMonitor>
</PropertyGroup>
Copilot AI review requested due to automatic review settings August 31, 2026 15:56

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.

🟡 Changes recommended

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (6)

Previously missed (2) — in code that hasn't changed since the last review.

tests/XHarness.Tests.Common.props:20

  • EnableHelixJobMonitor is set unconditionally, but this props file explicitly supports non-CI local runs (see the AGENT_JOBNAME condition below). With the monitor enabled, Helix SDK overrides WaitForWorkItemCompletion to false, so local runs will submit Helix jobs and exit without waiting or publishing results.

Consider enabling the monitor only when running under Azure Pipelines (e.g., when $(AGENT_JOBNAME) is set) so local runs preserve the legacy inline behavior.
src/Microsoft.DotNet.Helix/Sdk/Readme.md:193

  • The documentation references the tool package id as microsoft.dotnet.helix.jobmonitor, but the pipeline template defaults to Microsoft.DotNet.Helix.JobMonitor and the project name (and thus default NuGet package id) is Microsoft.DotNet.Helix.JobMonitor. For clarity and copy/paste correctness, align the doc's package id with the shipped id used by the templates.

This issue also appears in the following locations of the same file:

  • line 195
  • line 203
  • line 212

tests/UnitTests.proj:24

  • EnableHelixJobMonitor is set to true unconditionally. For local runs (where AGENT_JOBNAME is typically empty), this causes Helix submission to stop waiting for completion (via WaitForWorkItemCompletion=false), which makes tests/UnitTests.proj behave like a submit-only target when run locally.

If the intent is to use the monitor only in CI, gate this property on $(AGENT_JOBNAME) (or another CI-specific signal) so local runs still wait/publish inline.
src/Microsoft.DotNet.Helix/Sdk/Readme.md:200

  • The darc get-asset example uses the lower-cased package id. If users copy/paste this alongside the pipeline templates (which default to Microsoft.DotNet.Helix.JobMonitor), it’s confusing. Consider using the same id consistently throughout this section.
    src/Microsoft.DotNet.Helix/Sdk/Readme.md:210
  • The darc add-dependency example should use the same package/tool name as the previous steps (Microsoft.DotNet.Helix.JobMonitor) to stay consistent with the shipped package id and pipeline defaults.
    src/Microsoft.DotNet.Helix/Sdk/Readme.md:220
  • The .config/dotnet-tools.json snippet should use the same package id key as the rest of the section (Microsoft.DotNet.Helix.JobMonitor) so consumers can copy/paste it without having to reconcile casing/naming differences.
  • Files reviewed: 102/105 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment on lines +9 to +15
internal static class WorkItemExtensions
{
extension(WorkItemSummary workItem)
{
/// <summary>
/// A Helix work item is considered failed if its exit code is non-zero
/// or its state is not the terminal success state ("Finished").
@mmitche
mmitche enabled auto-merge (squash) August 31, 2026 19:56
@premun

premun commented Sep 1, 2026

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

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

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.

7 participants