Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(alerts): broadcast repeat firings to the channel from their slack thread (#123768)

Jimmy Zhu44338f193545
diff --git a/products/alerts_platform/backend/delivery/slack.py b/products/alerts_platform/backend/delivery/slack.py
index 984920dbba13..c8b49e1d9b9f 100644
--- a/products/alerts_platform/backend/delivery/slack.py
+++ b/products/alerts_platform/backend/delivery/slack.py
@@ -127,8 +127,11 @@ class SlackTransport:
blocks,
text,
thread_ts=in_reply_to.external_ref.get("ts") if in_reply_to else None,
- # A root edit notifies nobody, so a resolve also goes to the channel, as legacy posted it.
- reply_broadcast=in_reply_to is not None and message.transition.kind == AlertEventKind.RESOLVED,
+ # A root edit notifies nobody, and a thread reply notifies only the people who follow
+ # the thread. So a resolve and a repeat firing also go to the channel, where legacy
+ # posted each one as a new message.
+ reply_broadcast=in_reply_to is not None
+ and message.transition.kind in (AlertEventKind.RESOLVED, AlertEventKind.FIRING),
)
try:
diff --git a/products/alerts_platform/backend/tests/test_delivery_slack.py b/products/alerts_platform/backend/tests/test_delivery_slack.py
index 6bbe005b0526..1ac443fc5503 100644
--- a/products/alerts_platform/backend/tests/test_delivery_slack.py
+++ b/products/alerts_platform/backend/tests/test_delivery_slack.py
@@ -154,7 +154,7 @@ class TestSlackTransport(APIBaseTest):
assert post.call_args.kwargs["thread_ts"] is None
@parameterized.expand(
- [("a_resolve", AlertEventKind.RESOLVED, True), ("a_repeat_firing", AlertEventKind.FIRING, False)]
+ [("a_resolve", AlertEventKind.RESOLVED, True), ("a_repeat_firing", AlertEventKind.FIRING, True)]
)
def test_a_reply_goes_into_the_thread_it_names_and_keeps_no_content(
self, _name: str, kind: AlertEventKind, broadcast: bool