From d49fdd7bc4ec34b5897bd699be6d66bbc00fde65 Mon Sep 17 00:00:00 2001 From: Prateek Date: Fri, 13 Feb 2026 18:46:31 +0530 Subject: [PATCH] fix: filter out resolved threads in getPendingComments The method name implies it should only return unresolved/pending review threads. The isResolved data was already fetched via GraphQL but was not being filtered on, causing resolved threads to be included in results. Co-Authored-By: Claude Opus 4.6 --- packages/plugins/scm-github/src/index.ts | 1 + packages/plugins/scm-github/test/index.test.ts | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/plugins/scm-github/src/index.ts b/packages/plugins/scm-github/src/index.ts index c1868e812..e4236615f 100644 --- a/packages/plugins/scm-github/src/index.ts +++ b/packages/plugins/scm-github/src/index.ts @@ -370,6 +370,7 @@ function createGitHubSCM(): SCM { return threads .filter((t) => { + if (t.isResolved) return false; // only pending (unresolved) threads const c = t.comments.nodes[0]; if (!c) return false; // skip threads with no comments const author = c.author?.login ?? ""; diff --git a/packages/plugins/scm-github/test/index.test.ts b/packages/plugins/scm-github/test/index.test.ts index 56731ab73..34404913d 100644 --- a/packages/plugins/scm-github/test/index.test.ts +++ b/packages/plugins/scm-github/test/index.test.ts @@ -432,7 +432,7 @@ describe("scm-github plugin", () => { }; } - it("returns non-bot comments with isResolved from GraphQL", async () => { + it("returns only unresolved non-bot comments from GraphQL", async () => { mockGh( makeGraphQLThreads([ { isResolved: false, id: "C1", author: "alice", body: "Fix line 10", path: "src/foo.ts", line: 10, url: "https://github.com/c/1", createdAt: "2025-01-01T00:00:00Z" }, @@ -441,9 +441,8 @@ describe("scm-github plugin", () => { ); const comments = await scm.getPendingComments(pr); - expect(comments).toHaveLength(2); + expect(comments).toHaveLength(1); expect(comments[0]).toMatchObject({ id: "C1", author: "alice", isResolved: false }); - expect(comments[1]).toMatchObject({ id: "C2", author: "bob", isResolved: true }); }); it("filters out bot comments", async () => {