[BUG] Slack channel identity uses the bot's original auth.test username after an app rename, so channel mentions by display name are ignored
Versions
@mastra/core1.71.0,@mastra/factory0.17.2,@chat-adapter/slack4.41.0
Expected
After a Slack app's bot is renamed (App Home → Display Name / Default username), mentioning it by its current name in a channel is treated as addressed to the bot.
Actual
Slack keeps a bot user's username from the first install. auth.test keeps returning it (user: "acme-bot"), while users.info shows the new name (profile.real_name: "helper") and people mention the bot as @helper. ChatChannelProcessor tells the model:
Your identity on this platform is "acme-bot" / <@U…>. Messages containing these references are directed at you.
In channels it is also told to stay silent unless explicitly mentioned. The message text the model sees contains @helper …, so it concludes the message is for someone else and returns an empty reply. Its reasoning for such turns says it should respond "as helper, not as myself" and stay silent. DMs are unaffected.
Cause
@chat-adapter/slacksetsadapter.userName = authResult.userininitialize(). This also overwrites the documenteduserNameoption ("Override bot username").- Mastra passes
adapter.userNameasbotUserNametoChatChannelProcessor. - Factory's
SlackIntegrationdoesn't pass auserNameoption at all.
Repro
- Create a Slack app with bot name
acme-bot, install it, connect it to Factory. - Rename the bot in App Home to
helper(display name and default username) and reinstall.auth.teststill returnsacme-bot. - Restart the server, invite the bot to a channel, send
@helper say hi→ no reply; the saved assistant message has only a reasoning part.
Suggested fix
Use the bot's profile name (users.info → profile.display_name, falling back to real_name) as the identity, or include it next to the username. Also keep an explicit userName option instead of overwriting it in initialize().
Related: #23096 (mentions as <@U…|Display Name>) would expose the bot's user id in the message text, which may let the model match it against <@U…>. It doesn't change the stale identity name, and it's still open.
Workaround
A host can wrap the Slack integration so that after the adapter's initialize(), it looks up users.info for adapter.botUserId and replaces adapter.userName with the profile name. We run this in production and channel mentions by display name work again.
Source: mastra-ai/mastra