Skip to content

[Bug]: @gittensory mention regex matches longer handles (@gittensory-bot) as a bare command #1344

Description

@philluiz2323

Summary

parseGittensoryMentionCommand matches the bot handle with /(?:^|\s)@gittensory(?:\s+([a-z-]+))?([^\n\r]*)/i, which has no boundary after @gittensory. The handle therefore matches as a prefix of a longer GitHub username, so a comment that mentions a different account whose name starts with gittensory (e.g. @gittensory-bot, @gittensory2) is parsed as a bare @gittensory help command — and the bot posts an unsolicited help reply on that thread.

Area

GitHub App

Expected behavior

A mention only counts when the handle is exactly @gittensory followed by a word boundary (whitespace, punctuation, or end-of-text). @gittensory-bot please look should return null (it mentions another user), while @gittensory ask ... still parses.

Actual behavior

parseGittensoryMentionCommand("@gittensory-bot please take a look") returns a help command (the optional command group requires leading whitespace, so -bot is not consumed and match[1] is undefined → defaults to help). The only caller (maybeProcessGittensoryMentionCommand) then posts a public @gittensory help answer card for a mention that was never directed at the bot.

Reproduction

parseGittensoryMentionCommand("@gittensory-bot please take a look") returns { name: "help", ... } (expected null). Same for @gittensory2 ..., @gittensorybot ....

Validation

Unit tests added asserting @gittensory-bot / @gittensory2 / @gittensorybot return null, while bare @gittensory, @gittensory ask ..., and punctuation boundaries (@gittensory, ...) still parse.

Public-safety check

  • I removed secrets, tokens, wallet details, private keys, local paths, and private scoring output.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions