Skip to content

Fix aspire new: move OpenEditor after agent init prompt in VS Code extension#15552

Merged
adamint merged 1 commit intomicrosoft:mainfrom
adamint:dev/adamint/fix-new-open-editor-order
Mar 24, 2026
Merged

Fix aspire new: move OpenEditor after agent init prompt in VS Code extension#15552
adamint merged 1 commit intomicrosoft:mainfrom
adamint:dev/adamint/fix-new-open-editor-order

Conversation

@adamint
Copy link
Member

@adamint adamint commented Mar 24, 2026

Description

When running aspire new from the VS Code extension, the OpenEditor RPC call was made immediately after template creation but before the "Would you like to configure AI agent environments?" prompt (PromptAndChainAsync). Opening the new project folder replaces the current VS Code workspace, which destroys the terminal running the CLI process—so the agent init prompt is never shown to the user.

This PR reorders the calls so that PromptAndChainAsync completes before OpenEditor is invoked, allowing the full CLI interaction to finish before the workspace switches.

IMO this should be seriously considered for 13.2.1 servicing, especially as it's very low risk. Users are prevented from setting up AI skills, which is an area we are prioritizing at the moment.

Fixes #15551

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
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
    • No
  • Does the change require an update in our Aspire docs?
    • Yes
    • No

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 21:57
@adamint adamint added the Servicing-consider Issue for next servicing release review label Mar 24, 2026
@adamint adamint self-assigned this Mar 24, 2026
@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 -- 15552

Or

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

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

This PR fixes an aspire new UX issue when invoked from the VS Code extension: switching the workspace (via OpenEditor) was happening before the CLI finished the interactive agent environment setup prompt, which could terminate the running terminal session and prevent the prompt from being shown.

Changes:

  • Reorders aspire new flow to run _agentInitCommand.PromptAndChainAsync(...) before invoking the VS Code extension OpenEditor RPC.
  • Captures the chained exit code and returns it after the editor-open call.

@adamint adamint enabled auto-merge (squash) March 24, 2026 22:06
@adamint
Copy link
Member Author

adamint commented Mar 24, 2026

/backport to release/13.2

@github-actions
Copy link
Contributor

Started backporting to release/13.2 (link to workflow run)

@aspire-repo-bot
Copy link

@adamint backporting to release/13.2 failed, the patch most likely resulted in conflicts. Please backport manually!

git am output
$ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch

Applying: Fix aspire new: move OpenEditor after agent init prompt
Using index info to reconstruct a base tree...
M	src/Aspire.Cli/Commands/NewCommand.cs
Falling back to patching base and 3-way merge...
Auto-merging src/Aspire.Cli/Commands/NewCommand.cs
CONFLICT (content): Merge conflict in src/Aspire.Cli/Commands/NewCommand.cs
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0001 Fix aspire new: move OpenEditor after agent init prompt
Error: The process '/usr/bin/git' failed with exit code 128

Link to workflow output

@adamint adamint merged commit d4a9817 into microsoft:main Mar 24, 2026
254 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-cli Servicing-consider Issue for next servicing release review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

extension opens aspire new project before being asked to set up ai agent

3 participants