Skip to content

Prompt for an AppHost when a directory launch is ambiguous - #19541

Merged
Adam Ratzman (adamint) merged 7 commits into
microsoft:mainfrom
SankeerthNara:VS-Code-Aspire-debug-adapter
Aug 21, 2026
Merged

Adam Ratzman (adamint) merged 7 commits into
microsoft:mainfrom
SankeerthNara:VS-Code-Aspire-debug-adapter

Conversation

@SankeerthNara

Copy link
Copy Markdown
Contributor

Description

When a debug configuration's program points at a workspace directory
rather than a specific AppHost file, the extension previously handed
the directory straight to the Aspire CLI. If that directory contained
two or more buildable AppHosts with no configured default, the CLI
failed inside the non-interactive launch instead of prompting — there
was no way to tell it which AppHost you meant.

AspireDebugSession now discovers AppHost candidates for the directory
before spawning the CLI:

  • Zero or one buildable candidate, or a single configured/selected
    default: unchanged, no prompt.
  • Two or more buildable candidates with no default: a QuickPick lets
    you choose which AppHost to launch, and the CLI is invoked with an
    explicit --apphost pointing at the selection.
  • Cancelling the picker aborts the launch cleanly instead of letting
    the CLI fail.

This is one piece of the "Ambiguous workspaces prompt for an AppHost
instead of guessing or failing inside a non-interactive launch" exit
criterion tracked in #19405.

No new dependencies. AppHostDiscoveryService and the candidate-status
helpers this uses (findWorkspaceDefaultCandidate,
sortCandidatesByPath) already existed and are reused as-is.

Fixes #19280

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

Copilot AI balanced review requested due to automatic review settings August 20, 2026 13:47
@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 -- 19541

Or

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

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

Adds AppHost selection when a directory-based debug launch is ambiguous.

Changes:

  • Discovers buildable AppHosts before CLI launch.
  • Prompts for a candidate and handles cancellation.
  • Adds localization and unit coverage.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
extension/src/debugger/AspireDebugSession.ts Implements discovery and selection.
extension/src/debugger/AspireDebugAdapterDescriptorFactory.ts Injects discovery service.
extension/src/extension.ts Wires the service into the factory.
extension/src/test/aspireDebugSession.test.ts Adds selection and cancellation tests.
extension/src/loc/strings.ts Adds localized picker text.
extension/package.nls.json Registers the localization string.
Suppressed comments (1)

extension/src/debugger/AspireDebugSession.ts:1103

  • After this picker returns a concrete path, the launch still forwards the original default-discovery origin to the CLI. This was actually a user selection: AppHostSelectionOrigin defines user-selection for that case, and the existing picker path in AppHostLaunchService.ts:589 uses it. Track an effective origin and change it to user-selection when this picker selects a candidate so the CLI receives accurate provenance.
    return selected?.appHostPath;

Copilot AI review requested due to automatic review settings August 21, 2026 05:29

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

  • Files reviewed: 8/8 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@adamint Adam Ratzman (adamint) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Fixed the two open Copilot findings and moved ambiguous AppHost selection into the configuration provider, before the launch reservation and debug-session lifecycle. Full extension tests and the focused real Extension Host E2E pass. Looks good to me.

@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 2fcb1a1 into microsoft:main Aug 21, 2026
755 of 758 checks passed
@microsoft-github-policy-service microsoft-github-policy-service Bot added this to the 13.6 milestone Aug 21, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 9, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

VS Code Aspire debug adapter should prompt to select an AppHost when multiple are discovered

3 participants