Skip to content

Publish in-process retry attempts to Azure DevOps - #10845

Merged
Amaury Levé (Evangelink) merged 5 commits into
microsoft:mainfrom
Evangelink:dev/amauryleve/fix-azdo-retry-results
Aug 28, 2026
Merged

Amaury Levé (Evangelink) merged 5 commits into
microsoft:mainfrom
Evangelink:dev/amauryleve/fix-azdo-retry-results

Conversation

@Evangelink

@Evangelink Amaury Levé (Evangelink) commented Aug 28, 2026 •

Copy link
Copy Markdown
Member

Azure DevOps live publishing currently discards superseded in-process MSTest [Retry] executions. This hides failed attempts, reports incomplete duration data, and makes attachments such as Playwright traces inaccessible when a later attempt passes.

This change buffers in-process executions until the final outcome is known, then publishes the complete ordered history as rerun sub-results. Per-attempt durations and attachments flow through the existing sub-result ID mapping, and the same model composes with cross-process --retry-failed-tests attempts. Ambiguous folded data-driven rows, incomplete sequences, and attempts whose sub-result seed cannot be confirmed fall back to independent results so their diagnostics are preserved without being cross-wired. Final-attempt attachments retain their known parent target across seed cancellation and retry during session finalization.

Validation:

  • Built the affected extension and unit-test project across their target frameworks.
  • Ran all 144 Azure DevOps live-publishing tests on net8.0 and net9.0.
  • Verified against the real Azure DevOps Test Results API in run 43317118: failed Attempt# 0 retained its downloaded attachment, passing Attempt# 1 had none, and the parent had no misplaced attachments.

Fixes: #10839

Preserve every retry attempt, its duration, and failed-attempt attachments as ordered Azure DevOps sub-results, including when retries span multiple test hosts.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings August 28, 2026 14:29
@Evangelink Amaury Levé (Evangelink) added the state/needs-review Awaiting review from the team. label Aug 28, 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.

Copilot review overview

Review tier: Balanced
Findings: 1 High severity

New issues introduced by this change (1)
Severity Finding
High severity src/​Platform/​Microsoft.Testing.Extensions.AzureDevOpsReport/​AzureDevOpsTestResultsPublisher.cs — This identity collapses distinct folded data-driven rows when they share a title. MSTest emits…
What changed in this PR

Publishes complete in-process retry histories to Azure DevOps, including durations and attempt-specific attachments.

Changes:

  • Buffers and publishes retry attempts as ordered sub-results.
  • Composes in-process and cross-process retry histories.
  • Adds retry publishing tests and internal API baselines.
File Description
AzureDevOpsLivePublishingTests.cs Tests retry histories and attachments.
InternalAPI.Unshipped.txt Tracks new internal APIs.
AzureDevOpsTestResultsPublisher.Flush.cs Publishes attempts and attachments.
AzureDevOpsTestResultsPublisher.cs Aggregates in-process attempts.
AzureDevOpsResultIdStore.cs Stores multi-attempt histories.
AzureDevOpsLivePublishingModels.cs Adds previous-attempt data.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Track concurrent retry sequences by expected attempt number and publish folded rows independently when their retry identity is ambiguous.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings August 28, 2026 14:51
@Evangelink
Amaury Levé (Evangelink) enabled auto-merge (squash) August 28, 2026 14: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.

Copilot review overview

Review tier: Balanced
Findings: None

Issues resolved since last review (1)
Severity Finding
High severity src/​Platform/​Microsoft.Testing.Extensions.AzureDevOpsReport/​AzureDevOpsTestResultsPublisher.cs — This identity collapses distinct folded data-driven rows when they share a title. MSTest emits… View resolved comment
Suppressed comments (1)

src/Platform/Microsoft.Testing.Extensions.AzureDevOpsReport/AzureDevOpsTestResultsPublisher.cs:350

  • Buffered attempts can be silently lost if result delivery stops before the final attempt. SendTestResultsAsync checks cancellation before each result (TestExecutionManager.Runner.cs:24-32), so cancellation after reporting a superseded attempt leaves this sequence here; session finishing only flushes/counts _pendingResults and _retryResults (AzureDevOpsTestResultsPublisher.cs:452-485), not _inProcessRetrySequences. Drain unfinished sequences into _pendingResults before the final forced flush (and include them in dropped-result accounting) so already-executed attempts and their attachments are not discarded.
                sequences.Add(new InProcessRetrySequence(attempt));
                return null;

Drain retry sequences whose final result never arrives so executed attempts publish independently or appear in cancellation drop accounting.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings August 28, 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.

Copilot review overview

Review tier: Balanced
Findings: None

Suppressed comments (1)

src/Platform/Microsoft.Testing.Extensions.AzureDevOpsReport/AzureDevOpsTestResultsPublisher.Flush.cs:338

  • If this seed PATCH fails or is canceled, every buffered attempt except the final one is lost. The preceding POST sends only batch[i].Result (the final outcome); the cancellation path does not requeue the creation, and the non-cancellation fallback only moves earlier attachments onto the parent without publishing their outcomes, durations, or errors. This regresses the failure handling that was safe when a seed represented only the already-POSTed result. Preserve the buffered attempts as independent results (or make their initial publication atomic) whenever seeding cannot be confirmed.
                await SeedInitialAttemptsAsync(initialAttemptSeeds, deferredAttachments, cancellationToken).ConfigureAwait(false);
            }
            catch (OperationCanceledException ex)
            {
                throw new FirstAttemptSeedCanceledException(ex);

Requeue buffered earlier attempts as independent results when Azure DevOps cannot confirm the sub-result seed PATCH.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings August 28, 2026 15:30

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.

Copilot review overview

Review tier: Balanced
Findings: 1 Medium severity · 1 Low severity

New issues introduced by this change (2)
Severity Finding
Medium severity src/​Platform/​Microsoft.Testing.Extensions.AzureDevOpsReport/​AzureDevOpsTestResultsPublisher.Flush.cs — If the seed PATCH is canceled, only the earlier attempts are requeued here. The final attempt was…
Low severity src/​Platform/​Microsoft.Testing.Extensions.AzureDevOpsReport/​AzureDevOpsTestResultsPublisher.cs — The added tests only cover attempt 1 superseded followed by attempt 2 final, so no test executes…

Retry known-parent attachment uploads at session end and cover three-attempt in-process retry aggregation.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings August 28, 2026 15:50

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.

Copilot review overview

Review tier: Balanced
Findings: None

Issues resolved since last review (2)
Severity Finding
Low severity src/​Platform/​Microsoft.Testing.Extensions.AzureDevOpsReport/​AzureDevOpsTestResultsPublisher.cs — The added tests only cover attempt 1 superseded followed by attempt 2 final, so no test executes… View resolved comment
Medium severity src/​Platform/​Microsoft.Testing.Extensions.AzureDevOpsReport/​AzureDevOpsTestResultsPublisher.Flush.cs — If the seed PATCH is canceled, only the earlier attempts are requeued here. The final attempt was… View resolved comment

@Evangelink
Amaury Levé (Evangelink) merged commit f3b0ce9 into microsoft:main Aug 28, 2026
43 checks passed
@Evangelink
Amaury Levé (Evangelink) deleted the dev/amauryleve/fix-azdo-retry-results branch August 28, 2026 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state/needs-review Awaiting review from the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

--publish-azdo-test-results does not always publish retry attempts and their attachments

3 participants