Add base and compare branch names to Copilot PR title and description generation#8686
Merged
alexr00 merged 4 commits intomicrosoft:mainfrom Apr 24, 2026
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves PR title/description generation by including the actual base and compare branch names in the context passed to TitleAndDescriptionProvider.provideTitleAndDescription, reducing branch-name hallucinations during generation (fixes #8662).
Changes:
- Extended the
TitleAndDescriptionProvidercontext type to include optionalbaseBranchandcompareBranch. - Forwarded
baseBranch/compareBranchfrom the Create PR view generation flow. - Forwarded
baseBranch/compareBranchfrom PR Overview “regenerate description” and from the command-based generation entry point.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/api/api.d.ts | Adds optional baseBranch/compareBranch fields to the provider context type. |
| src/github/createPRViewProvider.ts | Passes the Create PR model’s base/compare branch names into generation context. |
| src/github/pullRequestOverview.ts | Passes PR base/head refs into generation context when regenerating description. |
| src/commands.ts | Passes command args base/compare branch names into generation context. |
Contributor
Author
|
@microsoft-github-policy-service agree |
alexr00
reviewed
Apr 23, 2026
alexr00
requested changes
Apr 24, 2026
…in multiple files
alexr00
approved these changes
Apr 24, 2026
Member
|
/AzurePipelines run |
|
Azure Pipelines could not run because the pipeline triggers exclude this branch/path. |
jrieken
approved these changes
Apr 24, 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
baseBranchandcompareBranchto the context passed toTitleAndDescriptionProvider.provideTitleAndDescription, and forwards them from all three call sites where title and description generation is triggered.Previously the model had no knowledge of which branches were involved, causing it to hallucinate branch names in the generated description. With this change, the actual branch names are passed to the provider so they can be included in the prompt.
Changes
src/api/api.d.ts: AddedbaseBranch?andcompareBranch?to theTitleAndDescriptionProvidercontext interface.src/github/createPRViewProvider.ts: Passesthis.model.baseBranchandthis.model.compareBranchwhen callingprovideTitleAndDescriptionfrom the Create PR view.src/github/pullRequestOverview.ts: Passesthis._item.base.refandthis._item.head?.refwhen regenerating a description from the PR overview.src/commands.ts: Passesargs.baseBranchandargs.compareBranchwhen calling through thegithub.createPullRequest.generatecommand API.Fixes #8662
The corresponding change to the Copilot Chat extension that uses these values to render them in the prompt is at microsoft/vscode-copilot-chat#5083.