Fix the "update with merge commit" button for non-checked-out PRs#8847
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes the “Update with merge commit” (update branch) flow so it works for pull requests that are not currently checked out by routing conflict-free updates through the GitHub GraphQL API, and ensures the webview state reflects update availability after an update attempt.
Changes:
- Prefer
updateBranchWithGraphQL()intryMergeBaseIntoHeadfor non-conflicting, non-enterprise PRs (including when the PR isn’t checked out). - Include
canUpdateBranchin thepr.update-branchreply and propagate it into the webview PR state. - Add coverage for the GraphQL update path and for
canUpdateBranchbeing reported after a successful update.
Show a summary per file
| File | Description |
|---|---|
| webviews/common/context.tsx | Applies canUpdateBranch updates returned from the extension host after pr.update-branch. |
| src/test/github/folderRepositoryManager.test.ts | Adds tests for GraphQL-based update when PR isn’t checked out and for canUpdateBranch reply semantics. |
| src/github/pullRequestReviewCommon.ts | Updates the webview reply payload to include canUpdateBranch for pr.update-branch. |
| src/github/folderRepositoryManager.ts | Reorders update logic to attempt GraphQL update before conflict-resolution/local-checkout paths. |
Review details
Comments suppressed due to low confidence (1)
src/github/pullRequestReviewCommon.ts:185
- If
tryMergeBaseIntoHeadreturnsfalse, this handler still waits up to ~5 seconds polling mergeability (includingsetTimeout) before replying. That delays re-enabling the webview button and does unnecessary network work even though the branch update didn’t happen. Consider only polling whenmergeSucceededis true, and otherwise fetch mergeability once and reply immediately.
const mergeSucceeded = await ctx.folderRepositoryManager.tryMergeBaseIntoHead(ctx.item, true);
// The mergability of the PR doesn't update immediately. Poll.
let mergability = PullRequestMergeability.Unknown;
let attemptsRemaining = 5;
do {
- Files reviewed: 4/4 changed files
- Comments generated: 0
- Review effort level: Low
benibenj
approved these changes
Jul 15, 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.
No description provided.