From fb6ba2f5deb974a96670f451c5c8a1b7b6776271 Mon Sep 17 00:00:00 2001 From: pseudo <27822378+pseudoseed@users.noreply.github.com> Date: Tue, 24 Nov 2026 20:30:30 -0700 Subject: [PATCH] fix(github): read a check by its conclusion when GitHub leaves it in progress GitHub can leave a finished check run's status at IN_PROGRESS while its conclusion and completedAt are set. The reader treated it as pending forever, so the PR watcher never sent the checks-passed wake. Co-Authored-By: Claude Opus 5.5 --- .../src/server/gitHubPullRequestJson.test.ts | 18 ++++++++++++++++++ .../src/server/gitHubPullRequestJson.ts | 4 +++- 2 files changed, 21 insertions(+), 1 deletion(-) 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()) {