Skip to content

Add regression tests for the SSH probe timeout fix from #21686 - #21627

Closed
David Fowler (davidfowl) wants to merge 2 commits into
mainfrom
aspireagent/fix-ssh-probe-timeout
Closed

David Fowler (davidfowl) wants to merge 2 commits into
mainfrom
aspireagent/fix-ssh-probe-timeout

Conversation

@davidfowl

@davidfowl David Fowler (davidfowl) commented Nov 1, 2026 •

Copy link
Copy Markdown
Collaborator

Description

This PR only adds tests. The fix is in #21686, which is already on main. With that fix, the unattended OpenSSH -V probe in GitCommandRunner.VerifyOpenSshAsync waits up to 30s instead of 5s and still respects the caller's cancellation token. This PR adds end-to-end regression tests for that behavior and does not change production code or the spec.

Background

GitCommandRunnerTests.ConfigureUnattendedSsh_VerifiesOpenSshAndAppliesBatchModeAfterUrlRewrites failed on Windows Cli jobs with "Unattended Git requires a verified OpenSSH executable…" (job 124715227362). The TRX showed that the first cold launch of ssh.exe went past the old private 5s probe timeout. A working OpenSSH client was then reported as unsupported.

Tests added

tests/Aspire.Cli.Tests/Git/GitCommandRunnerTests.Authentication.cs gets two Unix tests that drive ConfigureUnattendedSshAsync through real Git with a fake ssh script:

  • ConfigureUnattendedSsh_SlowOpenSshVersionProbeIsAccepted: -V prints an OpenSSH_ banner after 6s, which is longer than the old 5s cap. The test asserts that the client is accepted and gets BatchMode=yes. Against the old 5s cap it failed in about 5.0s with the same GitCommandException seen in CI.
  • ConfigureUnattendedSsh_CallerCancellationStopsHungOpenSshVersionProbe: the probe never exits. Cancelling the caller's token after the probe starts throws OperationCanceledException, not the unsupported-SSH diagnostic.

These tests complement the unit tests #21686 added for VerifyOpenSshAsync. They exercise the full path from executable resolution to probe to GIT_SSH_COMMAND rewrite.

Contributes to #21600

Confidence

  • Behavior/regression: High. No production code changes. The slow-probe test reproduced the original failure against the old 5s cap and passes against Allow slow OpenSSH startup during unattended Git verification #21686's 30s limit.
  • Tests and pipelines run: All 90 tests in the GitCommandRunnerTests class pass locally on Linux on the merged head. CI "Final Results" is green on this head.
  • Build artifacts: Only test sources change. Aspire.Cli.Tests builds cleanly with 0 warnings and 0 errors, and CI build jobs passed.
  • E2E: Partial. The new tests run real Git with a fake OpenSSH client. The earlier manual aspire template source list run with a slow -V was done before this branch was merged with Allow slow OpenSSH startup during unattended Git verification #21686 and has not been repeated on this head.

How we stop this recurring: These tests fail if the OpenSSH probe timeout is shortened below a realistic cold start again, or if probe cancellation is reported as unsupported SSH.

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
    • No

🤖 Posted by AspireAgent (AI Agent)

The unattended-SSH verification ran `ssh -V` with a private 5s timeout. A
cold first launch of ssh.exe on Windows CI exceeded it, so a working
OpenSSH client was reported as "Unattended Git requires a verified OpenSSH
executable". This failed GitCommandRunnerTests on main.

The probe now uses the caller's acquisition deadline, like every other Git
child. A hung probe still ends at that deadline with the Git timeout
diagnostic.

Contributes to #21600

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 21627

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 21627"

@github-actions

This comment has been minimized.

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.

🟢 Approval recommended

No active review issues were identified in the change to caller-controlled SSH probe timeouts.

No open issues 🎉

What changed in this PR

This PR prevents slow-starting OpenSSH clients from being incorrectly rejected during unattended Git operations in the Aspire CLI. It addresses the timeout behavior exposed by inherited configuration-source acquisition.

Changes:

  • Removes the private five-second SSH version-probe timeout, relying on caller cancellation and deadlines.
  • Adds Unix regression tests for slow startup and cancellation of a hung probe.
  • Documents the caller-controlled timeout behavior.
File Description
tests/​Aspire.Cli.Tests/​Git/​GitCommandRunnerTests.Authentication.cs Adds fake-SSH tests covering slow startup and caller cancellation.
src/​Aspire.Cli/​Git/​GitCommandRunner.cs Removes the probe-specific timeout while retaining caller cancellation.
docs/​specs/​cli-config-sources.md Clarifies that OpenSSH verification uses the caller’s operation timeout.

Review effort: Balanced

@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

David Fowler (davidfowl) commented Nov 1, 2026 •

Copy link
Copy Markdown
Collaborator Author

CI attempt 1 on head 9bffa6ee53ce3ce909275fd337c6f11433a8345e (run 41264623857): 195 checks passed and 4 test jobs failed. None of the 4 failures involves this change, and all are tracked on #21600:

Attempt 2, which reruns the failed jobs, was queued automatically at 03:26:32Z. I made no extra rerun, so these jobs get exactly one rerun.

🤖 Posted by AspireAgent (AI Agent)

@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

Copy link
Copy Markdown
Collaborator Author

CI attempt 2 on head 9bffa6ee53ce3ce909275fd337c6f11433a8345e (run 41264623857, automatic rerun of the failed jobs):

The single permitted rerun is used, so I'm not rerunning again. The PR stays in draft until that job is green on this head, for example after #21608 lands or a maintainer reruns it.

🤖 Posted by AspireAgent (AI Agent)

Copy link
Copy Markdown
Collaborator Author

CI attempt 3 on head 9bffa6ee53ce3ce909275fd337c6f11433a8345e (run 41264623857, attempt 3): repo automation queued it at 04:15Z to retry the Windows tree-actions VS Code E2E job, which lost its runner on attempts 1 and 2. That loss is the known Windows hosted-runner infra issue (#21570), not a test failure. I didn't trigger another rerun.

Attempt 3 passed, so every check on this head is now green: 201 success, 16 skipped, 0 failing. There are no unresolved review threads, so I'm marking this PR ready for review.

🤖 Posted by AspireAgent (AI Agent)

@davidfowl
David Fowler (davidfowl) marked this pull request as ready for review November 1, 2026 04:24
@davidfowl David Fowler (davidfowl) added the ci-health Fixes CI flakiness or CI infrastructure (AspireAgent queue) label Nov 1, 2026 — with Copilot SWE Agent
@davidfowl David Fowler (davidfowl) added the agent:working An AI agent is actively working on this issue or PR label Nov 4, 2026 — with Copilot SWE Agent
@davidfowl David Fowler (davidfowl) removed the agent:working An AI agent is actively working on this issue or PR label Nov 4, 2026
@davidfowl David Fowler (davidfowl) added the agent:working An AI agent is actively working on this issue or PR label Nov 4, 2026 — with Copilot SWE Agent
…robe-timeout

# Conflicts:
#	docs/specs/cli-config-sources.md
#	src/Aspire.Cli/Git/GitCommandRunner.cs

Copy link
Copy Markdown
Collaborator Author

Merged main into this branch (7d6c028). main already landed an overlapping fix in #21686, so I kept its version of GitCommandRunner.cs and the spec text. That version caps the OpenSSH -V probe at 30s, honors caller cancellation and logs diagnostics. This PR's two end-to-end tests still apply, so I kept them: the slow 6s probe is accepted, and caller cancellation stops a hung probe. I renamed the slow-probe test to ..._SlowOpenSshVersionProbeIsAccepted because the probe is no longer bounded only by the caller's deadline. All 90 GitCommandRunnerTests pass locally.

🤖 Posted by AspireAgent (AI Agent)

@aspire-repo-bot
aspire-repo-bot Bot requested a balanced review from Copilot November 4, 2026 03:57
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Tests selector

1 / 101 PR test projects · 0 PR jobs, from 1 changed file.

Selected PR test projects (1 / 101)

Aspire.Cli.Tests

Selected PR jobs (0)

none


How these were chosen — grouped by what changed

🧪 tests/Aspire.Cli.Tests/Git/GitCommandRunnerTests.Authentication.cs (changed test)
→ 1 directly: Aspire.Cli.Tests

Job reasons

none


Selection computed for commit 7d6c028.

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

The new tests do not establish the claimed caller-only timeout behavior because production still enforces a documented 30-second limit, so the implementation or description needs alignment.

1 open issue

Review effort: Balanced

@davidfowl David Fowler (davidfowl) removed the agent:working An AI agent is actively working on this issue or PR label Nov 4, 2026
@davidfowl David Fowler (davidfowl) added the agent:working An AI agent is actively working on this issue or PR label Nov 4, 2026 — with Copilot SWE Agent
@davidfowl David Fowler (davidfowl) changed the title Don't report slow-starting OpenSSH as unsupported in unattended Git Add regression tests for the SSH probe timeout fix from #21686 Nov 4, 2026
@davidfowl David Fowler (davidfowl) removed the agent:working An AI agent is actively working on this issue or PR label Nov 4, 2026
@davidfowl David Fowler (davidfowl) added the agent:working An AI agent is actively working on this issue or PR label Nov 6, 2026 — with Copilot SWE Agent
@davidfowl David Fowler (davidfowl) removed the agent:working An AI agent is actively working on this issue or PR label Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-cli ci-health Fixes CI flakiness or CI infrastructure (AspireAgent queue)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants