diff --git a/packages/source-control-github/src/server/gitHubPullRequestJson.test.ts b/packages/source-control-github/src/server/gitHubPullRequestJson.test.ts index cd26dcf2d4a5b..d360f4523e327 100644 --- a/packages/source-control-github/src/server/gitHubPullRequestJson.test.ts +++ b/packages/source-control-github/src/server/gitHubPullRequestJson.test.ts @@ -631,6 +631,24 @@ describe("pull request detail decoding", () => { expect(detail.checksState).toBe("pending"); }); + it("reads a check by its conclusion when GitHub never marks it completed", () => { + const detail = detailOf([ + inWorkflow({ + name: "Changes", + workflowName: "CI", + status: "IN_PROGRESS", + conclusion: "SUCCESS", + startedAt: "2026-11-24T22:26:00Z", + completedAt: "2026-11-24T22:26:06Z", + }), + ]); + + expect(detail.checks.map((check) => [check.name, check.status])).toEqual([ + ["Changes", "success"], + ]); + expect(detail.checksState).toBe("passing"); + }); + it("keeps a check pending while another run of it on the same commit is still going", () => { const finished = { name: "check", diff --git a/packages/source-control-github/src/server/gitHubPullRequestJson.ts b/packages/source-control-github/src/server/gitHubPullRequestJson.ts index da150603f9be2..36a2f4f0e4970 100644 --- a/packages/source-control-github/src/server/gitHubPullRequestJson.ts +++ b/packages/source-control-github/src/server/gitHubPullRequestJson.ts @@ -593,7 +593,9 @@ function hasTeamReviewRequest(raw: ReadonlyArray | undefine function toCheckStatus(raw: CheckFields): PullRequestCheckStatus { const status = raw.status?.trim().toUpperCase(); - if (status !== undefined && status !== "COMPLETED" && status !== "") { + // GitHub can leave a finished check run's status stuck at IN_PROGRESS; its conclusion is final. + const concluded = (raw.conclusion?.trim() ?? "") !== ""; + if (!concluded && status !== undefined && status !== "COMPLETED" && status !== "") { return "pending"; } switch ((raw.conclusion ?? raw.state)?.trim().toUpperCase()) {