GitHub adapter treats a bot mention inside code, quotes, or HTML as a new mention
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 66/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- github, typescript
- Domain
- backend-api-design
Research direction
Start with parseIssueComment and parseReviewComment in packages/adapter-github/src/index.ts, then read the mention handling in packages/chat/src/chat.ts and the GitLab implementation referenced in the issue. Check the existing tests for both GitHub webhook event types and add cases for mentions inside code, quotes, and HTML. Done means normal text mentions still trigger onNewMention, while those examples do not.
Written by the indexing model from the issue text.
Description
Hope you're doing well! On the GitHub adapter, a comment that only shows the bot's name inside inline code, a code block, a > quote, or an HTML comment still fires onNewMention.
What the code is for
parseIssueComment and parseReviewComment turn issue_comment and pull_request_review_comment webhooks into a Message (adapter-github/src/index.ts#L856-L935). Chat reads message.isMention to decide whether onNewMention runs.
Current behaviour
- Someone comments
try `@my-bot review` to rerun iton a PR, or quotes an earlier comment that mentioned the bot. - The adapter builds the
Messagewithout settingisMention. setMentionFlagssees it unset and falls back todetectMention(chat.ts#L3526-L3545), which runs a regex overmessage.text(chat.ts#L3626-L3660).message.textcomes fromtoPlainText, which keeps the text inside code, quotes, and HTML (markdown.ts#L539-L580).- The regex finds
@my-botthere andonNewMentionruns, even though nobody mentioned the bot.
The comment in setMentionFlags already names this case: "code samples and quoted text can look like a mention".
Expected behaviour
Only a mention in the normal text of a comment counts. @my-bot inside inline code, a code block, a quote, or HTML shouldn't fire onNewMention.
Repro
On main (990411ea), I sent signed webhooks for both event types into a real Chat with userName: "test-bot" and the memory state. Same result for issue_comment and pull_request_review_comment:
"@test-bot please review" onNewMention: yes (expected)
"run `@test-bot review`" onNewMention: yes (should be no)
"```\n@test-bot review\n```" onNewMention: yes (should be no)
"> @test-bot review" onNewMention: yes (should be no)
"<!-- @test-bot -->" onNewMention: yes (should be no)
"@test-botx hi" onNewMention: no (expected)
"mail [email protected]" onNewMention: no (expected)
The lookalike and email cases are already handled nicely by the boundary checks in detectMention.
Prior work
The GitLab adapter already solves this: mentionsUser and mentionableText walk the parsed markdown and skip code, inlineCode, blockquote, and html before matching (adapter-gitlab/src/index.ts#L1502-L1539). #946 made isMention three state so adapters can report a definite false, and #947 and #1059 fixed the same kind of problem for Slack, where a bot name in code formatting was read as a mention.

Only GitLabAdapter.buildMessage calls mentionsUser and mentionableText on main, Functions view in Architect
Question
Should quotes be left out too, like GitLab does, or only code, like the Slack fix? I have a small PR ready that sets isMention in both GitHub parse functions using GitLab's rule (code, inline code, quotes, and HTML), since that seemed the closest match. Happy to drop quotes or change anything else if you'd rather it work another way. Thanks for all the work on these adapters!
- Dominant language
- TypeScript
- Stars
- 2.5k
- Forks
- 355
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 42
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from vercel/chat
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
X and Twitch: paragraphs inside a block quote are joined with no spacePossibly taken @abhiramshaji-cyber claimed this 4 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 58/100
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 72/100
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 1/5 1-3 hours Newbie friendliness 87/100
Maintainers usually reply within 1 day
-
🛠️ dette technique
Difficulty 2/5 1-3 hours Newbie friendliness 61/100
betagouv/mon-entreprise#4752 · 1 comment ·
Maintainers usually reply within 5 days
-
type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
franciscoBSalgueiro/en-croissant#1111 ·
Maintainers usually reply within 2 days
-
area/providers type/feature version/v2
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
anomalyco/opencode#64845 · 1 comment ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day