Skip to content

Use retry orchestrator handshake in dotnet test - #56165

Open
Evangelink wants to merge 2 commits into
dotnet:mainfrom
Evangelink:dev/amauryleve/consume-retry-orchestrator-handshake
Open

Use retry orchestrator handshake in dotnet test#56165
Evangelink wants to merge 2 commits into
dotnet:mainfrom
Evangelink:dev/amauryleve/consume-retry-orchestrator-handshake

Conversation

@Evangelink

Copy link
Copy Markdown
Member

dotnet test currently enables retry-specific terminal output by inspecting the forwarded --retry-failed-tests argument. Newer Microsoft.Testing.Platform versions now identify the retry orchestrator through the handshake before launching the first test host, so the SDK can use the protocol signal instead of depending primarily on raw command-line parsing.

This change:

  • mirrors the OrchestratorFeature property and TestHostOrchestrator host type from the shared protocol constants;
  • recognizes RetryOrchestrator handshakes and enables retry rendering before attempt 1 starts;
  • accepts missing and unknown orchestrator features for backward and forward compatibility;
  • retains a clearly named command-line fallback for older supported MTP packages that do not send the orchestrator handshake;
  • adds focused handler, reporter, and fallback parsing coverage and updates the vendored-source divergence note.

The protocol handshake is authoritative when available. The legacy fallback remains intentionally because older MTP packages can support --retry-failed-tests without advertising the orchestrator capability.

Consume the testfx retry orchestrator capability before the first test-host attempt so retry UX no longer depends on parsing --retry-failed-tests from the command line.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings September 8, 2026 17:36
@Evangelink
Evangelink requested a review from a team as a code owner September 8, 2026 17:36
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
2 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

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

🟡 Changes recommended

The PR description states a command-line fallback for older platforms remains, but the implementation removes --retry-failed-tests detection without an equivalent fallback path, risking a regression in (try 1) rendering for older MTP versions.

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

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

New issues introduced by this change (2)
Severity Finding
Medium severity src/​Cli/​dotnet/​Commands/​Test/​MTP/​MicrosoftTestingPlatformTestCommand.cs — The PR description says a command-line fallback for older Microsoft.Testing.Platform versions is…
Low severity src/​Cli/​dotnet/​Commands/​Test/​MTP/​Terminal/​TerminalTestReporter.cs — This comment still refers to "fail[ing] to parse out the parameter" enabling retry on re-run, but…
What changed in this PR

This PR updates dotnet test’s terminal retry UX to rely on the Microsoft.Testing.Platform handshake (via a new OrchestratorFeature property on a TestHostOrchestrator host type) so retry rendering can be enabled before the first test-host attempt starts, rather than depending on command-line argument inspection.

Changes:

  • Adds/updates protocol constants to mirror OrchestratorFeature and TestHostOrchestrator, and updates the vendored-source tracking note accordingly.
  • Enables retry rendering when a TestHostOrchestrator handshake reports OrchestratorFeature=RetryOrchestrator, and makes retry enabling a monotonic (thread-safe) transition in the terminal reporter.
  • Adds focused tests covering retry-orchestrator handshake behavior and “enable retry before first assembly run” rendering.
File Description
test/​dotnet.Tests/​CommandTests/​Test/​TestApplicationHandlerTests.cs Adds handshake tests for retry orchestrator and unknown orchestrator behavior.
test/​dotnet.Tests/​CommandTests/​Test/​TerminalTestReporterTests.cs Adds coverage for enabling retry before the first assembly run to render (try 1).
src/​Cli/​dotnet/​Commands/​Test/​MTP/​TestApplicationHandler.cs Enables retry rendering based on orchestrator handshake feature detection.
src/​Cli/​dotnet/​Commands/​Test/​MTP/​Terminal/​TerminalTestReporter.cs Makes retry enabling monotonic and thread-safe; uses helper to enable retry when try count indicates retries.
src/​Cli/​dotnet/​Commands/​Test/​MTP/​MicrosoftTestingPlatformTestCommand.cs Stops enabling retry rendering via --retry-failed-tests argument inspection at startup (now starts with isRetry: false).
src/​Cli/​dotnet/​Commands/​Test/​CliConstants.cs Mirrors new handshake property and host-type constants for the wire contract.
eng/​vendored-files.json Updates vendored baseline and notes for the mirrored wire constants.

Comment thread src/Cli/dotnet/Commands/Test/MTP/MicrosoftTestingPlatformTestCommand.cs Outdated
Comment thread src/Cli/dotnet/Commands/Test/MTP/Terminal/TerminalTestReporter.cs Outdated
Keep attempt 1 retry rendering for older Microsoft.Testing.Platform versions that do not send the orchestrator handshake, and clarify the instance-based fallback.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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.

2 participants