Fail explicitly when multiple owners found for Slack/Discord bot messages#758
Fail explicitly when multiple owners found for Slack/Discord bot messages#758kilo-code-bot[bot] wants to merge 1 commit intomainfrom
Conversation
…ages Previously, if multiple integrations existed for the same Slack workspace or Discord server (e.g. installed on both a personal account and an org), the bot would non-deterministically pick one, causing unpredictable failures. Now the bot detects duplicate integrations and returns a clear error message to the user asking them to remove the duplicate, instead of proceeding with an arbitrary installation.
| return db | ||
| .select() | ||
| .from(platform_integrations) | ||
| .where( |
There was a problem hiding this comment.
[WARNING]: This query does not filter by integration_status. A suspended or pending integration would count toward the duplicate check, potentially blocking a valid active integration from being used.
Consider adding eq(platform_integrations.integration_status, INTEGRATION_STATUS.ACTIVE) to the and(...) clause. The same applies to the Slack counterpart getAllInstallationsByTeamId.
| return db | ||
| .select() | ||
| .from(platform_integrations) | ||
| .where( |
There was a problem hiding this comment.
[WARNING]: Same as the Discord counterpart — this query does not filter by integration_status. A suspended integration would be counted as a duplicate, causing the bot to reject messages even if only one integration is actually active.
Code Review SummaryStatus: 4 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Other Observations (not in diff)Issues found in unchanged code that cannot receive inline comments:
Files Reviewed (4 files)
|
Summary
getAllInstallationsByTeamIdandgetAllInstallationsByGuildIdquery functions to support the duplicate detection.Changes
src/lib/integrations/slack-service.tsgetAllInstallationsByTeamId()src/lib/integrations/discord-service.tsgetAllInstallationsByGuildId()src/lib/slack-bot.tsprocessKiloBotMessage()src/lib/discord-bot.tsprocessDiscordBotMessage()Built for Remon Oldenbeuving by Kilo for Slack