feat(sim-search): search Slack live as the person asking, instead of crawling it - #7429
feat(sim-search): search Slack live as the person asking, instead of crawling it#7429waleedlatif1 wants to merge 4 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile SummaryThe PR adds live, viewer-scoped Slack search to Sim Search while retaining indexed knowledge results.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| apps/sim/lib/api/contracts/knowledge/sim-search.ts | Defines and exports the canonical request, response, result, and status schemas and types for live Slack search. |
| apps/sim/app/api/knowledge/sim-search/slack/route.ts | Adds a session-authenticated, workspace-authorized route adapter for federated Slack search. |
| apps/sim/lib/knowledge/application/sim-search.ts | Adds the authorized application use case that searches Slack under the acting viewer’s identity and projects normalized results. |
| apps/sim/lib/slack-search/credentials.ts | Selects the viewer’s eligible managed Slack credential within the authorized workspace. |
| apps/sim/lib/slack-search/search.ts | Resolves managed OAuth tokens, maps credential states, and degrades Slack failures without affecting indexed results. |
| apps/sim/lib/slack-search/client.ts | Implements the bounded Slack Data Access API request and normalizes searchable message context. |
| apps/sim/hooks/queries/kb/knowledge.ts | Adds viewer-keyed, short-lived React Query integration for live Slack results. |
| apps/sim/app/workspace/[workspaceId]/home/components/knowledge-search-results/slack-search-results.tsx | Renders Slack results separately and surfaces actionable credential or availability states. |
| apps/sim/app/workspace/[workspaceId]/home/components/knowledge-search-results/knowledge-search-results.tsx | Composes indexed and Slack result groups under a shared keyboard-navigation container. |
Sequence Diagram
sequenceDiagram
participant U as Viewer
participant UI as Sim Search UI
participant API as Slack Search Route
participant C as Credential Resolver
participant S as Slack Data Access API
U->>UI: Submit search query
UI->>API: POST workspaceId and query
API->>API: Authenticate and authorize workspace access
API->>C: Resolve viewer's Slack user token
alt Connected and authorized
C-->>API: User access token
API->>S: assistant.search.context
S-->>API: Permission-filtered messages
API-->>UI: ok and normalized results
UI-->>U: Separate Slack result group
else Reauthorization required
C-->>API: Credential needs reauthorization
API-->>UI: needs_reauth
UI-->>U: Reconnect Slack prompt
else Slack or credential unavailable
API-->>UI: unavailable
UI-->>U: Slack unavailable notice
end
Reviews (4): Last reviewed commit: "fix(sim-search): refresh the Slack searc..." | Re-trigger Greptile
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
…d tell a member to reconnect
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
All reported issues were addressed across 17 files
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
Summary
assistant.search.context) with that person's own Slack user token, so Slack answers from its own index and enforces its own permissions. Nothing about Slack is stored, embedded, or ACL-materialized.Slack app configuration this needs
The scopes live on the workspace's own custom Slack app, the one their Credential Group already authorizes against. Sim's hosted Marketplace app is unchanged and needs no new scopes and no re-review.
On the customer's app:
search:read.public,search:read.private,search:read.im,search:read.mpim. Slack requires at leastsearch:read.public; the rest widen coverage to the private channels and DMs that person can already read.Slack's own limits, for the record: the API is available to directory-published and internal apps, which a custom workspace app is; semantic ranking needs Slack AI Search (Business+/Enterprise+) and falls back to keyword search on other plans; guests cannot use it.
Migration
Adding scopes changes the Slack option's scope version, so every already-enrolled Slack member is marked as needing re-authorization and must reconnect once. Until they do, Slack search reports
needs_reauthand the UI tells them to reconnect. Their Slack tool credentials are affected by the same re-auth, so this should land with a heads-up rather than silently.Type of Change
Testing
check:audits(45 audits), and the full suite (30,438 tests) pass.Not in this PR
Assistant mode still grounds only in knowledge bases. Wiring these passages into the agent turn reuses
searchSlackForViewerunchanged and is the natural follow-up.Checklist