Skip to content

Extend AppHost debug startup timeout from VS Code#18353

Open
adamint wants to merge 11 commits into
microsoft:mainfrom
adamint:fix-18021-extension-start-timeout
Open

Extend AppHost debug startup timeout from VS Code#18353
adamint wants to merge 11 commits into
microsoft:mainfrom
adamint:fix-18021-extension-start-timeout

Conversation

@adamint

@adamint adamint commented Jun 19, 2026

Copy link
Copy Markdown
Member

Description

Sets a long default ASPIRE_CLI_START_TIMEOUT for VS Code extension-managed AppHost debug sessions so pausing on a breakpoint before builder.Build() does not let the parent Aspire CLI hit its normal startup timeout and terminate the debug session.

The default only applies to extension-managed debug launches. Extension-managed run sessions keep the normal CLI timeout, and an explicitly configured ASPIRE_CLI_START_TIMEOUT still wins, including case-insensitive Windows env overrides.

This also aligns the parent CLI's AppHost backchannel wait with a larger configured AppHost startup timeout. That keeps the extension-launched AppHost path from timing out the backchannel before the configured startup timeout expires.

Follow-up review fixes:

  • Redact hidden CLI spawn diagnostics after the -- delimiter so resource command argument values, including secret prompt values, are not persisted in extension logs.
  • Merge caller-provided spawn environment variables case-insensitively on Windows, and report the effective startup timeout in diagnostics with the same lookup.

Fixes #18021

Validation:

  • ./restore.sh
  • dotnet test --project tests/Aspire.Cli.Tests/Aspire.Cli.Tests.csproj --no-launch-profile -- --filter-class "*.DotNetCliRunnerTests" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true" (63 passed)
  • cd extension && ./build.sh
  • cd extension && corepack yarn run compile-tests
  • cd extension && corepack yarn run compile && corepack yarn run lint
  • cd extension && ./node_modules/.bin/vscode-test --config .vscode-test-short.mjs --grep "spawnCliProcess tests" with short --user-data-dir (5 passed; temporary config removed)
  • cd extension && ./node_modules/.bin/vscode-test --config .vscode-test-short.mjs with short --user-data-dir (full VS Code unit suite exited 0; temporary config removed)
  • Focused local debugStartupTimeout E2E was attempted, but local fixture restore was blocked before the scenario by NU1507 package-source mapping warning-as-error from the local NuGet source configuration.
  • Current CI head a783cccaa36d44965115821828818ebd66569cc2: VS Code extension E2E debug-startup-timeout Linux and Windows shards passed. Linux diagnostics include an mp4 recording; both shards show ASPIRE_CLI_START_TIMEOUT=86400 and a ~65s pre-builder.Build() delay completing without timeout. The first full CI attempt hit a DoctorCommand_TypeScriptAppHostReportsMissingConfiguredToolchain(toolchain: "yarn") timeout in Cli.EndToEnd-DoctorCommandTests; rerunning failed jobs passed and the full CI run is now green.

Review panel:

  • Architecture/simplicity: Opus high (reviewing-aspire-architecture), no blocking findings
  • Edge cases/regressions: GPT-5.5 high, no blocking findings
  • Domain review: Opus high using Aspire code-review guidance, no blocking findings after fixes
  • PR tester proof: GPT-5.4 high, current-head Linux/Windows E2E artifacts verified real Extension Host proof; failed CI rerun passed

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

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 19, 2026 23:29
@github-actions

github-actions Bot commented Jun 19, 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 -- 18353

Or

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

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 fixes issue #18021, where a VS Code extension debug session was killed after ~2 minutes when the developer paused on a breakpoint before builder.Build(). The parent Aspire CLI's default AppHost startup timeout (ASPIRE_CLI_START_TIMEOUT, ~120s) would elapse while the AppHost was paused, terminating the session. The fix has the extension inject a very long default startup timeout (86400 = 24h) only for extension-managed debug launches, while leaving run sessions and explicitly configured timeouts untouched.

Changes:

  • Add ASPIRE_CLI_START_TIMEOUT to the extension's EnvironmentVariables enum.
  • In AspireTerminalProvider.createEnvironment, set ASPIRE_CLI_START_TIMEOUT='86400' for debug sessions (noDebug === false) unless the value is already present in the environment.
  • Add unit tests covering debug (sets timeout), run (no timeout), and explicit-override (preserved) cases, with proper env-var save/restore in setup/teardown.
Show a summary per file
File Description
extension/src/utils/environment.ts Adds the ASPIRE_CLI_START_TIMEOUT enum member so the timeout key is referenced consistently.
extension/src/utils/AspireTerminalProvider.ts Sets the long default startup timeout for extension-managed debug sessions, respecting any explicit value.
extension/src/test/aspireTerminalProvider.test.ts Adds tests for the new behavior with env-var isolation in setup/teardown.

Notes:

  • The precedence logic is correct: env is seeded from process.env, so an explicitly configured ASPIRE_CLI_START_TIMEOUT is preserved (verified by the test at lines 586–598).
  • The noDebug === false check matches the existing convention in this method (lines 282–283) for distinguishing Debug vs NoDebug sessions, and the value is consumed by the CLI's CliConfigNames.AppHostStartupTimeout as integer seconds.
  • One optional nit was raised about documenting the '86400' magic number, consistent with the surrounding WHY-commented code.

Copilot's findings

  • Files reviewed: 3/3 changed files
  • Comments generated: 1

Comment thread extension/src/utils/AspireTerminalProvider.ts Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 20, 2026 02:53

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's findings

  • Files reviewed: 3/3 changed files
  • Comments generated: 0 new

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@adamint adamint marked this pull request as ready for review June 20, 2026 03:14
Copilot AI review requested due to automatic review settings June 20, 2026 03:14

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's findings

  • Files reviewed: 3/3 changed files
  • Comments generated: 1

Comment thread extension/src/utils/AspireTerminalProvider.ts
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 20, 2026 03:36
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

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's findings

  • Files reviewed: 3/3 changed files
  • Comments generated: 0 new

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 20, 2026 04:04

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's findings

  • Files reviewed: 5/5 changed files
  • Comments generated: 0 new

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

@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.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 20, 2026 07:23

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's findings

  • Files reviewed: 10/10 changed files
  • Comments generated: 0 new

@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.

Adam Ratzman and others added 3 commits June 20, 2026 14:01
Redact resource command values from hidden CLI spawn diagnostics and merge caller-provided environment variables case-insensitively on Windows so launch configuration overrides win over extension defaults.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Read the configured startup timeout case-insensitively on Windows so diagnostics reflect the child process environment after launch configuration overrides are merged.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 20, 2026 19:13

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's findings

  • Files reviewed: 10/10 changed files
  • Comments generated: 1

Comment thread src/Aspire.Cli/DotNet/DotNetCliRunner.cs
@adamint

adamint commented Jun 20, 2026

Copy link
Copy Markdown
Member Author

(automated comment) Validation/evidence update for current head a783cccaa36d44965115821828818ebd66569cc2:

  • Local: ./restore.sh passed.
  • Local: dotnet test --project tests/Aspire.Cli.Tests/Aspire.Cli.Tests.csproj --no-launch-profile -- --filter-class "*.DotNetCliRunnerTests" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true" passed (63/63).
  • Local: cd extension && ./build.sh, corepack yarn run compile-tests, corepack yarn run compile && corepack yarn run lint passed.
  • Local: VS Code unit tests required a short --user-data-dir because the DevDrive worktree path hits the VS Code IPC socket limit; targeted spawnCliProcess tests passed (5/5), and the full VS Code unit suite exited 0 with the short config.
  • Real-path proof: current CI debug-startup-timeout E2E passed on Linux and Windows:

Focused local E2E was attempted, but local fixture restore failed before the scenario with NU1507 package-source mapping warning-as-error from the local NuGet source configuration. CI has the strongest real Extension Host proof for this path.

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.

VS Code Extension shouldn't kill a debug session if broken on a Breakpoint for over 2 minutes

2 participants