feat(knowledge): crawl Slack per member on Sim Search through each person's own Slack user token - #7421
Conversation
…rson's own Slack user token
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile SummaryThis PR adds per-member Slack crawling through each member’s Slack user token and changes Slack channel hydration to deferred, run-scoped stubs. It also generalizes bounded transcript handling so Slack and Google Chat preserve their newest messages under the text ceiling.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| apps/sim/connectors/slack/slack.ts | Adds all-channel pagination, deferred stubs, metadata-backed hydration, and newest-message transcript retention without an eligible blocking defect. |
| apps/sim/connectors/utils.ts | Adds pinned records and configurable first/last retention to the bounded text accumulator; the previous newest-message truncation issue is resolved. |
| apps/sim/connectors/google-chat/google-chat.ts | Migrates Google Chat formatting to retain newest messages while preserving its header. |
| apps/sim/lib/knowledge/connectors/member-access.ts | Validates connector scopes through the credential-group provider adapter to support Slack. |
| apps/sim/lib/knowledge/connectors/member-provisioning.ts | Adopts a uniquely configured Slack option and preserves automatic provisioning for standard OAuth providers. |
Sequence Diagram
sequenceDiagram
participant Sync as Member sync
participant Connector as Slack connector
participant Slack as Slack API
participant Index as Knowledge index
Sync->>Connector: listDocuments(member token, cursor)
Connector->>Slack: conversations.list
Slack-->>Connector: Readable public/private channels
Connector-->>Sync: Deferred channel stubs
Sync->>Connector: getDocument(channel ID)
Connector->>Slack: conversations.info
Connector->>Slack: conversations.history
Slack-->>Connector: Channel metadata and messages
Connector-->>Sync: Bounded newest-message transcript and real hash
Sync->>Index: Re-index only when real hash changed
Reviews (3): Last reviewed commit: "fix(slack): fold the channel header into..." | Re-trigger Greptile
There was a problem hiding this comment.
All reported issues were addressed across 9 files
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
…hes the size limit
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
… or topic edit re-indexes
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
Summary
conversations.listunder that token returns exactly the public channels and the private channels they belong to, so the existing members engine crawls Slack the same way it crawls Gmail and Google Chat: each member's listing is their access, and the reader tokens:slack:<team>:<user>is derived from the same credential row on both sides. No new access mode, no bot crawl, no membership walk, no email matching.conversations.historyexempts internal customer-built apps, which is what a Credential Group's custom bot is, so a per-member crawl runs at full Tier 3 speed.getDocument, once per channel per run however many members list it, and hydrates five at a time under the shared 12 MiB text ceiling. With no channel configured it lists every readable channel through the cursor, which is what a members-mode crawl does (the channel selection is the listing cap). A channel listing carries no signal of new messages, so the stub hash is run-scoped and the real hashgetDocumentcomputes decides whether anything is re-indexed: an unchanged channel costs one history page and no embedding.slack-v3so channels indexed before the header and ceiling re-index once.Type of Change
Testing
slack-v3hash on hydration, an empty channel kept live, null only for a channel Slack no longer knows.conversations.historyreference confirms user tokens read public channels they are not in, which the all-channel listing relies on.check:audits(45 audits), and the knowledge, credential-group, connector, and search suites (2,832 tests) pass.Checklist