Skip to content

Extend DCP initialization timeout through API readiness - #19641

Merged
Adam Ratzman (adamint) merged 3 commits into
mainfrom
adamint-extend-dcp-initialization-timeout
Aug 25, 2026
Merged

Adam Ratzman (adamint) merged 3 commits into
mainfrom
adamint-extend-dcp-initialization-timeout

Conversation

@adamint

Copy link
Copy Markdown
Member

Description

#19636 gave initial DCP kubeconfig discovery and client creation a separate 60-second timeout, but its first CI run still timed out in the first DCP API operation after the client was initialized. A parsed kubeconfig does not mean DCP is ready to process requests yet.

This keeps the startup timeout through the first successful eager DCP API operation. Calls that start before readiness retain that startup budget; later calls use the existing 20-second retry budget. Lazy watches do not publish readiness, and Polly's timeout token now reaches the underlying Kubernetes requests so stalled requests are canceled.

The regression coverage now checks delayed kubeconfig creation, delayed first API success, the transition back to the steady-state timeout, and cancellation of a stalled HTTP request.

Follow-up to #19636.

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

Keep the initialization retry budget until an eager DCP API call succeeds, then use the normal steady-state budget. Propagate timeout cancellation into the Kubernetes client calls and cover both transitions.

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

Copilot-Session: 2faf8d87-e20d-4c7c-95cf-07abd6179e13
@github-actions

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 -- 19641

Or

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

@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 25, 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

Extends DCP initialization handling until the first successful API operation.

Changes:

  • Propagates Polly cancellation tokens to Kubernetes requests.
  • Tracks API readiness and adds timeout regression tests.
Show a summary per file
File Description
src/Aspire.Hosting/Dcp/KubernetesService.cs Extends startup retry handling through API readiness.
tests/Aspire.Hosting.Tests/Dcp/KubernetesServiceTests.cs Tests readiness, steady-state timeout, and cancellation.

Review details

  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Balanced

@github-actions

This comment has been minimized.

@github-actions

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
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idea is good but the code can be simplified--HTH

Adam Ratzman (adamint) and others added 2 commits August 25, 2026 14:17
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 14e6fead-9dad-4880-bdaf-75663b728b67
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 14e6fead-9dad-4880-bdaf-75663b728b67
Copilot AI review requested due to automatic review settings August 25, 2026 18:45
@github-actions

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.

50 / 102 test projects · 4 jobs, from 2 changed files.

Selected test projects (50 / 102)

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.Java.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.Rust.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

⚠️ 45 of the 50 selected test projects come from a single change — src/Aspire.Hosting/Dcp/KubernetesService.cs.

🔧 src/Aspire.Hosting/Dcp/KubernetesService.cs (changed source)
→ 45 via the project graph

show 45

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.Java.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.Rust.Tests (2 hops), 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/Dcp/KubernetesServiceTests.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/Dcp/KubernetesService.cs
• affected project Aspire.Hosting
polyglot affected project Aspire.Hosting.Rust
typescript-api-compat affected project Aspire.Hosting

Selection computed for commit 3c80369.

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.

Review details

Suppressed comments (1)

src/Aspire.Hosting/Dcp/KubernetesService.cs:494

  • The readiness state is sampled only after client initialization has awaited. A concurrent call that began while DCP was not ready can therefore observe true if another operation succeeds during that wait and receive only MaxRetryDuration, contrary to the stated requirement that calls started before readiness retain the startup budget. This is reachable because DcpResourceWatcher.Start() launches five watches concurrently. Capture the readiness state once at ExecuteWithRetry entry, before any await, and use that snapshot when selecting the retry duration.
            var retryDuration = Volatile.Read(ref _kubernetesApiReady)
                ? MaxRetryDuration
                : KubernetesInitializationTimeout;
  • Files reviewed: 2/2 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@github-actions

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.

@adamint
Adam Ratzman (adamint) merged commit 035747b into main Aug 25, 2026
773 of 777 checks passed
@adamint
Adam Ratzman (adamint) deleted the adamint-extend-dcp-initialization-timeout branch August 25, 2026 20:55
@github-actions github-actions Bot added this to the 13.6 milestone Aug 25, 2026
@aspire-repo-bot

Copy link
Copy Markdown
Contributor

✅ No documentation update needed.

Step 5 branch taken: docs_optional → internal_refactor

Triggered signals: no signals triggered (signal_count: 0 in .pr-docs-check/signals.json; excluded: false).

Allowlist justification (internal_refactor): The 2 changed files are src/Aspire.Hosting/Dcp/KubernetesService.cs (production code) and tests/Aspire.Hosting.Tests/Dcp/KubernetesServiceTests.cs (test code). The PR explicitly confirms "Did you add public API? No" and "Does the change make any security assumptions or guarantees? No" in its checklist. The change extends an internal DCP-initialization timeout to cover API readiness (not just kubeconfig parsing) and threads Polly's cancellation token into the underlying Kubernetes HTTP client — purely internal reliability/robustness work in Aspire.Hosting's DCP orchestration layer. No new/changed public types, options, flags, environment variables, or documented behavior are introduced; existing documented behavior (app host startup) is unaffected from a user-facing perspective, only made more resilient to a slow-starting DCP process. No docs page describes DCP startup timeout internals, so there is no gap to fill.

@github-actions

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):

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.

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

Labels

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