Skip to content

feat(slack): Add Slack Agent DM and assistant thread support for Seer Explorer#112493

Open
leeandher wants to merge 6 commits intomasterfrom
leanderrodrigues/iswf-2388-explore-slack-dms-agent-interface-for-seer-explorer
Open

feat(slack): Add Slack Agent DM and assistant thread support for Seer Explorer#112493
leeandher wants to merge 6 commits intomasterfrom
leanderrodrigues/iswf-2388-explore-slack-dms-agent-interface-for-seer-explorer

Conversation

@leeandher
Copy link
Copy Markdown
Member

@leeandher leeandher commented Apr 8, 2026

this allows DMs to the bot trigger Seer and gives a richer experience for starting conversations by suggesting prompts. to support this locally, you need to do a few things

  • Enable Agent + AI App for Slack App
  • Add the assistant:write OAuth scope
  • Add event subscriptions for assistant_thread_started

Refs ISWF-2388

@linear-code
Copy link
Copy Markdown

linear-code bot commented Apr 8, 2026

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Apr 8, 2026
@leeandher leeandher marked this pull request as ready for review April 8, 2026 21:44
@leeandher leeandher requested review from a team as code owners April 8, 2026 21:44
Copy link
Copy Markdown
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 5b77767. Configure here.

# When the user's identity is linked, verify they belong to this
# org. If not linked the downstream task will prompt to link.
if identity_user and not organization.has_access(identity_user):
continue
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Identity check bypassed for assistant_thread_started events

Low Severity

The org membership check in _resolve_seer_organization relies on slack_request.get_identity_user(), which resolves the user via slack_request.user_id. For assistant_thread_started events, the user ID lives at event.assistant_thread.user_id, but SlackEventRequest.user_id reads from event.user, returning "". This means identity_user is always None for these events, causing the if identity_user and not organization.has_access(identity_user) check to be silently skipped. The first org with Seer access is selected without verifying user membership — the exact security gap the PR discussion identified and intended to close. Impact is limited today since the handler only sends generic prompts, but it undermines the access control model.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 5b77767. Configure here.

leeandher and others added 6 commits April 10, 2026 10:02
Add the assistant:write scope to the Slack integration to enable
the bot to act as a Slack Agent, supporting DM-based agent interfaces.

Refs ISWF-2388
Co-Authored-By: Claude Opus 4.6 <noreply@example.com>
Extract shared org-resolution logic into _resolve_seer_organization helper
and merge on_app_mention/on_dm into a single _handle_seer_mention method.
Replace three identical halt reason enums with unified SeerSlackHaltReason.
Extract duplicated loading messages list into a module-level constant.

Refs ISWF-2388
Co-Authored-By: Claude Opus 4.6 <noreply@example.com>
…nges

Update tests to match the refactored _resolve_seer_organization which
now iterates org integrations and uses SlackExplorerEntrypoint.has_access
instead of checking a single feature flag. Align halt reasons with the
consolidated enum values (NO_VALID_INTEGRATION, NO_VALID_ORGANIZATION)
and update the has_access test for the seer-slack-explorer flag rename.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Address PR review feedback:
- Change SLACK_PROVIDERS from set to list to match the RPC method's
  expected `list[str]` parameter type, preventing serialization errors
- Check org status before calling get_installation to avoid unnecessary
  queries for inactive orgs
- Verify the requesting Slack user belongs to the resolved org when
  their identity is linked, preventing cross-org data access when
  multiple orgs share a Slack workspace
- Fix inaccurate comments about DM fallback behavior

Refs ISWF-2388
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@leeandher leeandher force-pushed the leanderrodrigues/iswf-2388-explore-slack-dms-agent-interface-for-seer-explorer branch from 5b77767 to 6f4a9d9 Compare April 10, 2026 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants