From fb705d367a42512ccb96f06db8b0970b56fbf8de Mon Sep 17 00:00:00 2001 From: Brace Sproul Date: Tue, 29 Jul 2025 10:15:05 -0700 Subject: [PATCH] fix: filtering github bot comments (#587) * fix: filtering gh bot comments * cr * cr * test empty commit * [skip ci] * [skip deploy] --- apps/open-swe/src/utils/github/api.ts | 10 +++++----- apps/open-swe/src/utils/github/issue-messages.ts | 13 ++----------- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/apps/open-swe/src/utils/github/api.ts b/apps/open-swe/src/utils/github/api.ts index c77d2cfa..954e2b01 100644 --- a/apps/open-swe/src/utils/github/api.ts +++ b/apps/open-swe/src/utils/github/api.ts @@ -381,11 +381,11 @@ export async function getIssueComments({ return comments; } - return comments.filter((comment) => { - return ( - comment.user?.type !== "Bot" || !comment.user?.name?.includes("[bot]") - ); - }); + return comments.filter( + (comment) => + comment.user?.type !== "Bot" && + !comment.user?.login?.includes("[bot]"), + ); }, githubInstallationToken, "Failed to get issue comments", diff --git a/apps/open-swe/src/utils/github/issue-messages.ts b/apps/open-swe/src/utils/github/issue-messages.ts index a980b80f..bc1130ea 100644 --- a/apps/open-swe/src/utils/github/issue-messages.ts +++ b/apps/open-swe/src/utils/github/issue-messages.ts @@ -93,17 +93,8 @@ export async function getMissingMessages( }); } - // Filter comments from the open swe bot - const filteredComments = comments?.filter( - (c) => c.user?.login.startsWith("open-swe") === false, - ); - - const untrackedCommentMessages = filteredComments?.length - ? getUntrackedComments( - input.messages, - input.githubIssueId, - filteredComments, - ) + const untrackedCommentMessages = comments?.length + ? getUntrackedComments(input.messages, input.githubIssueId, comments) : []; return [...(issueMessage ? [issueMessage] : []), ...untrackedCommentMessages];