Repository navigation
fix(automations): Run Slack channel automations on bot posts that have no user - #3213
Conversation
…e no user App integrations such as HackerOne post bot_message events with a bot_id and no user. The workspace member check drops them before channel-message automations can match, so match.user_id cannot name these bots. Accept these posts only in channels that Slack marks as not shared with another organization, and send them only to channel-message automations that name the bot ID. They never start a Turn. Refs #2034 Co-Authored-By: Mark Collao <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
15 screenshot changes — 15 changed · 0 added · 0 removed Review screenshots in Frameshift Show 9 more changed screenshots |
Share the mention check between Turn routing and workspace bot posts, so a bot post that mentions Junior only in a section block also runs no channel-message automation.
Read the channel scope once from the signed envelope: a workspace channel needs is_ext_shared_channel false, context_team_id equal to team_id, and no context_enterprise_id. Link previews and bot posts both use it. Verify the bot next to the member check. A bot_profile must name this workspace. Without one, bots.info must return a live bot, and its bot user, when it has one, must belong to this workspace. Pass a typed author to the channel-message Event, and share one ingest helper with member posts. Co-Authored-By: David Cramer <[email protected]>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 88fdb51. Configure here.
|
if we know about grid, can we just efault grid to a safe mode of operating? |
…nel-automations # Conflicts: # packages/junior/tests/integration/slack/channel-message-automations.test.ts
…fe mode On Enterprise Grid, Slack sets context_enterprise_id on every event, so bot posts with no user never ran channel-message automations. Read a Grid channel in this workspace as the enterprise scope. There, accept a bot post only when Slack names this workspace as the bot's, in bot_profile or through the bot user of bots.info. A classic integration with no bot user runs nothing, because another workspace of the org could post in an org-shared channel.
|
Yes. Done in 5abf3a4.
A correction to my earlier reply: link previews only reject I also merged |
|
Do one more pass here. Is any of this code that can be standardized elsewhere? Want to make sure we're not duplicating access checks or other behavior. |
A bot user from bots.info now goes through the same cached users.info membership check as any other author, so the team and deleted rules live in one place. The bot cache stores only what bots.info says about the bot. Move lookupSlackBot next to lookupSlackUserProfile, and the text and block mention check next to textMentionsBot.
|
I made one more pass for duplication. The fixes are in f36d306. Consolidated
Checked, nothing to share
Typecheck and lint pass, and so do the Slack integration, component and unit tests (284 files). |

Some app integrations, such as HackerOne, post
bot_messageevents that have abot_idand nouser. Since #1936,isSlackWorkspaceMemberreturns false for these events, so the webhook drops them before channel-message automations can match. Because of this, #2197'smatch.user_idcannot name these bots. A channel-message automation filtered on HackerOne's bot ID has had zero runs.This change adds a narrow path for these posts. Per review, it uses a workspace + bot check, not an allowlist.
slackChannelScopereads the signed envelope once. Aworkspacechannel needsis_ext_shared_channel: false,context_team_idequal toteam_id, and nocontext_enterprise_id(callback fields). Any other envelope isunknownand drops the post. An Enterprise Grid install drops these posts too.slackWorkspaceBotIdsits next toisSlackWorkspaceMemberand uses the same cache TTLs:bot_profile, itsidmust matchbot_id, itsteam_idmust be this workspace, and it must not be deleted. No lookup.bots.infomust return the bot, not deleted. If the bot has auser_id,users.infomust return a bot user in this workspace that is not deleted.B09LC7U21UG) is this case.match.user_idrun. The Event gets a typed author ({ kind: "bot", botId }), so the summary no longer guesses the kind from the ID's format. Member posts and bot posts share one ingest helper.Link previews read the same channel scope and skip only
external. Their behavior does not change.slack.message.ingressnow recordsapp.slack.context_team_idandapp.slack.context_enterprise_id, so a dropped bot post can be traced to its envelope.#2034 is still open. This PR answers it only for channel-message automations and leaves Workflow mentions as they are.
via @markatsentry, @dcramer.
--
View Session [Sentry]