fix: azd tool install/list for AI extensions and VS Code Copilot Chat#8194
fix: azd tool install/list for AI extensions and VS Code Copilot Chat#8194hemarina wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes two azd tool bugs related to AI extension detection and VS Code Copilot Chat installation by correcting the AI extension manifest entry and unconditionally passing --force to code --install-extension.
Changes:
- Update
azdAIExtensionsmanifest to use the real extension idazure.ai.agents, drop the bogusaz-clidependency, pin--source azd, and rename to "azd AI Agent Extensions". - Always pass
--forcefrombuildCodeCommand, eliminating false "already installed" results caused by stale.obsoleteVS Code extension folders. - Refactor
TestBuildManagerCommandto assert multiple expected args, replace the contract test for the AI extension, and isolate dependency-resolution tests behind a synthetic 2-tool manifest.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| cli/azd/pkg/tool/manifest.go | Fix azdAIExtensions id/name/source flag and remove az-cli dep. |
| cli/azd/pkg/tool/manifest_test.go | Update built-in tool list and add AzdAIExtensionsContract test asserting id/category/detect-command/args/strategies. |
| cli/azd/pkg/tool/manager_test.go | Extract dependency-resolution subtests into a new function using a synthetic manifest decoupled from the AI extension's deps. |
| cli/azd/pkg/tool/installer.go | buildCodeCommand now always appends --force; upgrade parameter retained but unused with explanatory comment. |
| cli/azd/pkg/tool/installer_test.go | Generalize expectArg→expectArgs and assert both --install-extension and --force on code rows. |
Azure Dev CLI Install InstructionsInstall scriptsMacOS/Linux
bash: pwsh: WindowsPowerShell install MSI install Standalone Binary
MSI
Documentationlearn.microsoft.com documentationtitle: Azure Developer CLI reference
|
Summary
Fixes two unrelated bugs in
azd toolreported in the same area of thecodebase. Combined into one PR because the changes touch the same
package and were investigated together.
Fixes #8149
Fixes #8150
#8149 —
azd tool listreports the AI extension as missingRoot cause. The manifest entry for the AI extension used the wrong
extension ID (
Microsoft.azd-ai-extensions), declared a bogusaz-clidependency the extension does not require at runtime, and did not pin
the registry source. As a result
azd tool listcould not match theinstalled extension and reported it as missing.
Fix.
Id:Microsoft.azd-ai-extensions→azure.ai.agents(matches theID published in the azd extension registry).
az-cli— the extension is self-contained anddoes not require the Azure CLI at runtime.
--source azdso the install alwaysresolves against the official azd registry rather than whatever
default the user has configured.
Name:azd AI Extensions→azd AI Agent Extensionsfor accuracy.Added a
TestSpecificToolDefinitions/AzdAIExtensionsContractcontracttest in
manifest_test.goso the ID, source, and dependency shape arelocked in.
#8150 —
azd tool install GitHub.copilot-chatfails with "verification failed"Root cause. VS Code''s
~/.vscode/extensions/directory has twostate mechanisms that can disagree:
extensions.json— the registry thatcode --list-extensionsreads..obsoletefile —code --install-extensionuses afast-path that scans folder names but ignores
.obsolete.When an extension is uninstalled, its entry is removed from
extensions.jsonbut the folder is not deleted (cleanup is lazy andhappens on the next VS Code restart). The folder is marked obsolete via
the
.obsoletefile.In the window between uninstall and restart,
code --install-extension <id>(no--force) sees the stale folder, prints"Extension ''<id>'' v<X> is already installed. Use ''--force'' option…",exits
0, and does nothing. azd then can''t detect the extensionand surfaces
"installed but verification failed". Dev Containersappear especially affected because state accumulates across rebuilds.
Fix.
buildCodeCommandnow always passes--force. This bypassesthe folder-scan fast-path, hits the marketplace, installs only if a
newer version exists (otherwise no-ops), and cleans up stale
.obsoleteentries. Cost on the clean-install path is ~180 ms(a marketplace HEAD).
The
upgradeparameter onbuildCodeCommandis now unused. Thetable-driven
TestBuildManagerCommandwas refactored fromexpectArg string(one keyword) toexpectArgs []string(multiplekeywords) so both
--install-extensionand--forcecan be assertedtogether on the
coderows.Repro for #8150
Before the fix, on a machine where Copilot Chat had previously been
uninstalled without a VS Code restart:
After the fix, identical state (
.obsoletestill containsgithub.copilot-chat-0.33.1,github.copilot-chat-0.44.2):Tests
TestSpecificToolDefinitions/AzdAIExtensionsContract(contractfor the manifest entry).
TestManager_InstallToolsDependencyResolution(synthetic 2-toolmanifest covering
buildInstallOrder+hasMissingDependency;restores coverage that was previously provided by tests tightly
coupled to the old
azd-ai-extensionsdep shape).TestBuildManagerCommand(coderows now assert both--install-extensionand--force).Coverage
go test ./pkg/tool/...total coverage: 79.3% before, 79.3% after.Per-function coverage for the affected code paths is unchanged from
upstream/main (
buildInstallOrder81.0%,hasMissingDependency100%,buildCodeCommand100%).Risk
azd tool listfails to detect installedazd-ai-extensions#8149: behavior change is limited to the AI extension manifest entry.Anyone with the previous (wrong) ID installed will see
azd tool listreport it as not installed; running
azd tool install azure.ai.agentsinstalls the correct extension.
azd tool install GitHub.copilot-chatreports installed but verification failed on Windows and Linux #8150:code --install-extension --forcenow runs on every install.When the extension is genuinely already installed and current, the
cost is one marketplace HEAD (~180 ms) and the command exits with
"is already installed". No re-download occurs unless a newerversion is available.