Skip to content

[release/13.2] Fix aspire new: move OpenEditor after agent init prompt#15553

Open
adamint wants to merge 1 commit intomicrosoft:release/13.2from
adamint:backport/pr-15552-to-release-13.2
Open

[release/13.2] Fix aspire new: move OpenEditor after agent init prompt#15553
adamint wants to merge 1 commit intomicrosoft:release/13.2from
adamint:backport/pr-15552-to-release-13.2

Conversation

@adamint
Copy link
Member

@adamint adamint commented Mar 24, 2026

Description

Backport of #15552 to release/13.2.

Customer Impact

Testing

Manual testing

Risk

Low, the same operations are being performed. Workspace open is just being moved later

Regression?

It has been broken since the ai agent setup prompt was added

When running 'aspire new' from the VS Code extension, OpenEditor was called
immediately after template creation, which opened the new workspace and severed
the CLI terminal connection before the 'configure AI agent environments' prompt
could be shown.

Move OpenEditor to after PromptAndChainAsync so the full CLI interaction
completes before the workspace switches.

Fixes microsoft#15551
Copilot AI review requested due to automatic review settings March 24, 2026 22:12
@github-actions
Copy link
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 -- 15553

Or

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

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Backports a fix to the aspire new command so that, when invoked from the VS Code extension, the AI agent initialization prompt can complete before the extension opens the newly created project (which would otherwise replace the workspace and terminate the CLI terminal session).

Changes:

  • Moves _agentInitCommand.PromptAndChainAsync(...) to run before the VS Code extension OpenEditor(...) call.
  • Returns the agent-init (chained) exit code after optional editor opening.

@joperezr joperezr added the Servicing-approved Approved for servicing release label Mar 24, 2026
@joperezr
Copy link
Member

Regression, low risk. Approved. Are there tests we can add here to protect against future regressions?

Copy link
Member

@joperezr joperezr left a comment

Choose a reason for hiding this comment

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

LGTM apart from the question for tests.

@adamint
Copy link
Member Author

adamint commented Mar 24, 2026

Regression, low risk. Approved. Are there tests we can add here to protect against future regressions?

Not until we get extension e2e tests working. Then, yes

Comment on lines +282 to 284
var exitCode = await _agentInitCommand.PromptAndChainAsync(_hostEnvironment, InteractionService, templateResult.ExitCode, workspaceRoot, cancellationToken);

if (templateResult.OutputPath is not null && ExtensionHelper.IsExtensionHost(InteractionService, out var extensionInteractionService, out _))
Copy link
Member

Choose a reason for hiding this comment

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

It's not obvious that this order is important.

Add a comment saying what has to happen here. Even better, also add a test to verify extension host isn't called until after the chain is complete.

It doesn't need to happen in this branch since it's to a release branch, but it should happen somewhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Servicing-approved Approved for servicing release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants