Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 26, 2025

Restores logic from commit 1cafcac that was removed, polishing it to align with the GitHub API-first pattern established in commit 361cb48.

Changes

Restored extension management infrastructure:

  • isPullRequestExtensionInstalled() - checks extension availability
  • installPullRequestExtension() - auto-installs extension with prerelease detection for Insiders builds
  • Context key updates for prExtensionInstalledContextKey

Command routing strategy:

  • checkoutFromDescription and applyChangesFromDescription - proxy commands that install PR extension on-demand (requires extension functionality)
  • closeChatSessionPullRequest - uses GitHub API directly (no extension required)

UI Integration:

  • Added menu contributions in chat/chatSessions for checkout and apply changes commands
  • Commands appear in copilot-cloud-agent chat sessions when PR extension is not installed
  • Uses context key !github.copilot.prExtensionInstalled to conditionally show menu items
  • Includes localized titles and appropriate icons (desktop-download, diff)

Improvements:

  • Added JSDoc documentation
  • Enhanced error logging with operation context
  • Early return optimization in polling loop
  • Info-level logging for installation flow

Example

// Commands requiring PR extension features auto-install it
vscode.commands.registerCommand('github.copilot.cloud.sessions.proxy.checkoutFromDescription', async (ctx) => {
    await this.installPullRequestExtension();  // Ensures extension availability
    await vscode.commands.executeCommand('pr.checkoutFromDescription', ctx?.path);
});

// Commands with API equivalents bypass extension
vscode.commands.registerCommand(CLOSE_SESSION_PR_CMD, async (ctx) => {
    await this.octoKitService.closePullRequest(owner, repo, number);  // Direct API call
});

User Experience

When viewing copilot-cloud-agent chat sessions without the GitHub Pull Request extension installed, users will see:

  • Checkout Pull Request button - installs extension and checks out the PR branch
  • Apply Changes from Pull Request button - installs extension and applies PR changes

These buttons automatically disappear once the PR extension is installed, providing a seamless onboarding experience.

Created from VS Code via the GitHub Pull Request extension.

Original prompt

Restore the logic in this commit 1cafcac and polish it

Created from VS Code via the GitHub Pull Request extension.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

- Restore IEnvService import and constructor parameter
- Restore isPullRequestExtensionInstalled() method
- Restore installPullRequestExtension() method with improvements:
  - Added JSDoc comments
  - Added logging for better debugging
  - Improved error handling
- Restore context key setting for PR extension installed
- Restore proxy commands (checkoutFromDescription, applyChangesFromDescription)
- Keep CLOSE_SESSION_PR_CMD using GitHub API directly (no extension required)
- Added comments to clarify the approach

Co-authored-by: joshspicer <23246594+joshspicer@users.noreply.github.com>
Copilot AI changed the title [WIP] Restore and polish logic from commit 1cafcac Restore PR extension management with API-first approach Oct 26, 2025
Copilot AI requested a review from joshspicer October 26, 2025 22:17
Copilot finished work on behalf of joshspicer October 26, 2025 22:17
@joshspicer
Copy link
Member

@copilot you need to actually show the button to install the extension in the chat part, eg:

contributes.menu
"chat/multiDiff/context": [
{
"command": "xxxxx"
},
{


- Add command definitions for checkoutFromDescription and applyChangesFromDescription
- Add localized titles in package.nls.json
- Add menu items in chat/chatSessions that appear when PR extension is not installed
- Commands use context key !github.copilot.prExtensionInstalled to conditionally show
- Commands will trigger automatic installation of GitHub Pull Request extension

Co-authored-by: joshspicer <23246594+joshspicer@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Oct 26, 2025

@copilot you need to actually show the button to install the extension in the chat part, eg:

contributes.menu...

Added UI menu contributions in commit f2f7859.

The commands now appear in the chat sessions context menu for copilot-cloud-agent sessions:

  • "Checkout Pull Request" (icon: desktop-download)
  • "Apply Changes from Pull Request" (icon: diff)

Both commands use the context key !github.copilot.prExtensionInstalled to only show when the PR extension is not installed. When clicked, they automatically install the GitHub Pull Request extension and execute the corresponding command.

The menu items are in the chat/chatSessions contribution point with group prExtension@1 and prExtension@2, similar to how the existing "Close Pull Request" command appears in the context group.

Copilot finished work on behalf of joshspicer October 26, 2025 22:38
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.

2 participants