Skip to content

Fix the "update with merge commit" button for non-checked-out PRs#8847

Merged
alexr00 merged 1 commit into
mainfrom
alexr00/amazing-rodent
Jul 15, 2026
Merged

Fix the "update with merge commit" button for non-checked-out PRs#8847
alexr00 merged 1 commit into
mainfrom
alexr00/amazing-rodent

Conversation

@alexr00

@alexr00 alexr00 commented Jul 15, 2026

Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings July 15, 2026 12:54
@alexr00 alexr00 enabled auto-merge (squash) July 15, 2026 12:54
@alexr00 alexr00 self-assigned this Jul 15, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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() in tryMergeBaseIntoHead for non-conflicting, non-enterprise PRs (including when the PR isn’t checked out).
  • Include canUpdateBranch in the pr.update-branch reply and propagate it into the webview PR state.
  • Add coverage for the GraphQL update path and for canUpdateBranch being 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 tryMergeBaseIntoHead returns false, this handler still waits up to ~5 seconds polling mergeability (including setTimeout) 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 when mergeSucceeded is 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

@alexr00 alexr00 merged commit d89f38c into main Jul 15, 2026
8 checks passed
@alexr00 alexr00 deleted the alexr00/amazing-rodent branch July 15, 2026 14:00
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.

3 participants