Skip to content

Job Monitor: Fail when no jobs submitted - #17216

Merged
premun merged 4 commits into
dotnet:mainfrom
premun:prvysoky/no-jobs
Jul 30, 2026
Merged

premun merged 4 commits into
dotnet:mainfrom
premun:prvysoky/no-jobs

Conversation

@premun

@premun premun commented Jul 29, 2026

Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings July 29, 2026 11:40

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

Updates the Helix Job Monitor to treat “no Helix jobs submitted for the monitored stage (across all attempts)” as a failure condition, ensuring pipelines don’t silently pass when Helix work never ran.

Changes:

  • Add a new terminal failure condition in JobMonitorRunner when AssociatedJobsCount == 0.
  • Add a dedicated error log line via StatusReporter.LogNoHelixJobsFailure().
  • Update multiple SDK test scenarios to expect exit code 1 when no Helix jobs exist (including stage-scoped monitoring cases), and assert the failure message in one test.

Reviewed changes

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

File Description
src/Microsoft.DotNet.Helix/Sdk.Tests/Microsoft.DotNet.Helix.Sdk.Tests/JobMonitorRunnerTests.cs Updates existing scenarios to assert exit code 1 when no Helix jobs are submitted; adds a log assertion for the new failure message.
src/Microsoft.DotNet.Helix/JobMonitor/StatusReporter.cs Adds LogNoHelixJobsFailure() to emit a dedicated error message for the new failure mode.
src/Microsoft.DotNet.Helix/JobMonitor/JobMonitorRunner.cs Implements the new “fail if no Helix jobs were ever observed” exit-code behavior after pipeline/Helix completion gating.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@akoeplinger

Copy link
Copy Markdown
Member

I have a feeling (but can't find a concrete example right now) that we might have cases where this is expected, should we add an escape hatch?

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Copilot AI review requested due to automatic review settings July 29, 2026 11:50
@premun premun changed the title Helix Job Monitor: Fail when no jobs submitted Job Monitor: Fail when no jobs submitted Jul 29, 2026

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 3 out of 3 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings July 29, 2026 13:32

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 6 out of 6 changed files in this pull request and generated no new 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.

Are you sure this is checking any attempt? Can you add a test with two jobs. First iteration, one job submits successful helix jobs, and the other submits nothing and fails. On retry, the other job submits nothing. The job monitor should not exit one on the retry attempt.

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 6 out of 6 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

src/Microsoft.DotNet.Helix/JobMonitor/StatusReporter.cs:213

  • The new "no Helix jobs" failure message is not very actionable on its own. Since the intended escape hatch is allowNoHelixJobs / --allow-no-helix-jobs, include that hint in the error text so users can immediately remediate expected-empty stages without needing to search docs.
        public void LogNoHelixJobsFailure()
        {
            LogError($"No Helix jobs were submitted by this stage in any attempt. Stage: '{_options.StageName}', BuildId: {_options.BuildId}.");
        }

@premun
premun enabled auto-merge (squash) July 30, 2026 15:51
@premun
premun merged commit be7c952 into dotnet:main Jul 30, 2026
15 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-rc1 milestone Aug 3, 2026
@premun
premun deleted the prvysoky/no-jobs branch August 10, 2026 10:46
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.

4 participants