Skip to content

fix(github): match bot actors in comment filters using GraphQL __typename - #1616

Merged
ashwin-ant merged 1 commit into
anthropics:mainfrom
Neal006:fix/graphql-bot-actor-filter
Aug 19, 2026
Merged

ashwin-ant merged 1 commit into
anthropics:mainfrom
Neal006:fix/graphql-bot-actor-filter

Conversation

@Neal006

@Neal006 Neal006 commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Fixes #1514

Problem

exclude_comments_by_actor and include_comments_by_actor never match any bot. This is broader than the issue title suggests: not only does the documented *[bot] wildcard fail, so does an exact entry like dependabot[bot]. Users configure bot filtering, see no error, and every bot comment still reaches the prompt.

Root cause

The two GitHub APIs disagree on bot logins:

API login for the Dependabot app
REST dependabot[bot]
GraphQL dependabot (no suffix; identified by __typename: "Bot")

src/github/data/fetcher.ts filters comments from GraphQL data, but the patterns users write follow the REST/UI convention. So this check in actorMatchesPattern was dead code:

if (pattern === "*[bot]" && actor.endsWith("[bot]")) return true;

actor is dependabot, never dependabot[bot]. The suffix simply is not present in the data, which also breaks exact matches.

Why it was not caught

test/data-fetcher.test.ts mocked a payload GraphQL never produces:

author: { login: "scanner[bot]" }   // REST shape, not GraphQL

The test passed against fiction. It now mocks the real shape and fails without this fix.

Fix

  1. Request __typename on the six Actor-typed author selections in src/github/api/queries/github.ts.
  2. Add resolveActorName() to src/github/utils/actor-filter.ts, mapping an App actor to its suffixed name.
  3. Use it at the single filtering choke point, filterCommentsByActor.
export function resolveActorName(
  author: { login: string; __typename?: string } | null | undefined,
): string {
  if (!author) return "ghost";
  if (author.__typename === "Bot" && !author.login.endsWith("[bot]")) {
    return `${author.login}[bot]`;
  }
  return author.login;
}

Normalizing at the filter boundary (rather than mutating fetched data) fixes the wildcard and exact-match cases in one place and leaves author names shown in the prompt unchanged. filterCommentsByActor is the single choke point for issue comments, PR comments, reviews, and inline review comments, so all four paths are fixed together.

Two details worth flagging for review:

  • The commit author selection is deliberately left alone. It is a GitCommit (name/email), not an Actor, so __typename there would be meaningless.
  • The existing ?? "ghost" behavior for deleted accounts is preserved inside resolveActorName, so null authors still never dereference.

Testing

Added 7 cases for resolveActorName in test/actor-filter.test.ts (bot suffixing, human passthrough, no double-suffix, ghost handling, absent __typename, plus wildcard and exact-match integration), and corrected the misleading mock.

Reverting only the src/ changes while keeping the corrected mock:

--- WITHOUT FIX ---
(fail) fetchGitHubData integration with time filtering >
       should filter reviews by both trigger time and actor
 93 pass, 1 fail

--- WITH FIX ---
 125 pass, 0 fail

Checks

  • bun test test/data-fetcher.test.ts test/actor-filter.test.ts — 125 pass, 0 fail
  • bun run typecheck — exit 0
  • bun run format:check — clean
  • Full suite: no regressions. Local run went from 849 pass / 44 fail to 858 pass / 42 fail; the remaining failures are a strict subset of the pre-existing ones on my platform (POSIX-only suites: downloadCommentImages, restoreConfigFromBase, SSH signing, path validation) and are unrelated to this change.

…name

`exclude_comments_by_actor` and `include_comments_by_actor` never matched
any bot. Both the documented `*[bot]` wildcard and exact entries such as
`dependabot[bot]` silently did nothing.

GitHub's GraphQL API returns the bare login for App actors ("dependabot"),
while REST and the GitHub UI append a suffix ("dependabot[bot]"). Filter
patterns are written in the suffixed form, so matching a GraphQL login
against them could never succeed and `actor.endsWith("[bot]")` was dead
code.

Request `__typename` on the Actor-typed author selections and normalize
App actors to their suffixed name via `resolveActorName()` before matching.
Normalizing at the filter boundary fixes the wildcard and exact-match cases
together, and leaves the author names shown in the prompt unchanged.

The existing test mocked `login: "scanner[bot]"`, a payload GraphQL never
produces, which is why the gap was invisible. It now mocks the real shape
(`__typename: "Bot", login: "scanner"`) and fails without this fix.

The commit author selection is left alone: it is a GitCommit, not an Actor.

Fixes anthropics#1514

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings August 9, 2026 15:58

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@ashwin-ant
ashwin-ant merged commit 65b50df into anthropics:main Aug 19, 2026
6 of 36 checks passed
mergify Bot added a commit to ArcadeData/arcadedb that referenced this pull request Aug 23, 2026
Bumps the github-actions group with 2 updates: [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) and [anthropics/claude-code-action](https://github.com/anthropics/claude-code-action).
Updates `docker/setup-buildx-action` from 4.2.0 to 4.3.0
Release notes

*Sourced from [docker/setup-buildx-action's releases](https://github.com/docker/setup-buildx-action/releases).*

> v4.3.0
> ------
>
> * Bump `@​docker/actions-toolkit` from 0.92.0 to 0.95.0 in [docker/setup-buildx-action#595](https://redirect.github.com/docker/setup-buildx-action/pull/595)
> * Bump brace-expansion from 1.1.13 to 1.1.18 in [docker/setup-buildx-action#600](https://redirect.github.com/docker/setup-buildx-action/pull/600)
> * Bump js-yaml from 5.2.0 to 5.3.0 in [docker/setup-buildx-action#585](https://redirect.github.com/docker/setup-buildx-action/pull/585)
> * Bump postcss from 8.5.10 to 8.5.25 in [docker/setup-buildx-action#598](https://redirect.github.com/docker/setup-buildx-action/pull/598)
> * Bump undici from 6.27.0 to 6.28.0 in [docker/setup-buildx-action#601](https://redirect.github.com/docker/setup-buildx-action/pull/601)
>
> **Full Changelog**: <docker/setup-buildx-action@v4.2.0...v4.3.0>


Commits

* [`37fe631`](docker/setup-buildx-action@37fe631) Merge pull request [#595](https://redirect.github.com/docker/setup-buildx-action/issues/595) from docker/dependabot/npm\_and\_yarn/docker/actions-to...
* [`b5c4f91`](docker/setup-buildx-action@b5c4f91) [dependabot skip] chore: update generated content
* [`3e93b63`](docker/setup-buildx-action@3e93b63) build(deps): bump `@​docker/actions-toolkit` from 0.92.0 to 0.95.0
* [`e527031`](docker/setup-buildx-action@e527031) Merge pull request [#600](https://redirect.github.com/docker/setup-buildx-action/issues/600) from docker/dependabot/npm\_and\_yarn/brace-expansion-1...
* [`c68814b`](docker/setup-buildx-action@c68814b) [dependabot skip] chore: update generated content
* [`3f891b0`](docker/setup-buildx-action@3f891b0) build(deps): bump brace-expansion from 1.1.13 to 1.1.18
* [`787db26`](docker/setup-buildx-action@787db26) Merge pull request [#585](https://redirect.github.com/docker/setup-buildx-action/issues/585) from docker/dependabot/npm\_and\_yarn/js-yaml-5.2.1
* [`f779368`](docker/setup-buildx-action@f779368) [dependabot skip] chore: update generated content
* [`7d5e604`](docker/setup-buildx-action@7d5e604) build(deps): bump js-yaml from 5.2.0 to 5.3.0
* [`292c2fb`](docker/setup-buildx-action@292c2fb) Merge pull request [#590](https://redirect.github.com/docker/setup-buildx-action/issues/590) from docker/dependabot/github\_actions/actions/setup-n...
* Additional commits viewable in [compare view](docker/setup-buildx-action@bb05f3f...37fe631)
  
Updates `anthropics/claude-code-action` from 1.0.192 to 1.0.198
Release notes

*Sourced from [anthropics/claude-code-action's releases](https://github.com/anthropics/claude-code-action/releases).*

> v1.0.198
> --------
>
> **Full Changelog**: <anthropics/claude-code-action@v1.0.197...v1.0.198>
>
> v1.0.197
> --------
>
> What's Changed
> --------------
>
> * fix: neutralize the checkout credential under actions/checkout v6+ include layout ([#1510](https://redirect.github.com/anthropics/claude-code-action/issues/1510)) by [`@​TemRevil`](https://github.com/TemRevil) in [anthropics/claude-code-action#1526](https://redirect.github.com/anthropics/claude-code-action/pull/1526)
>
> New Contributors
> ----------------
>
> * [`@​TemRevil`](https://github.com/TemRevil) made their first contribution in [anthropics/claude-code-action#1526](https://redirect.github.com/anthropics/claude-code-action/pull/1526)
>
> **Full Changelog**: <anthropics/claude-code-action@v1.0.196...v1.0.197>
>
> v1.0.196
> --------
>
> What's Changed
> --------------
>
> * fix(security): unify secret redaction in public comment outputs by [`@​Juwan-Hwang`](https://github.com/Juwan-Hwang) in [anthropics/claude-code-action#1693](https://redirect.github.com/anthropics/claude-code-action/pull/1693)
> * fix: strip unused ALL\_INPUTS environment variable from Claude subprocess env by [`@​Juwan-Hwang`](https://github.com/Juwan-Hwang) in [anthropics/claude-code-action#1692](https://redirect.github.com/anthropics/claude-code-action/pull/1692)
> * fix(github): match bot actors in comment filters using GraphQL \_\_typename by [`@​Neal006`](https://github.com/Neal006) in [anthropics/claude-code-action#1616](https://redirect.github.com/anthropics/claude-code-action/pull/1616)
>
> New Contributors
> ----------------
>
> * [`@​Juwan-Hwang`](https://github.com/Juwan-Hwang) made their first contribution in [anthropics/claude-code-action#1693](https://redirect.github.com/anthropics/claude-code-action/pull/1693)
>
> **Full Changelog**: <anthropics/claude-code-action@v1.0.195...v1.0.196>
>
> v1.0.195
> --------
>
> **Full Changelog**: <anthropics/claude-code-action@v1.0.194...v1.0.195>
>
> v1.0.194
> --------
>
> What's Changed
> --------------
>
> * Harden delete\_files MCP tool: validate paths within repo root (consistency with commit\_files) by [`@​GabrielOnRails`](https://github.com/GabrielOnRails) in [anthropics/claude-code-action#1636](https://redirect.github.com/anthropics/claude-code-action/pull/1636)
> * Only limit fetch depth when the checkout is already shallow by [`@​winklemad`](https://github.com/winklemad) in [anthropics/claude-code-action#1647](https://redirect.github.com/anthropics/claude-code-action/pull/1647)
> * fix(base-action): add ~/.local/bin to $GITHUB\_PATH after auto-install by [`@​anishesg`](https://github.com/anishesg) in [anthropics/claude-code-action#1643](https://redirect.github.com/anthropics/claude-code-action/pull/1643)
> * feat(context): include diffHunk in PR review comment context by [`@​rishavnaskar`](https://github.com/rishavnaskar) in [anthropics/claude-code-action#1584](https://redirect.github.com/anthropics/claude-code-action/pull/1584)
> * ci: skip Claude-backed test jobs on fork PRs by [`@​ashwin-ant`](https://github.com/ashwin-ant) in [anthropics/claude-code-action#1655](https://redirect.github.com/anthropics/claude-code-action/pull/1655)
> * fix: bump shell-quote to 1.8.4 to remediate CVE-2026-9277 by [`@​doshidhaval`](https://github.com/doshidhaval) in [anthropics/claude-code-action#1557](https://redirect.github.com/anthropics/claude-code-action/pull/1557)
> * fix(images): bound attachment downloads by [`@​abhinavkr26104`](https://github.com/abhinavkr26104) in [anthropics/claude-code-action#1625](https://redirect.github.com/anthropics/claude-code-action/pull/1625)
>
> New Contributors
> ----------------
>
> * [`@​GabrielOnRails`](https://github.com/GabrielOnRails) made their first contribution in [anthropics/claude-code-action#1636](https://redirect.github.com/anthropics/claude-code-action/pull/1636)
> * [`@​winklemad`](https://github.com/winklemad) made their first contribution in [anthropics/claude-code-action#1647](https://redirect.github.com/anthropics/claude-code-action/pull/1647)
> * [`@​doshidhaval`](https://github.com/doshidhaval) made their first contribution in [anthropics/claude-code-action#1557](https://redirect.github.com/anthropics/claude-code-action/pull/1557)
>
> **Full Changelog**: <anthropics/claude-code-action@v1.0.193...v1.0.194>
>
> v1.0.193
> --------
>
> **Full Changelog**: <anthropics/claude-code-action@v1.0.192...v1.0.193>


Commits

* [`3f854a8`](anthropics/claude-code-action@3f854a8) chore: bump Claude Code to 2.1.238 and Agent SDK to 0.3.238
* [`5ee796a`](anthropics/claude-code-action@5ee796a) chore: bump Claude Code to 2.1.237 and Agent SDK to 0.3.237
* [`cff8d3c`](anthropics/claude-code-action@cff8d3c) fix(git-config): neutralize checkout credential in include-based config ([#1526](https://redirect.github.com/anthropics/claude-code-action/issues/1526))
* [`e2a4b76`](anthropics/claude-code-action@e2a4b76) chore: bump Claude Code to 2.1.236 and Agent SDK to 0.3.236
* [`65b50df`](anthropics/claude-code-action@65b50df) fix(github): match bot actors in comment filters using GraphQL \_\_typename ([#1](https://redirect.github.com/anthropics/claude-code-action/issues/1)...
* [`0a80d21`](anthropics/claude-code-action@0a80d21) fix: strip unused ALL\_INPUTS environment variable from Claude subprocess env ...
* [`54eadc2`](anthropics/claude-code-action@54eadc2) fix(security): unify secret redaction in public comment outputs ([#1693](https://redirect.github.com/anthropics/claude-code-action/issues/1693))
* [`d40ddef`](anthropics/claude-code-action@d40ddef) chore: bump Claude Code to 2.1.235 and Agent SDK to 0.3.235
* [`459ad35`](anthropics/claude-code-action@459ad35) chore: bump Claude Code to 2.1.234 and Agent SDK to 0.3.234
* [`d721746`](anthropics/claude-code-action@d721746) fix: bound image attachment downloads ([#1625](https://redirect.github.com/anthropics/claude-code-action/issues/1625))
* Additional commits viewable in [compare view](anthropics/claude-code-action@e63208c...3f854a8)
  
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
Dependabot commands and options
  
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot show  ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore  major version` will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself)
- `@dependabot ignore  minor version` will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself)
- `@dependabot ignore ` will close this group update PR and stop Dependabot creating any more for the specific dependency (unless you unignore this specific dependency or upgrade to it yourself)
- `@dependabot unignore ` will remove all of the ignore conditions of the specified dependency
- `@dependabot unignore  ` will remove the ignore condition of the specified dependency and ignore conditions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

exclude_comments_by_actor: '*[bot]' wildcard never matches — GraphQL author.login has no [bot] suffix

3 participants