Add compareBranch to TitleAndDescriptionProvider for enhanced PR context#312326
Merged
alexr00 merged 5 commits intoApr 29, 2026
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the GitHub PR title/description generation prompt context in the Copilot extension by adding the source/compare branch name, so the model can reference the correct branch instead of hallucinating one.
Changes:
- Extends
TitleAndDescriptionProvider.provideTitleAndDescriptioncontext withcompareBranch?: string(and aligns the type to also includetemplate?: string). - Threads
compareBranchthroughGitHubPullRequestTitleAndDescriptionGeneratorinto the prompt renderer. - Updates the PR description prompt to include the compare branch at the start of the user message when present.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| extensions/copilot/src/extension/prompts/node/github/pullRequestDescriptionPrompt.tsx | Adds compare branch text to the generated user message sent to the model. |
| extensions/copilot/src/extension/prompt/node/githubPullRequestTitleAndDescriptionGenerator.ts | Passes compareBranch through to prompt rendering. |
| extensions/copilot/src/extension/githubPullRequest.d.ts | Updates the public provider context type to include compareBranch (and template). |
alexr00
requested changes
Apr 27, 2026
…stDescriptionPrompt.tsx Co-authored-by: Alex Ross <38270282+alexr00@users.noreply.github.com>
…and-description-generation
alexr00
approved these changes
Apr 29, 2026
jrieken
approved these changes
Apr 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
compareBranchto the context passed toTitleAndDescriptionProvider.provideTitleAndDescription, and include it in the prompt sent to the model when generating a PR title and description.Previously the model had no knowledge of which branch is merged, causing it to hallucinate branch names in the generated description. With this change, the user message sent to the model now includes:
If merged brand contain X then Y.Changes
githubPullRequest.d.ts: AddedcompareBranch?to theTitleAndDescriptionProvidercontext interface.githubPullRequestTitleAndDescriptionGenerator.ts: PassescompareBranchthrough to the prompt renderer.pullRequestDescriptionPrompt.tsx: Renders the branch name as a sentence at the start of the user message when either value is present.Part of microsoft/vscode-pull-request-github#8662
copied pr from microsoft/vscode-copilot-chat#5083