#20697: feat(discord): auto-resolve user mentions in message content
channel: discord
size: XS
Cluster:
Signal and Discord Fixes
## Summary
Resolves Discord user mentions (e.g., `<@123>`) in incoming message content to human-readable names (e.g., `@Alice`) using the message's `mentions` metadata.
Fixes #20617.
## Implementation
- Added `resolveDiscordMentions` helper in `message-utils.ts`
- Maps ID to `global_name` (priority) or `username`
- Handles both `<@id>` and `<@!id>` formats
- Added unit tests covering resolution and no-op cases
## Impact
- Agents now see `@Alice hello` instead of `<@12345> hello`
- Improves context understanding for multi-user conversations
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Adds user mention resolution to Discord message content, converting `<@id>` format to readable names like `@Alice`. The implementation correctly prioritizes `global_name` over `username` and handles both `<@id>` and `<@!id>` formats. The change is scoped to the message text resolution flow and includes appropriate test coverage for basic cases.
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk
- The implementation is clean, focused, and follows existing patterns in the codebase. The change is scoped to message text resolution with appropriate guards. Test coverage validates the core functionality. No breaking changes or security concerns identified.
- No files require special attention
<sub>Last reviewed commit: 0cb7e10</sub>
<!-- greptile_other_comments_section -->
<sub>(4/5) You can add custom instructions or style guidelines for the agent [here](https://app.greptile.com/review/github)!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#18512: feat(discord): Add resolveUser action for username-based user lookup
by Ahsuu27488 · 2026-02-16
77.5%
#13430: fix(discord): properly handle bot-sent @everyone mentions
by wassimbensalem · 2026-02-10
76.6%
#22940: fix(discord): detect voice messages for preflight transcription bef...
by aldoeliacim · 2026-02-21
74.1%
#23689: feat(discord): add ignoreOtherMentions config option
by Q00 · 2026-02-22
73.6%
#15759: discord: fix sender undefined type errors in message handler
by bniceley50 · 2026-02-13
73.2%
#12204: fix(discord): resolve numeric guildId/channelId pairs in channel al...
by mcaxtr · 2026-02-09
72.3%
#7459: fix(signal): resolve mention placeholders to actual names
by gerigk-agent · 2026-02-02
72.1%
#22557: fix(discord): coerce exec approval approver IDs to string to preven...
by zwffff · 2026-02-21
71.1%
#21463: fix(discord): prevent WebSocket death spiral + fix numeric channel ID…
by akropp · 2026-02-20
70.8%
#19615: fix(discord): include default account when sub-accounts are configured
by prue-starfield · 2026-02-18
70.3%