-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
feat(slack): Add Slack Agent DM and assistant thread support for Seer Explorer #112493
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
693fb1c
727e078
db819cf
58aa620
6a28028
6f4a9d9
08e693a
d9bca7a
e72039e
86ee72e
b7049b3
5211e7d
84a7438
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,6 +6,7 @@ | |
| from sentry.integrations.slack.requests.base import SlackDMRequest, SlackRequestError | ||
| from sentry.integrations.slack.unfurl.handlers import match_link | ||
| from sentry.integrations.slack.unfurl.types import LinkType | ||
| from sentry.integrations.slack.utils.constants import SlackScope | ||
|
|
||
| COMMANDS = ["link", "unlink", "link team", "unlink team"] | ||
|
|
||
|
|
@@ -60,12 +61,30 @@ def dm_data(self) -> Mapping[str, Any]: | |
|
|
||
| @property | ||
| def channel_id(self) -> str: | ||
| if self.is_assistant_thread_event: | ||
| return self.dm_data.get("assistant_thread", {}).get("channel_id", "") | ||
| return self.dm_data.get("channel", "") | ||
|
|
||
| @property | ||
| def user_id(self) -> str: | ||
| if self.is_assistant_thread_event: | ||
| return self.dm_data.get("assistant_thread", {}).get("user_id", "") | ||
| return self.dm_data.get("user", "") | ||
|
|
||
| @property | ||
| def thread_ts(self) -> str | None: | ||
| if self.is_assistant_thread_event: | ||
| return self.dm_data.get("assistant_thread", {}).get("thread_ts", "") | ||
| return self.dm_data.get("thread_ts", "") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
| @property | ||
| def has_assistant_scope(self) -> bool: | ||
| return SlackScope.ASSISTANT_WRITE in self.integration.metadata.get("scopes", []) | ||
|
|
||
| @property | ||
| def is_assistant_thread_event(self) -> bool: | ||
| return self.dm_data.get("type") == "assistant_thread_started" | ||
|
|
||
| @property | ||
| def links(self) -> list[str]: | ||
| return [link["url"] for link in self.dm_data.get("links", []) if "url" in link] | ||
|
|
||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: The
thread_tsproperty returns an empty string""for top-level messages instead ofNone, contradicting its type hint and causing silent failures.Severity: HIGH
Suggested Fix
Modify the
thread_tsproperty to returnNoneinstead of an empty string""when athread_tsis not found inself.dm_data. This aligns the implementation with the type hintstr | Noneand the documented intent. Specifically, changereturn self.dm_data.get("thread_ts", "")toreturn self.dm_data.get("thread_ts").Prompt for AI Agent