Skip to content

fix(slack): prevent duplicate workspace installs#2989

Merged
RSO merged 5 commits intomainfrom
RSO/hurricane-taker
May 1, 2026
Merged

fix(slack): prevent duplicate workspace installs#2989
RSO merged 5 commits intomainfrom
RSO/hurricane-taker

Conversation

@RSO
Copy link
Copy Markdown
Contributor

@RSO RSO commented May 1, 2026

Summary

  • Prevent Slack workspaces from being connected to multiple Kilo owners by checking Slack team ID conflicts before persisting installs.
  • Add a Slack-specific unique index on platform installation ID, with migration cleanup for historical duplicate workspace rows.
  • Surface a helpful duplicate-workspace message on the Slack integration page after OAuth callback redirects.

Verification

  • Browser smoke tested the Slack integration error state and confirmed the duplicate-workspace alert is shown.

Visual Changes

N/A

Reviewer Notes

  • Migration preserves the active or most-recent Slack integration per workspace and suspends older duplicate rows before adding the unique index.
  • Focused automated checks run locally: pnpm test:db, pnpm test -- apps/web/src/lib/integrations/slack-service.test.ts, pnpm format, scripts/typecheck-all.sh --changes-only, and pnpm --filter web typecheck.

@RSO RSO marked this pull request as ready for review May 1, 2026 12:51
Comment thread packages/db/src/migrations/0108_wise_psylocke.sql
Comment thread packages/db/src/migrations/0108_wise_psylocke.sql
@kilo-code-bot
Copy link
Copy Markdown
Contributor

kilo-code-bot Bot commented May 1, 2026

Code Review Summary

Status: 2 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 2
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
packages/db/src/migrations/0108_wise_psylocke.sql 18 Duplicate cleanup keeps an arbitrary Slack integration because LIMIT 1 has no deterministic ordering.
packages/db/src/migrations/0108_wise_psylocke.sql 56 Unique index is created without CONCURRENTLY, which can lock writes on a populated table.

Fix these issues in Kilo Cloud

Other Observations (not in diff)

Issues found in unchanged code that cannot receive inline comments:

File Line Issue
Files Reviewed (9 files)
  • apps/web/src/app/api/integrations/slack/callback/route.ts - 0 issues
  • apps/web/src/components/integrations/SlackIntegrationDetails.tsx - 0 issues
  • apps/web/src/lib/integrations/slack-service.test.ts - 0 issues
  • apps/web/src/lib/integrations/slack-service.ts - 0 issues
  • apps/web/src/routers/slack-router.ts - 0 issues
  • packages/db/src/migrations/0108_wise_psylocke.sql - 2 issues
  • packages/db/src/migrations/meta/0108_snapshot.json - 0 issues
  • packages/db/src/migrations/meta/_journal.json - 0 issues
  • packages/db/src/schema.ts - 0 issues

Reviewed by gpt-5.5-2026-04-23 · 384,483 tokens

@RSO RSO merged commit 0885e23 into main May 1, 2026
39 checks passed
@RSO RSO deleted the RSO/hurricane-taker branch May 1, 2026 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants