From cee5775f4192392c51489350a05686ce2f7c94ef Mon Sep 17 00:00:00 2001 From: Jinjing <6427696+AmethystLiang@users.noreply.github.com> Date: Sat, 27 Jun 2026 02:40:29 -0700 Subject: [PATCH] Fix create PR visibility when upstream status is unknown --- .../source-control/hosted-review-creation.test.ts | 15 +++++++++++++++ src/main/source-control/hosted-review-creation.ts | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/main/source-control/hosted-review-creation.test.ts b/src/main/source-control/hosted-review-creation.test.ts index e50731c8588..c8329149273 100644 --- a/src/main/source-control/hosted-review-creation.test.ts +++ b/src/main/source-control/hosted-review-creation.test.ts @@ -616,6 +616,21 @@ describe('getHostedReviewCreationEligibility', () => { }) }) + it('rethrows review lookup failures when upstream status is unknown', async () => { + getHostedReviewForBranchMock.mockRejectedValueOnce(new Error('gh lookup failed')) + + await expect( + getHostedReviewCreationEligibility({ + repoPath: '/repo', + branch: 'feature/create-pr', + base: 'main', + hasUncommittedChanges: false, + ahead: 0, + behind: 0 + }) + ).rejects.toThrow('gh lookup failed') + }) + it('enables creation for clean, in-sync, authenticated GitHub feature branches', async () => { await expect( getHostedReviewCreationEligibility({ diff --git a/src/main/source-control/hosted-review-creation.ts b/src/main/source-control/hosted-review-creation.ts index 7b6709d2dd3..997b819a384 100644 --- a/src/main/source-control/hosted-review-creation.ts +++ b/src/main/source-control/hosted-review-creation.ts @@ -405,7 +405,7 @@ export async function getHostedReviewCreationEligibility( branch !== 'HEAD' && supportsHostedReviewCreation(provider) && (!baseBranch || branch.toLowerCase() !== baseBranch.toLowerCase()) && - (args.hasUncommittedChanges || args.hasUpstream !== true || (args.behind ?? 0) > 0) + (args.hasUncommittedChanges || args.hasUpstream === false || (args.behind ?? 0) > 0) if (!canReturnLocalBlocker) { throw error }