fix(scm-github): filter bot review comments by GraphQL __typename#703
Open
ashutosh-makwana wants to merge 1 commit intoComposioHQ:mainfrom
Open
fix(scm-github): filter bot review comments by GraphQL __typename#703ashutosh-makwana wants to merge 1 commit intoComposioHQ:mainfrom
ashutosh-makwana wants to merge 1 commit intoComposioHQ:mainfrom
Conversation
GitHub's GraphQL API returns bot logins without the [bot] suffix (e.g., "cursor" instead of "cursor[bot]"), while the REST API includes it. BOT_AUTHORS contains entries with [bot], so the check in getPendingComments() fails for bots — their comments leak through as "human" pending comments. This causes double-dispatch: the lifecycle manager fires both changes-requested and bugbot-comments reactions for the same bot review thread. Add __typename to the GraphQL author field and check for Bot type in addition to the existing BOT_AUTHORS name check. Update tests to use realistic GraphQL data (login without [bot] suffix, __typename: "Bot").
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
getPendingComments()uses GitHub's GraphQL API, which returns bot logins without the[bot]suffix (e.g."cursor"not"cursor[bot]").BOT_AUTHORScontains entries with[bot], so the check fails and bot comments leak through as human pending comments.changes-requestedandbugbot-commentsreactions for the same bot review thread — the agent gets duplicate instructions.__typenameto the GraphQL author field. Checkauthor.__typename === "Bot"in addition to the existingBOT_AUTHORSname check. This catches all GitHub App bots regardless of login format.Before → After
getPendingCommentsas "human"__typename === "Bot")getPendingCommentsreturns human + botchanges-requested+bugbot-comments)bugbot-commentsonly)getAutomatedComments(REST)Changes
packages/plugins/scm-github/src/index.ts__typenameto GraphQL author selection; checkauthor.__typename === "Bot"in filterpackages/plugins/scm-github/test/index.test.ts__typename-based filteringTest plan
__typename: "Bot"and login without[bot]suffix is filtered out__typename: "User"passes through (regression)BOT_AUTHORS(snyk-bot,__typename: "User") still filtered by nameCloses #702