Add base and compare branch names to Copilot PR title and description generation#8686
Conversation
|
@shaypet please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
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. |
|
@microsoft-github-policy-service agree |
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.