Skip to content

Make Helix Job Monitor uploads restart-safe#17179

Open
mmitche wants to merge 3 commits into
dotnet:mainfrom
mmitche:copilot/job-monitor-upload-lifecycle
Open

Make Helix Job Monitor uploads restart-safe#17179
mmitche wants to merge 3 commits into
dotnet:mainfrom
mmitche:copilot/job-monitor-upload-lifecycle

Conversation

@mmitche

@mmitche mmitche commented Jul 23, 2026

Copy link
Copy Markdown
Member

Summary

  • separate queued/in-progress/failed uploads from durably completed, tagged runs
  • retry transient test-result downloads while avoiding replay of ambiguous AzDO writes
  • stop permanent or exhausted uploads without hanging or changing Helix pass/fail
  • make transient per-file download failures retryable without skipping remaining files
  • add runner, adapter, publisher, and Helix service coverage

Stacking

This PR is stacked on #17178. Until that PR merges, its two documentation commits appear in this PR as well; the implementation commit is Make Job Monitor uploads restart-safe.

Closes #17173
Parent epic: #17171

mmitche added 3 commits July 23, 2026 08:26
Document the intended cancellation-first behavior and add representative invariant-to-test traceability.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>\nCopilot-Session: baa969a4-1d79-4b6a-a3f0-4d349d768b5e
Describe deduplication in terms of completed, tagged runs while preserving intentional replay of interrupted uploads.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>\nCopilot-Session: baa969a4-1d79-4b6a-a3f0-4d349d768b5e
Track upload lifecycle explicitly, retry only safe read operations, avoid replaying ambiguous writes, and keep incomplete runs untagged for later recovery.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>\nCopilot-Session: baa969a4-1d79-4b6a-a3f0-4d349d768b5e

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 hardens the Helix Job Monitor’s Azure DevOps test-result upload pipeline so it can be safely restarted after crashes/timeouts by separating durable completion (tagged runs) from queued/in-progress/failed uploads, and by bounding/targeting retries to avoid replaying ambiguous Azure DevOps writes.

Changes:

  • Introduces explicit upload lifecycle state tracking (queued/in-progress/durably-completed/failed) and updates the runner/queue to honor durable completion tags.
  • Adds transient-failure classification and bounded retries for safe (read-only) download operations while disabling retries for state-changing Azure DevOps operations.
  • Expands unit coverage across runner, services, publisher, and fakes for restart-safety and transient/permanent failure behaviors.

Reviewed changes

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

Show a summary per file
File Description
src/Microsoft.DotNet.Helix/Sdk.Tests/Microsoft.DotNet.Helix.Sdk.Tests/JobMonitorRunnerTests.cs Adds/updates scenarios asserting restart-safe behavior and non-replay of ambiguous uploads/completions.
src/Microsoft.DotNet.Helix/Sdk.Tests/Microsoft.DotNet.Helix.Sdk.Tests/HelixServiceTests.cs Adds coverage for transient per-file download failures while still attempting the full batch.
src/Microsoft.DotNet.Helix/Sdk.Tests/Microsoft.DotNet.Helix.Sdk.Tests/Fakes/FakeHelixService.cs Adds queued transient download failure injection to simulate retries.
src/Microsoft.DotNet.Helix/Sdk.Tests/Microsoft.DotNet.Helix.Sdk.Tests/Fakes/FakeAzureDevOpsService.cs Adds create/complete failure injection and tracks complete call counts for new behaviors.
src/Microsoft.DotNet.Helix/Sdk.Tests/Microsoft.DotNet.Helix.Sdk.Tests/AzureDevOpsServiceTests.cs Verifies create/complete do not retry ambiguous writes.
src/Microsoft.DotNet.Helix/Sdk.Tests/Microsoft.DotNet.Helix.Sdk.Tests/AzureDevOpsResultPublisherTests.cs Adds tests for configurable retry behavior for ambiguous writes.
src/Microsoft.DotNet.Helix/JobMonitor/TransientFailureDetector.cs New shared transient-failure classifier used by queue/services.
src/Microsoft.DotNet.Helix/JobMonitor/TestResultUploadQueue.cs Splits upload into phases with bounded retries for safe operations and non-replay of ambiguous writes.
src/Microsoft.DotNet.Helix/JobMonitor/Services/HelixService.cs Treats transient per-file failures as retryable after attempting remaining files; throws aggregated transient failure.
src/Microsoft.DotNet.Helix/JobMonitor/Services/AzureDevOpsService.cs Disables adapter-level transient retries for create/complete/attachment writes; disables publisher write retries; improves HttpRequestException status propagation.
src/Microsoft.DotNet.Helix/JobMonitor/MonitorState.cs Replaces “processed” set with explicit upload lifecycle state machine keyed by Helix job.
src/Microsoft.DotNet.Helix/JobMonitor/JobMonitorRunner.Design.md Updates behavioral spec to document restart-safe semantics and retry/non-replay rules.
src/Microsoft.DotNet.Helix/JobMonitor/JobMonitorRunner.cs Avoids marking jobs as processed at queue time; prevents duplicate enqueue within an invocation via state.
src/Microsoft.DotNet.Helix/AzureDevOpsTestPublisher/Model/AzureDevOpsReportingParameters.cs Adds RetryWrites parameter to control write retry behavior.
src/Microsoft.DotNet.Helix/AzureDevOpsTestPublisher/AzureDevOpsResultPublisher.cs Implements configurable retry count based on request method / write-retry configuration.

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

Comment on lines +552 to +553
internal static int GetRetryCount(HttpMethod method, bool retryWrites)
=> retryWrites || method == HttpMethod.Get ? 10 : 0;
@mmitche
mmitche marked this pull request as ready for review July 23, 2026 21:12
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: make test-result upload lifecycle explicit and resilient

3 participants