Skip to content

Disable default timeout for HTTP commands - #18986

Merged
James Newton-King (JamesNK) merged 2 commits into
mainfrom
fix-http-command-timeout
Aug 6, 2026
Merged

James Newton-King (JamesNK) merged 2 commits into
mainfrom
fix-http-command-timeout

Conversation

@JamesNK

Copy link
Copy Markdown
Member

Description

HTTP resource commands that run for more than 100 seconds currently fail with the default HttpClient.Timeout, even though command execution already supports explicit cancellation from the dashboard.

This change removes the implicit timeout for HTTP commands that do not specify HttpCommandOptions.HttpClientName. Those commands now run until they complete or the command cancellation token is canceled. Named HTTP clients continue to honor their configured timeout.

User-facing usage

Long-running HTTP commands no longer require a named client solely to exceed 100 seconds:

resource.WithHttpCommand("/long-running-operation", "Run long operation");

Applications that need a finite timeout can continue to configure a named client and set HttpCommandOptions.HttpClientName.

Validation:

dotnet test --project tests/Aspire.Hosting.Tests/Aspire.Hosting.Tests.csproj --no-launch-profile -- --filter-class "*.WithHttpCommandTests" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"
Passed: 41, Failed: 0

Fixes # (issue)

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
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No

@github-actions

github-actions Bot commented Aug 4, 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 -- 18986

Or

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

@github-actions github-actions Bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Aug 4, 2026
@JamesNK James Newton-King (JamesNK) added the area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication label Aug 4, 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

This PR allows unnamed HTTP resource commands to run beyond the default 100-second HttpClient timeout while retaining cancellation support and preserving configured timeouts for named clients.

Changes:

  • Sets the timeout to infinite for HTTP commands without HttpClientName.
  • Adds regression coverage for unnamed and named client timeout behavior.

Reviewed changes

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

File Description
src/Aspire.Hosting/ResourceBuilderExtensions.cs Disables the default timeout for unnamed HTTP command clients.
tests/Aspire.Hosting.Tests/WithHttpCommandTests.cs Verifies unnamed clients have no timeout and named clients retain configured timeouts.

Comment thread src/Aspire.Hosting/ResourceBuilderExtensions.cs
@github-actions

This comment has been minimized.

@github-actions

github-actions Bot commented Aug 4, 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.

Comment thread src/Aspire.Hosting/ResourceBuilderExtensions.cs Outdated
Copilot AI review requested due to automatic review settings August 6, 2026 01:59

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.

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Tests selector (audit mode)

The full test matrix and all jobs still run in audit mode. The tests and jobs below are what selective CI would run under enforcement.

48 / 100 test projects · 4 jobs, from 3 changed files.

Selected test projects (48 / 100)

Aspire.EndToEnd.Tests, Aspire.Hosting.Analyzers.Tests, Aspire.Hosting.Azure.Kubernetes.Tests, Aspire.Hosting.Azure.Kusto.Tests, Aspire.Hosting.Azure.Tests, Aspire.Hosting.Blazor.Tests, Aspire.Hosting.Browsers.Tests, Aspire.Hosting.CodeGeneration.Go.Tests, Aspire.Hosting.CodeGeneration.Java.Tests, Aspire.Hosting.CodeGeneration.Python.Tests, Aspire.Hosting.CodeGeneration.Rust.Tests, Aspire.Hosting.CodeGeneration.TypeScript.Tests, Aspire.Hosting.Containers.Tests, Aspire.Hosting.DevTunnels.Tests, Aspire.Hosting.Docker.Tests, Aspire.Hosting.Dotnet.Tests, Aspire.Hosting.DotnetTool.Tests, Aspire.Hosting.EntityFrameworkCore.Tests, Aspire.Hosting.Foundry.Tests, Aspire.Hosting.Garnet.Tests, Aspire.Hosting.GitHub.Models.Tests, Aspire.Hosting.Go.Tests, Aspire.Hosting.JavaScript.Tests, Aspire.Hosting.Kafka.Tests, Aspire.Hosting.Keycloak.Tests, Aspire.Hosting.Kubernetes.Tests, Aspire.Hosting.Maui.Tests, Aspire.Hosting.Milvus.Tests, Aspire.Hosting.MongoDB.Tests, Aspire.Hosting.MySql.Tests, Aspire.Hosting.Nats.Tests, Aspire.Hosting.OpenAI.Tests, Aspire.Hosting.Oracle.Tests, Aspire.Hosting.Orleans.Tests, Aspire.Hosting.PostgreSQL.Tests, Aspire.Hosting.Python.Tests, Aspire.Hosting.Qdrant.Tests, Aspire.Hosting.RabbitMQ.Tests, Aspire.Hosting.Radius.Tests, Aspire.Hosting.Redis.Tests, Aspire.Hosting.RemoteHost.Tests, Aspire.Hosting.Seq.Tests, Aspire.Hosting.SqlServer.Tests, Aspire.Hosting.Testing.Tests, Aspire.Hosting.Tests, Aspire.Hosting.Valkey.Tests, Aspire.Hosting.Yarp.Tests, Aspire.Playground.Tests

Selected jobs (4)

deployment-e2e, extension-e2e, polyglot, typescript-api-compat


How these were chosen — grouped by what changed

⚠️ 43 of the 48 selected test projects come from a single change — src/Aspire.Hosting/ApplicationModel/HttpCommandOptions.cs.

🔧 src/Aspire.Hosting/ApplicationModel/HttpCommandOptions.cs (changed source)
→ 43 via the project graph

show 43

Aspire.Hosting.Analyzers.Tests (2 hops), Aspire.Hosting.Azure.Kubernetes.Tests (2 hops), Aspire.Hosting.Azure.Kusto.Tests (2 hops), Aspire.Hosting.Azure.Tests, Aspire.Hosting.Browsers.Tests (2 hops), Aspire.Hosting.CodeGeneration.Go.Tests, Aspire.Hosting.CodeGeneration.Java.Tests, Aspire.Hosting.CodeGeneration.Python.Tests, Aspire.Hosting.CodeGeneration.Rust.Tests, Aspire.Hosting.CodeGeneration.TypeScript.Tests, Aspire.Hosting.Containers.Tests (2 hops), Aspire.Hosting.DevTunnels.Tests (2 hops), Aspire.Hosting.Docker.Tests (2 hops), Aspire.Hosting.DotnetTool.Tests (2 hops), Aspire.Hosting.EntityFrameworkCore.Tests (2 hops), Aspire.Hosting.Foundry.Tests (2 hops), Aspire.Hosting.Garnet.Tests (2 hops), Aspire.Hosting.GitHub.Models.Tests (2 hops), Aspire.Hosting.Go.Tests (2 hops), Aspire.Hosting.JavaScript.Tests (2 hops), Aspire.Hosting.Kafka.Tests (2 hops), Aspire.Hosting.Keycloak.Tests (2 hops), Aspire.Hosting.Kubernetes.Tests (2 hops), Aspire.Hosting.Maui.Tests, Aspire.Hosting.Milvus.Tests (2 hops), Aspire.Hosting.MongoDB.Tests (2 hops), Aspire.Hosting.MySql.Tests (2 hops), Aspire.Hosting.Nats.Tests (2 hops), Aspire.Hosting.OpenAI.Tests (2 hops), Aspire.Hosting.Oracle.Tests (2 hops), Aspire.Hosting.Orleans.Tests (2 hops), Aspire.Hosting.PostgreSQL.Tests (2 hops), Aspire.Hosting.Python.Tests (2 hops), Aspire.Hosting.Qdrant.Tests (2 hops), Aspire.Hosting.RabbitMQ.Tests (2 hops), Aspire.Hosting.Redis.Tests (2 hops), Aspire.Hosting.RemoteHost.Tests, Aspire.Hosting.Seq.Tests (2 hops), Aspire.Hosting.SqlServer.Tests (2 hops), Aspire.Hosting.Testing.Tests (2 hops), Aspire.Hosting.Valkey.Tests (2 hops), Aspire.Hosting.Yarp.Tests (2 hops), Aspire.Playground.Tests

🧪 tests/Aspire.Hosting.Tests/WithHttpCommandTests.cs (changed test)
→ 1 directly: Aspire.Hosting.Tests
→ 3 via the project graph: Aspire.Hosting.Blazor.Tests, Aspire.Hosting.Dotnet.Tests, Aspire.Hosting.Radius.Tests

📦 affected project Aspire.Hosting
→ 1 test: Aspire.EndToEnd.Tests

Job reasons

Job Triggered by
deployment-e2e affected project Aspire.Hosting.Azure
extension-e2e • src/Aspire.Hosting/ApplicationModel/HttpCommandOptions.cs, src/Aspire.Hosting/ResourceBuilderExtensions.cs
• affected project Aspire.Hosting
polyglot affected project Aspire.Hosting.Python
typescript-api-compat affected project Aspire.Hosting

Selection computed for commit b5b1b7a.

@github-actions

github-actions Bot commented Aug 6, 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.

@JamesNK
James Newton-King (JamesNK) merged commit 0164666 into main Aug 6, 2026
677 of 680 checks passed
@JamesNK
James Newton-King (JamesNK) deleted the fix-http-command-timeout branch August 6, 2026 02:35
@github-actions github-actions Bot added this to the 13.5 milestone Aug 6, 2026
@aspire-repo-bot

This comment has been minimized.

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

⚠️ CI Failure Analysis: Possible Flaky Test(s)

The CI build failed due to test failure(s) that appear unrelated to the PR changes. These may be flaky tests.

Suspected flaky test(s):

  • Aspire.Cli.Tests.Utils.EnvironmentCheckerTests.CheckAllAsync_TimedOutCheckReportsWarningAndContinues in job Tests / Cli / Cli (windows-latest)
    • Error: Assert.Collection() Failure: Item comparison failure
      ↓ (pos 1)
      Collection: [EnvironmentCheckResult { Category = "environment", Details = null, Fix = null, Link = null, Message = "Environment check 'test-environment' timed out aft"···, ··· }, EnvironmentCheckResult { Category = "environment", Details = null, Fix = null, Link = null, Message = "Environment check 'test-environment' timed out aft"···, ··· }]
      Error: Assert.Same() Failure: Values are not the same instance
      Expected: EnvironmentCheckResult { Category = "environment", Details = null, Fix = null, Link = null, Message = "Completed", ··· }
      Actual: EnvironmentCheckResult { Category = "environment", Details = null, Fix = null, Link = null, Message = "Environment check 'test-environment' timed out aft"···, ··· }
    • Stack Trace (first frames):
      at Aspire.Cli.Tests.Utils.EnvironmentCheckerTests.CheckAllAsync_TimedOutCheckReportsWarningAndContinues() in D:\a\aspire\aspire\tests\Aspire.Cli.Tests\Utils\EnvironmentCheckerTests.cs:line 55
      
    • Why likely flaky: The test is in Aspire.Cli.Tests which is unrelated to the PR's changes (HttpCommandOptions in Aspire.Hosting). The failure is a timing issue: a check that was expected to 'Complete' instead timed out, suggesting CI resource contention on the Windows runner caused the check to exceed its timeout threshold.

Suggested actions:

  • Re-run the failed CI jobs to confirm if the failure is intermittent
  • If the test continues to fail, consider quarantining it using /quarantine-test <test name> <issue URL>
  • Search existing issues to see if this test is already known to be flaky

You can re-run the failed jobs from the workflow run page.

@aspire-repo-bot

Copy link
Copy Markdown
Contributor

📝 Documentation has been drafted in microsoft/aspire.dev#1515 targeting release/13.5.

Added a new HTTP command timeouts section to src/frontend/src/content/docs/fundamentals/http-commands.mdx, explaining that unnamed HTTP commands now use Timeout.InfiniteTimeSpan and how to opt into a finite timeout via HttpCommandOptions.HttpClientName with a named, timeout-configured HttpClient.

  • Files modified: src/frontend/src/content/docs/fundamentals/http-commands.mdx

Note

This draft PR needs human review before merging.

@github-actions github-actions Bot locked and limited conversation to collaborators Sep 17, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants