← All writing

How to detect bot-created GitHub issues when the [bot] check misses them

You already skip every author whose login ends in [bot], and a nightly job still filed forty issues into your tracker last night, one every few seconds, under a maintainer's personal account.

The filter is not broken. It is answering a narrower question than the one you have.

What GitHub's own signal covers

Two fields in the webhook payload carry it. The actor's user.type is the string Bot, and the actor's login ends in [bot]. Together they catch GitHub Apps posting as themselves, which is most of the obvious traffic: github-actions[bot], renovate[bot], dependabot[bot]. Check this first. It costs nothing and it never flags a person: GitHub sets both fields itself, and a login with brackets in it cannot be registered by hand. What it does instead is miss things, which is the rest of this page.

One detail worth deciding rather than discovering: whether each half of that check ignores case. The two halves do not have to agree, and nothing tells you which way you chose until a login with different casing walks through. Pick one and write a test for it.

Skipping is the right outcome, but not in silence. An owner who sees nothing happen on forty issues will assume it is broken. Post one notice explaining why the robot was skipped, scoped to the repository rather than the issue and rationed to one in a long while, and reserve real silence for traffic the author never sees anyway, such as your own comments and pull request threads. If your tracker is the thing filling up rather than the filter you are building, the maintainer's version of this is the same problem from the other side.

The case it misses

A human account running a script. A personal access token in a cron job, an Actions workflow authenticating as a maintainer, a one-off migration importer someone wrote on a Thursday. The account type is User, the login has no suffix, and the avatar is a photograph of a person who is asleep.

Nothing in the account metadata separates that from a real report, because there is nothing to separate: it is a real account. What separates them is pace. Bulk filers are easy to see once you look at the gaps between one author's issues rather than at who the author is. A script files most of its issues within a minute of its previous one, which a person writing reports by hand almost never does, and no amount of reading the profile would show you that.

Three signals, two points, one decision

Scoring beats a single test, because every individual signal here has an honest counter-example. Three signals, one point each, two points calls it a batch.

  • Earlier issues by the same author inside a short window, minutes rather than hours, one point each, capped at two. The cap matters: it means a burst of three is decisive on its own, and a burst of thirty is not more decisive than that.
  • The issue was created through a GitHub App on the author's behalf, which the payload reports as performed_via_github_app being present and not null. One point, never two, because plenty of integrations post through an app for a real person.
  • An automation phrase in the body. One point, for the same reason.

A burst of two is a person having a bad morning. An app alone is a person using a tool. Only the combinations are worth acting on.

Where the burst line sits

These are the numbers a future change will move by accident, so pin each one with a test that fails loudly.

  • A first issue is always a person.
  • One earlier issue is still a person, because two bugs found in one sitting is ordinary.
  • The issue that crosses your line is a batch. That test is the line itself.
  • Issues outside the window do not count, and an issue exactly on the edge of it is decided by a test rather than by whichever comparison operator got typed.
  • An arrival time in the future is ignored. This is the one nobody writes until it bites: your webhook host and your database do not share a clock, and an arrival a minute ahead will otherwise manufacture a burst out of nothing.

The automation marker, and the sentence that must never match it

Match the phrasings that actually appear, such as auto-generated, generated automatically, generated by a script (or a bot, tool or workflow), created automatically and automated report, and keep the pattern narrow enough that you can list what it matches.

Write the false-positive test before you write the pattern, because the failure mode is expensive and specific. A person describing a generator is not a generated issue, and they have usually written you exactly the kind of report a bug report guide asks for: a concrete artefact, a trigger, a browser. Ordinary prose that mentions generating something must come back unflagged, and that is the test to write first.

What the pattern should catch

Auto-generated from failing test run #4412. Do not edit.

What a naive match on "generated" does instead

The PDF generated by the export button is blank on Safari.

Now the honest part, which is the most useful thing on this page. Expect pace to do nearly all of the work. Scripts rarely announce themselves in the body, and an issue created through an app is weak evidence on its own. Build all three, because the other two cost a regex and a null check, but do not be surprised if pace is the only signal that ever decides anything.

Why a burst cannot see itself

This is the bug that makes the whole thing look like it works while it does nothing.

If you count an author's recent issues by querying whatever your system stores for them, you are querying records written after your reply posted, half a minute or more after the issue arrived. A scripted burst lands seconds apart, so the entire burst arrives before the first stored record exists. Every issue in it looks like a first issue, the classifier returns the friendly answer forty times, and every log line is correct.

The fix: a filing record written before anything slow

One tiny record per issue, written the moment the webhook lands: author, repository, issue number, arrival time. Before any analysis, any model call, any token fetch. It is the only write in the request that has to be fast, because it is the only one the next issue in the burst depends on.

Four details that turn out to matter. Key it on repository plus issue number, so a redelivered webhook overwrites rather than double counts and a retry cannot invent a burst. Query it as a range on arrival time alone and filter the author in memory, so it needs no extra index and no migration when you add a field. Give the records an expiry comfortably longer than the window, so the collection stays small on its own. And classify per author, never per installation: a repository shared by a release script and a colleague should still answer the colleague like a colleague. The tempting alternative, a list of known robot account names, is a maintenance job that grows with every customer and stops working silently the first time somebody renames an account.

Even with the record in place, expect the first one or two issues of each burst to be treated as a person's, because the window has nothing in it yet. That is the expected shape rather than a fault.

When the lookup fails, and what happens next

A failed read must never cost the reply. Catch it, log it, and fall back to the human treatment rather than the automated one, because the two mistakes do not cost the same. A script treated as a person gets one warm message that nobody reads. A person treated as a script gets a curt reply to the report they sat down and wrote, and remembers it.

The one thing WhatProblem uses this score for is choosing the register a reply is written in, conversational or stripped back to the substance.

What the separation is actually for is what happens after it. Machine-filed issues are uniform, complete-looking and missing intent; human-filed ones are short and ambiguous in the specific way that "it doesn't work" is ambiguous. A batch tends to resolve to actionable or not ours in bulk, without a clarifying round trip each, which is the cheapest end of the order a triage pass should run in. Mixed together, the batch buries the few issues a person wrote by hand and waited for an answer to.

WhatProblem asks these questions for you

It reads new GitHub issues and asks what is missing, in the issue thread, before anyone on your team has to.

Install from GitHub Marketplace