Skip to content

fix(upgrade): check extension version before calling gotoAgentMode#1022

Open
frankliu20 wants to merge 1 commit into
microsoft:mainfrom
frankliu20:fix/check-extension-version-before-gotoAgentMode-biz-only
Open

fix(upgrade): check extension version before calling gotoAgentMode#1022
frankliu20 wants to merge 1 commit into
microsoft:mainfrom
frankliu20:fix/check-extension-version-before-gotoAgentMode-biz-only

Conversation

@frankliu20
Copy link
Copy Markdown
Contributor

@frankliu20 frankliu20 commented May 28, 2026

Why

From telemetry analysis, ~67% of _java.upgradeWithCopilot failures are "command 'appmod.javaUpgrade.gotoAgentMode' not found". This happens because the appmod extension is installed but too old (< 1.15.0) to register the gotoAgentMode command. The current code only checks whether the extension is installed, not whether it's up-to-date.

Additionally, the notification button says "Upgrade Now" even when the user needs to install or update the appmod extension first — which is confusing.

What

  1. Version check before gotoAgentModecheckOrInstallAppModExtensionForUpgrade now verifies the installed extension version is ≥ 1.15.0. If outdated, it triggers an update via workbench.extensions.installExtension and prompts the user to reload VS Code (required for the updated extension to take effect).

  2. Three-state notification UX — Notification buttons and message body now distinguish between:

    • up-to-date → "Upgrade Now" / "Fix Now"
    • outdated → "Update Extension and Upgrade" / "Update Extension and Fix"
    • not-installed → "Install Extension and Upgrade" / "Install Extension and Fix"
  3. Display name update — Renamed to "GitHub Copilot modernization" to match the extension's current marketplace name.

- Add MIN_APPMOD_VERSION (1.15.0) constant and check installed extension
  version before proceeding, fixing failures when extension is outdated
- Show reload prompt when extension is updated (not freshly installed)
- Distinguish three extension states (up-to-date/outdated/not-installed)
  in notification button text and message body
- Rename display name to "GitHub Copilot modernization"

Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
Copy link
Copy Markdown
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 addresses the high failure rate of _java.upgradeWithCopilot (~67% of failures due to appmod.javaUpgrade.gotoAgentMode not being found) by detecting when the app modernization extension is installed but predates the version (1.15.0) that registers gotoAgentMode. It also refines notification UX to differentiate three extension states and refreshes the extension display name to match its current marketplace name.

Changes:

  • Add Upgrade.MIN_APPMOD_VERSION = "1.15.0" and version-check the installed extension in checkOrInstallAppModExtensionForUpgrade, prompting a window reload after update.
  • Introduce an ExtensionState (up-to-date | outdated | not-installed) used to drive both notification button text and message body wording.
  • Rename the display constant to "GitHub Copilot modernization".

Reviewed changes

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

File Description
src/constants.ts Adds MIN_APPMOD_VERSION constant and renames the modernization extension display name.
src/upgrade/utility.ts Replaces boolean hasExtension parameter with ExtensionState, centralizes action-word generation, and adds version check + reload prompt for outdated extension.
src/upgrade/display/notificationManager.ts Computes three-state extension status via semver.gte and selects button labels / message wording accordingly.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/upgrade/utility.ts
Comment on lines 180 to 194
await commands.executeCommand("workbench.extensions.installExtension", ExtensionName.APP_MODERNIZATION_FOR_JAVA);

if (ext) {
// Extension was updated (not freshly installed) — reload required
const reload = await window.showInformationMessage(
"GitHub Copilot modernization extension has been updated. Reload VS Code to start the upgrade experience.",
"Reload Now"
);
if (reload === "Reload Now") {
await commands.executeCommand("workbench.action.reloadWindow");
}
return;
}

await checkOrPromptToEnableAppModExtension("upgrade");
Comment thread src/upgrade/utility.ts
if (ext) {
// Extension was updated (not freshly installed) — reload required
const reload = await window.showInformationMessage(
"GitHub Copilot modernization extension has been updated. Reload VS Code to start the upgrade experience.",
if (version && semver.gte(version, Upgrade.MIN_APPMOD_VERSION)) {
return "up-to-date";
}
return "outdated";
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

If version is undefined, it will go to this condition.

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.

4 participants