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(slack_app): let thread creators choose how untagged replies are handled (#83595)

Vojta Bartoš3eedc48e12c8
diff --git a/posthog/temporal/ai/slack_app/__init__.py b/posthog/temporal/ai/slack_app/__init__.py
index 9f226b140969..7ecaf6e426d4 100644
--- a/posthog/temporal/ai/slack_app/__init__.py
+++ b/posthog/temporal/ai/slack_app/__init__.py
@@ -30,6 +30,7 @@ from posthog.temporal.ai.slack_app.activities import (
post_posthog_code_no_repos_activity,
post_posthog_code_picker_timeout_activity,
post_posthog_code_repo_picker_activity,
+ request_untagged_followup_confirmation_activity,
resolve_posthog_code_slack_command_user_activity,
resolve_posthog_code_slack_user_activity,
run_posthog_slack_inbox_onboarding_activity,
@@ -52,6 +53,7 @@ from posthog.temporal.ai.slack_app.types import (
SLACK_APP_ACTIVITIES = [
classify_untagged_followup_activity,
+ request_untagged_followup_confirmation_activity,
resolve_posthog_code_slack_user_activity,
resolve_posthog_code_slack_command_user_activity,
collect_posthog_code_thread_messages_activity,
@@ -114,6 +116,7 @@ __all__ = [
"post_posthog_code_no_repos_activity",
"post_posthog_code_picker_timeout_activity",
"post_posthog_code_repo_picker_activity",
+ "request_untagged_followup_confirmation_activity",
"resolve_posthog_code_slack_command_user_activity",
"resolve_posthog_code_slack_user_activity",
"run_posthog_slack_inbox_onboarding_activity",
diff --git a/posthog/temporal/ai/slack_app/activities/__init__.py b/posthog/temporal/ai/slack_app/activities/__init__.py
index 26fbc729e2de..05bcc6e61cb7 100644
--- a/posthog/temporal/ai/slack_app/activities/__init__.py
+++ b/posthog/temporal/ai/slack_app/activities/__init__.py
@@ -18,6 +18,7 @@ from posthog.temporal.ai.slack_app.activities.messaging import (
post_posthog_code_no_repos_activity,
post_posthog_code_picker_timeout_activity,
post_posthog_code_repo_picker_activity,
+ request_untagged_followup_confirmation_activity,
)
from posthog.temporal.ai.slack_app.activities.onboarding import (
run_posthog_slack_inbox_onboarding,
@@ -70,6 +71,7 @@ __all__ = [
"post_posthog_code_no_repos_activity",
"post_posthog_code_picker_timeout_activity",
"post_posthog_code_repo_picker_activity",
+ "request_untagged_followup_confirmation_activity",
"resolve_posthog_code_slack_command_user_activity",
"resolve_posthog_code_slack_user_activity",
"run_posthog_slack_inbox_onboarding",
diff --git a/posthog/temporal/ai/slack_app/activities/messaging.py b/posthog/temporal/ai/slack_app/activities/messaging.py
index 1a4cb1550cc2..cc7b70fd8a39 100644
--- a/posthog/temporal/ai/slack_app/activities/messaging.py
+++ b/posthog/temporal/ai/slack_app/activities/messaging.py
@@ -348,3 +348,77 @@ def mark_slack_app_message_queued_activity(input: SlackAppMessageReactionInput)
message_ts=input.message_ts,
error=str(e),
)
+
+
+@close_db_connections
+def request_untagged_followup_confirmation_activity(
+ inputs: PostHogCodeSlackMentionWorkflowInputs,
+ channel: str,
+ thread_ts: str,
+ slack_user_id: str,
+) -> bool:
+ """Apply the thread creator's `ask` mode to a reply the classifier just passed.
+
+ Returns ``True`` when the reply must not be forwarded: either the prompt is
+ now waiting on its author's answer, or the creator switched the thread off
+ while this run was in flight. ``False`` lets the workflow carry on.
+
+ Every untagged reply is asked about, the creator's own included — nobody
+ tagged the app, which is the ambiguity the mode exists to settle.
+
+ Running here rather than in the webhook handler is the point of the mode:
+ the classifier has already judged the reply worth the agent's attention, so
+ the prompt only interrupts someone over a message that would otherwise have
+ started work.
+ """
+ from products.slack_app.backend.api import (
+ _post_untagged_followup_prompt, # noqa: PLC0415 — keeps the webhook module off the worker import path
+ )
+ from products.slack_app.backend.models import SlackThreadTaskMapping, UntaggedFollowupMode # noqa: PLC0415
+ from products.slack_app.backend.services.slack_settings import resolve_untagged_followup_mode # noqa: PLC0415
+
+ inputs = coerce_mention_workflow_inputs(inputs)
+ mapping = (
+ SlackThreadTaskMapping.objects.select_related("integration")
+ .filter(integration_id=inputs.integration_id, channel=channel, thread_ts=thread_ts)
+ .first()
+ )
+ if mapping is None:
+ # The thread lost its mapping mid-run; the forward activity would drop this
+ # anyway, and there is nobody left to attribute a prompt to.
+ return True
+
+ integration = mapping.integration
+ mode = resolve_untagged_followup_mode(integration, mapping.mentioning_slack_user_id)
+ if mode == UntaggedFollowupMode.AUTO:
+ return False
+ if mode == UntaggedFollowupMode.NEVER:
+ logger.info(
+ "slack_app_untagged_followup_switched_off_mid_run",
+ integration_id=integration.id,
+ channel=channel,
+ thread_ts=thread_ts,
+ slack_user_id=slack_user_id,
+ )
+ return True
+
+ prompted = _post_untagged_followup_prompt(
+ SlackIntegration(integration),
+ integration,
+ inputs.event,
+ is_ext_shared_channel=inputs.is_ext_shared_channel,
+ )
+ if not prompted:
+ # Still held back: forwarding a reply we failed to ask about would break the
+ # creator's setting. Logged loudly because the replier sees nothing at all —
+ # no prompt, no answer — and that is otherwise indistinguishable from the
+ # classifier dropping their message.
+ logger.warning(
+ "slack_app_untagged_followup_prompt_not_delivered",
+ integration_id=integration.id,
+ channel=channel,
+ thread_ts=thread_ts,
+ slack_user_id=slack_user_id,
+ )
+ return True
diff --git a/posthog/temporal/ai/slack_app/activities/task_creation.py b/posthog/temporal/ai/slack_app/activities/task_creation.py
index cdb421323211..e49983e10559 100644
--- a/posthog/temporal/ai/slack_app/activities/task_creation.py
+++ b/posthog/temporal/ai/slack_app/activities/task_creation.py
@@ -470,12 +470,20 @@ def build_thread_context_update_block(
def derive_mention_workflow_id(inputs: PostHogCodeSlackMentionWorkflowInputs) -> str:
- """Construct the dispatch workflow id from webhook inputs."""
+ """Construct the dispatch workflow id from webhook inputs.
+
+ Doubles as the queue workflow's dedupe key, so a confirmed re-dispatch has to
+ read as its own unit of work: the same Slack event already came through once
+ to raise the prompt, and reusing that id would have the queue swallow the
+ confirmation as a redelivery.
+ """
event = inputs.event
if inputs.slack_event_id:
suffix = inputs.slack_event_id
else:
suffix = f"{event.get('channel', '')}:{event.get('ts', '')}"
+ if inputs.untagged_followup_confirmed:
+ suffix = f"{suffix}:confirmed"
return f"posthog-code-mention-{inputs.slack_team_id}:{suffix}"
diff --git a/posthog/temporal/ai/slack_app/posthog_code_slack_mention.py b/posthog/temporal/ai/slack_app/posthog_code_slack_mention.py
index 12efb7292d76..b9d59356e984 100644
--- a/posthog/temporal/ai/slack_app/posthog_code_slack_mention.py
+++ b/posthog/temporal/ai/slack_app/posthog_code_slack_mention.py
@@ -23,6 +23,7 @@ from posthog.temporal.ai.slack_app import (
post_posthog_code_internal_error_activity,
post_posthog_code_picker_timeout_activity,
post_posthog_code_repo_picker_activity,
+ request_untagged_followup_confirmation_activity,
resolve_posthog_code_slack_user_activity,
)
from posthog.temporal.common.base import PostHogWorkflow
@@ -34,6 +35,7 @@ POSTHOG_CODE_SLACK_PICKER_TIMEOUT_MINUTES = 15
_PATCH_ID_FILE_ONLY_FOLLOWUP_BYPASS = "slack-file-only-followup-bypass-v1"
_PATCH_ID_MODEL_CLASSIFIER = "slack-app-model-classifier-v1"
_PATCH_ID_NO_PERSONAL_GITHUB_GATE = "slack-no-personal-github-gate-v1"
+_PATCH_ID_UNTAGGED_FOLLOWUP_CONFIRMATION = "slack-untagged-followup-confirmation-v1"
@workflow.defn(name="posthog-code-slack-mention-processing")
@@ -101,8 +103,10 @@ class PostHogCodeSlackMentionWorkflow(PostHogWorkflow):
event_files = event.get("files")
event_has_files = isinstance(event_files, list) and len(event_files) > 0
file_only_followup = event_has_files and not (event.get("text") or "").strip()
- if inputs.untagged_followup and not (
- file_only_followup and workflow.patched(_PATCH_ID_FILE_ONLY_FOLLOWUP_BYPASS)
+ if (
+ inputs.untagged_followup
+ and not inputs.untagged_followup_confirmed
+ and not (file_only_followup and workflow.patched(_PATCH_ID_FILE_ONLY_FOLLOWUP_BYPASS))
):
should_forward = await _execute_posthog_code_activity(
classify_untagged_followup_activity,
@@ -115,6 +119,25 @@ class PostHogCodeSlackMentionWorkflow(PostHogWorkflow):
if not should_forward:
return
+ # The reply is agent-directed. If the thread creator asked to be consulted
+ # about other people's replies, this is the moment to ask: the prompt now
+ # only interrupts someone over a message that would otherwise start work.
+ # A confirmed run skips it — the answer is what re-dispatched this.
+ if (
+ inputs.untagged_followup
+ and not inputs.untagged_followup_confirmed
+ and workflow.patched(_PATCH_ID_UNTAGGED_FOLLOWUP_CONFIRMATION)
+ ):
+ awaiting_confirmation = await _execute_posthog_code_activity(
+ request_untagged_followup_confirmation_activity,
+ inputs,
+ channel,
+ thread_ts,
+ slack_user_id,
+ )
+ if awaiting_confirmation:
+ return
+
followup_handled = await _execute_posthog_code_activity(
forward_posthog_code_followup_activity,
inputs,
diff --git a/posthog/temporal/ai/slack_app/types.py b/posthog/temporal/ai/slack_app/types.py
index babeefd0e391..b68e2aa74b22 100644
--- a/posthog/temporal/ai/slack_app/types.py
+++ b/posthog/temporal/ai/slack_app/types.py
@@ -16,7 +16,7 @@ class PostHogSlackInboxOnboardingInputs:
integration_id: int
-@dataclass
+@dataclass(frozen=True)
class PostHogCodeSlackMentionWorkflowInputs:
event: dict[str, Any]
integration_id: int
@@ -35,6 +35,10 @@ class PostHogCodeSlackMentionWorkflowInputs:
# cleanup), we must NOT fall through to the new-task path — the user never
# tagged us, so kicking off a brand-new agent run would be wrong.
untagged_followup: bool = False
+ # True when the thread's author already confirmed this untagged reply from the
+ # ephemeral prompt. The classifier ran before the prompt was posted and the
+ # answer is in, so the run skips both on the way back through.
+ untagged_followup_confirmed: bool = False
# Slack sets this on the event envelope for Slack Connect channels. It is
# threaded through to task run state so customer-facing Slack replies remain
# approval-gated even when a user's internal-write tier is full-auto.
diff --git a/posthog/temporal/tests/ai/slack_app/activities/test_task_creation.py b/posthog/temporal/tests/ai/slack_app/activities/test_task_creation.py
index c79a415cfb12..a0b588e302ad 100644
--- a/posthog/temporal/tests/ai/slack_app/activities/test_task_creation.py
+++ b/posthog/temporal/tests/ai/slack_app/activities/test_task_creation.py
@@ -24,7 +24,9 @@ from posthog.temporal.ai.slack_app.activities.task_creation import (
_format_author_token,
_indent_body,
build_thread_context_update_block,
+ derive_mention_workflow_id,
)
+from posthog.temporal.ai.slack_app.types import PostHogCodeSlackMentionWorkflowInputs
def test_format_author_token_builds_labeled_mention():
@@ -460,3 +462,29 @@ class TestBuildThreadContextUpdateBlock:
]
block, _ = build_thread_context_update_block(msgs, last_forwarded_ts="1.000", event_ts="2.000")
assert block == snapshot
+
+
+class TestDeriveMentionWorkflowId:
+ """The id doubles as the queue workflow's dedupe key, so a confirmed
+ re-dispatch has to look different from the pass that raised the prompt —
+ otherwise clicking "Yes, take a look" is swallowed as a redelivery."""
+
+ def _inputs(self, **overrides) -> PostHogCodeSlackMentionWorkflowInputs:
+ fields = {
+ "event": {"channel": "C001", "ts": "1001.0000"},
+ "integration_id": 1,
+ "slack_team_id": "T_SLACK",
+ "slack_event_id": "Ev123",
+ **overrides,
+ }
+ return PostHogCodeSlackMentionWorkflowInputs(**fields)
+
+ def test_confirmed_redispatch_gets_its_own_id(self):
+ original = derive_mention_workflow_id(self._inputs(untagged_followup=True))
+ confirmed = derive_mention_workflow_id(self._inputs(untagged_followup=True, untagged_followup_confirmed=True))
+ assert original != confirmed
+ assert confirmed.startswith(original)
+
+ def test_id_is_stable_without_a_slack_event_id(self):
+ inputs = self._inputs(slack_event_id=None)
+ assert derive_mention_workflow_id(inputs) == "posthog-code-mention-T_SLACK:C001:1001.0000"
diff --git a/posthog/temporal/tests/ai/slack_app/test_slack_app_mention_workflow.py b/posthog/temporal/tests/ai/slack_app/test_slack_app_mention_workflow.py
index 3f4f2caccd63..af873c8e396e 100644
--- a/posthog/temporal/tests/ai/slack_app/test_slack_app_mention_workflow.py
+++ b/posthog/temporal/tests/ai/slack_app/test_slack_app_mention_workflow.py
@@ -74,6 +74,8 @@ class _Recorder:
self.create_reached: dict[str, asyncio.Event] = {}
self.picker_posted = asyncio.Event()
self.picker_workflow_id: str | None = None
+ # True holds untagged replies back on the thread creator's `ask` mode.
+ self.awaiting_confirmation = False
def _fake_activities(rec: _Recorder) -> list:
@@ -93,6 +95,15 @@ def _fake_activities(rec: _Recorder) -> list:
) -> bool:
return True
+ @activity.defn(name="request_untagged_followup_confirmation_activity")
+ async def request_confirmation(
+ inputs: PostHogCodeSlackMentionWorkflowInputs,
+ channel: str,
+ thread_ts: str,
+ slack_user_id: str,
+ ) -> bool:
+ return rec.awaiting_confirmation
+
@activity.defn(name="forward_posthog_code_followup_activity")
async def forward(
inputs: PostHogCodeSlackMentionWorkflowInputs,
@@ -220,6 +231,7 @@ def _fake_activities(rec: _Recorder) -> list:
mark_queued,
quota,
classify_followup,
+ request_confirmation,
forward,
collect,
cascade,
diff --git a/posthog/temporal/tests/ai/test_posthog_code_slack_mention_workflow.py b/posthog/temporal/tests/ai/test_posthog_code_slack_mention_workflow.py
index cefa4eec7afd..c71d5081b24b 100644
--- a/posthog/temporal/tests/ai/test_posthog_code_slack_mention_workflow.py
+++ b/posthog/temporal/tests/ai/test_posthog_code_slack_mention_workflow.py
@@ -42,6 +42,8 @@ async def test_untagged_followup_with_files_classifier_gating(
return False
if activity_fn is posthog_code_slack_mention.classify_untagged_followup_activity:
return True
+ if activity_fn is posthog_code_slack_mention.request_untagged_followup_confirmation_activity:
+ return False
if activity_fn is posthog_code_slack_mention.forward_posthog_code_followup_activity:
return True
@@ -56,5 +58,42 @@ async def test_untagged_followup_with_files_classifier_gating(
expected = ["enforce_posthog_code_billing_quota_activity"]
if expect_classifier:
expected.append("classify_untagged_followup_activity")
+ if patched:
+ expected.append("request_untagged_followup_confirmation_activity")
expected.append("forward_posthog_code_followup_activity")
assert calls == expected
+
+
+async def test_confirmed_untagged_followup_skips_the_classifier_and_the_prompt() -> None:
+ """The click that re-dispatches carries the answer, so asking again would
+ loop: prompt, confirm, classify, prompt."""
+ workflow = posthog_code_slack_mention.PostHogCodeSlackMentionWorkflow()
+ calls: list[str] = []
+ inputs = PostHogCodeSlackMentionWorkflowInputs(
+ event={"channel": "C123", "ts": "1234.5679", "user": "U_BOB", "text": "and the export filter too"},
+ integration_id=1,
+ slack_team_id="T_SLACK",
+ user_id=42,
+ untagged_followup=True,
+ untagged_followup_confirmed=True,
+ )
+
+ async def fake_execute_activity(activity_fn, *args):
+ calls.append(activity_fn.__name__)
+ if activity_fn is posthog_code_slack_mention.enforce_posthog_code_billing_quota_activity:
+ return False
+ if activity_fn is posthog_code_slack_mention.forward_posthog_code_followup_activity:
+ return True
+ raise AssertionError(f"unexpected activity: {activity_fn.__name__}")
+
+ with (
+ patch.object(posthog_code_slack_mention.workflow, "patched", return_value=True),
+ patch.object(posthog_code_slack_mention, "_execute_posthog_code_activity", side_effect=fake_execute_activity),
+ ):
+ await workflow.run(inputs)
+
+ assert calls == [
+ "enforce_posthog_code_billing_quota_activity",
+ "forward_posthog_code_followup_activity",
+ ]
diff --git a/posthog/temporal/tests/ai/test_request_untagged_followup_confirmation_activity.py b/posthog/temporal/tests/ai/test_request_untagged_followup_confirmation_activity.py
new file mode 100644
index 000000000000..6011c8e13884
--- /dev/null
+++ b/posthog/temporal/tests/ai/test_request_untagged_followup_confirmation_activity.py
@@ -0,0 +1,94 @@
+from unittest.mock import patch
+
+from django.apps import apps
+from django.test import TestCase
+
+from parameterized import parameterized
+
+from posthog.models.integration import Integration
+from posthog.models.organization import Organization
+from posthog.models.team.team import Team
+from posthog.models.user import User
+from posthog.temporal.ai.slack_app import (
+ PostHogCodeSlackMentionWorkflowInputs,
+ request_untagged_followup_confirmation_activity,
+)
+
+from products.slack_app.backend.models import SlackSettings, SlackThreadTaskMapping, UntaggedFollowupMode
+
+
+class TestRequestUntaggedFollowupConfirmationActivity(TestCase):
+ """The `ask` decision, made after the classifier has passed the reply.
+
+ Returning True holds the reply back — either waiting on the author's answer
+ or because the creator switched follow-ups off while the run was in flight.
+ The prompt covers every author, the thread creator included.
+ """
+
+ def setUp(self):
+ Task = apps.get_model("tasks", "Task")
+ TaskRun = apps.get_model("tasks", "TaskRun")
+ self.org = Organization.objects.create(name="TestOrg")
+ self.team = Team.objects.create(organization=self.org, name="TestTeam")
+ self.user = User.objects.create(email="[email protected]")
+ self.integration = Integration.objects.create(team=self.team, kind="slack", integration_id="T_SLACK", config={})
+ task = Task.objects.create(
+ team=self.team,
+ title="Fix the broken dashboard export",
+ description="desc",
+ origin_product=Task.OriginProduct.SLACK,
+ created_by=self.user,
+ repository="org/repo",
+ )
+ task_run = TaskRun.objects.create(task=task, team=self.team, status=TaskRun.Status.IN_PROGRESS)
+ SlackThreadTaskMapping.objects.create(
+ team=self.team,
+ integration=self.integration,
+ slack_workspace_id="T_SLACK",
+ channel="C001",
+ thread_ts="1000.0000",
+ task=task,
+ task_run=task_run,
+ mentioning_slack_user_id="U_ALICE",
+ )
+ self.inputs = PostHogCodeSlackMentionWorkflowInputs(
+ event={"channel": "C001", "user": "U_BOB", "ts": "1001.0000", "thread_ts": "1000.0000", "text": "and this"},
+ integration_id=self.integration.id,
+ slack_team_id="T_SLACK",
+ untagged_followup=True,
+ )
+
+ def _set_creator_mode(self, mode):
+ SlackSettings.objects.update_or_create(
+ slack_workspace_id="T_SLACK",
+ slack_user_id="U_ALICE",
+ defaults={"untagged_followup_mode": mode},
+ )
+
+ def _run(self, author: str) -> tuple[bool, bool]:
+ with patch("products.slack_app.backend.api._post_untagged_followup_prompt", return_value=True) as mock_prompt:
+ held = request_untagged_followup_confirmation_activity(self.inputs, "C001", "1000.0000", author)
+ return held, mock_prompt.called
+
+ @parameterized.expand(
+ [
+ ("ask_other_person", UntaggedFollowupMode.ASK, "U_BOB", True, True),
+ # Nobody tagged the app, the creator included — so they get asked too.
+ ("ask_creator", UntaggedFollowupMode.ASK, "U_ALICE", True, True),
+ ("auto", UntaggedFollowupMode.AUTO, "U_BOB", False, False),
+ # Switched off mid-run: hold the reply back, but there is nothing to ask.
+ ("never", UntaggedFollowupMode.NEVER, "U_BOB", True, False),
+ ]
+ )
+ def test_mode_decides_whether_the_reply_waits(self, _name, mode, author, expect_held, expect_prompt):
+ self._set_creator_mode(mode)
+ held, prompted = self._run(author)
+ assert held is expect_held
+ assert prompted is expect_prompt
+
+ def test_thread_that_lost_its_mapping_is_held_back(self):
+ # Nobody left to attribute a prompt to, and the forward would drop it anyway.
+ SlackThreadTaskMapping.objects.all().delete()
+ held, prompted = self._run("U_BOB")
+ assert held is True
+ assert prompted is False
diff --git a/products/slack_app/backend/api.py b/products/slack_app/backend/api.py
index dc3db76bf19f..1f62f0af3632 100644
--- a/products/slack_app/backend/api.py
+++ b/products/slack_app/backend/api.py
@@ -67,7 +67,7 @@ from products.slack_app.backend.feature_flags import (
is_slack_app_untagged_thread_followups_enabled,
)
from products.slack_app.backend.helpers import local_dev_slack_email
-from products.slack_app.backend.models import SlackChannel, SlackThreadTaskMapping
+from products.slack_app.backend.models import SlackChannel, SlackThreadTaskMapping, UntaggedFollowupMode
from products.slack_app.backend.services import inbox_interactivity
from products.slack_app.backend.services.integration_resolver import (
UserResolutionFailure,
@@ -87,6 +87,7 @@ from products.slack_app.backend.services.slack_app_home import (
handle_app_home_view_submission as _handle_app_home_view_submission,
)
from products.slack_app.backend.services.slack_messages import post_slack_thread_reply
+from products.slack_app.backend.services.slack_settings import resolve_untagged_followup_mode
from products.slack_app.backend.services.slack_user_info import (
clear_workspace_profile_cache,
get_cached_bot_user_id,
@@ -159,6 +160,11 @@ CHANNEL_APPROVAL_ACTION_APPROVE = "posthog_code_channel_approve"
CHANNEL_APPROVAL_ACTION_DENY = "posthog_code_channel_deny"
CHANNEL_APPROVAL_CONTEXT_KIND = "channel_approval"
+UNTAGGED_FOLLOWUP_BLOCK_ID_PREFIX = "posthog_code_untagged_followup"
+UNTAGGED_FOLLOWUP_ACTION_RUN = "posthog_code_untagged_followup_run"
+UNTAGGED_FOLLOWUP_ACTION_DISMISS = "posthog_code_untagged_followup_dismiss"
+UNTAGGED_FOLLOWUP_CONTEXT_KIND = "untagged_followup"
+
_MAX_GITHUB_REPOS = 500
REPO_LIST_CACHE_TTL_SECONDS = 300
PENDING_REPO_PICKER_TTL_SECONDS = PICKER_TOKEN_MAX_AGE_SECONDS
@@ -1247,6 +1253,42 @@ def _resolve_untagged_followup_mapping(
return mapping
+def _untagged_followups_switched_off(
+ event: dict[str, Any],
+ integration: Integration,
+ slack_team_id: str,
+ *,
+ mapping: SlackThreadTaskMapping,
+ posthog_user: User,
+) -> bool:
+ """Whether the thread creator has untagged follow-ups turned off.
+
+ Only ``never`` is decided here. ``ask`` waits until the classifier has judged
+ the reply worth forwarding, inside the workflow — prompting from the webhook
+ would raise one for every "thanks" in the thread. ``never`` costs nobody an
+ LLM call, so it drops before dispatch.
+ """
+ if resolve_untagged_followup_mode(integration, mapping.mentioning_slack_user_id) != UntaggedFollowupMode.NEVER:
+ return False
+
+ logger.info(
+ "slack_app_thread_message_mode_never",
+ slack_team_id=slack_team_id,
+ channel=event.get("channel"),
+ thread_ts=mapping.thread_ts,
+ integration_id=integration.id,
+ )
+ _report_slack_mention_dropped(
+ event,
+ slack_team_id,
+ reason="untagged_followup_mode_never",
+ replied=False,
+ integration=integration,
+ posthog_user=posthog_user,
+ )
+ return True
+
+
def _notify_missing_slack_scopes(
slack: SlackIntegration,
event: dict,
@@ -2175,6 +2217,18 @@ def route_posthog_code_event_to_relevant_region(
)
return ROUTE_HANDLED_LOCALLY
+ # Last gate on the untagged path: a thread whose creator has follow-ups off
+ # never reaches the workflow. ``ask`` is decided there instead, once the
+ # classifier has judged the reply worth forwarding.
+ if untagged_followup_mapping is not None and _untagged_followups_switched_off(
+ event,
+ mention_target,
+ slack_team_id,
+ mapping=untagged_followup_mapping,
+ posthog_user=posthog_user,
+ ):
+ return ROUTE_HANDLED_LOCALLY
+
return _start_mention_workflow(
event,
mention_target,
@@ -2754,6 +2808,247 @@ def _post_channel_approval_prompt(
return True
+def _post_untagged_followup_prompt(
+ slack: SlackIntegration,
+ integration: Integration,
+ event: dict[str, Any],
+ *,
+ is_ext_shared_channel: bool,
+) -> bool:
+ """Ask the replier whether their message should go to PostHog.
+
+ Posted when the thread creator's mode is ``ask``. The whole event is stashed
+ behind a one-off token so a click can dispatch the original message rather
+ than a reconstruction of it. Unlike the channel-approval prompt this one is
+ threaded: the person just typed inside the thread, so that is the surface
+ they are looking at.
+ """
+ channel = event.get("channel") if isinstance(event.get("channel"), str) else None
+ slack_user_id = event.get("user") if isinstance(event.get("user"), str) else None
+ thread_ts = event.get("thread_ts") if isinstance(event.get("thread_ts"), str) else None
+ if not channel or not slack_user_id or not thread_ts:
+ logger.warning(
+ "slack_app_untagged_followup_prompt_skipped",
+ reason="incomplete_event",
+ integration_id=integration.id,
+ has_channel=bool(channel),
+ has_user=bool(slack_user_id),
+ has_thread_ts=bool(thread_ts),
+ )
+ return False
+
+ context_token = uuid.uuid4().hex
+ cache.set(
+ _picker_context_cache_key(context_token),
+ {
+ "kind": UNTAGGED_FOLLOWUP_CONTEXT_KIND,
+ "integration_id": integration.id,
+ "slack_workspace_id": integration.integration_id,
+ "slack_channel_id": channel,
+ "thread_ts": thread_ts,
+ "slack_user_id": slack_user_id,
+ "event": event,
+ "is_ext_shared_channel": is_ext_shared_channel,
+ "created_at": int(time.time()),
+ },
+ timeout=PICKER_TOKEN_MAX_AGE_SECONDS,
+ )
+
+ blocks: list[dict[str, Any]] = [
+ {
+ "type": "section",
+ "block_id": f"{UNTAGGED_FOLLOWUP_BLOCK_ID_PREFIX}:{context_token}",
+ "text": {
+ "type": "mrkdwn",
+ "text": (
+ "I'm working in this thread. Want me to pick up your message? "
+ "Only you can see this — nothing happens unless you say so."
+ ),
+ },
+ },
+ {
+ "type": "actions",
+ "block_id": f"{UNTAGGED_FOLLOWUP_BLOCK_ID_PREFIX}_actions:{context_token}",
+ "elements": [
+ {
+ "type": "button",
+ "action_id": UNTAGGED_FOLLOWUP_ACTION_RUN,
+ "style": "primary",
+ "text": {"type": "plain_text", "text": "Yes, take a look"},
+ "value": context_token,
+ },
+ {
+ "type": "button",
+ "action_id": UNTAGGED_FOLLOWUP_ACTION_DISMISS,
+ "text": {"type": "plain_text", "text": "No thanks"},
+ "value": context_token,
+ },
+ ],
+ },
+ ]
+
+ try:
+ slack.client.chat_postEphemeral(
+ channel=channel,
+ user=slack_user_id,
+ thread_ts=thread_ts,
+ text="Want PostHog to pick up your message in this thread?",
+ blocks=blocks,
+ )
+ except Exception:
+ logger.warning(
+ "slack_app_untagged_followup_prompt_failed",
+ integration_id=integration.id,
+ slack_workspace_id=integration.integration_id,
+ slack_channel_id=channel,
+ exc_info=True,
+ )
+ return False
+ logger.info(
+ "slack_app_untagged_followup_prompt_posted",
+ integration_id=integration.id,
+ slack_workspace_id=integration.integration_id,
+ slack_channel_id=channel,
+ slack_user_id=slack_user_id,
+ )
+ return True
+
+
+def _can_access_team(posthog_user: User, integration: Integration) -> bool:
+ """Whether the user can reach the integration's project.
+
+ Org membership alone is what ``_is_org_member`` answers, and it is not enough
+ here: the routing path drops a reply whose author can't reach the mapped
+ project, so a click must clear the same bar or it becomes a way around it.
+ """
+ try:
+ return UserPermissions(user=posthog_user).team(integration.team).effective_membership_level is not None
+ except Exception:
+ logger.exception(
+ "slack_app_untagged_followup_access_check_failed",
+ integration_id=integration.id,
+ user_id=posthog_user.id,
+ )
+ return False
+
+
+def _untagged_followups_revoked_since_prompt(integration: Integration, context: dict[str, Any]) -> bool:
+ """Whether the thread creator switched follow-ups off while the prompt sat unanswered.
+
+ The confirmed run skips the mode activity — its answer is what re-dispatched
+ the message — so this is the only place left that can honour a mode changed
+ inside the prompt's lifetime.
+ """
+ mapping = (
+ SlackThreadTaskMapping.objects.filter(
+ integration_id=integration.id,
+ channel=context.get("slack_channel_id"),
+ thread_ts=context.get("thread_ts"),
+ )
+ .only("mentioning_slack_user_id")
+ .first()
+ )
+ if mapping is None:
+ return True
+ if resolve_untagged_followup_mode(integration, mapping.mentioning_slack_user_id) != UntaggedFollowupMode.NEVER:
+ return False
+ logger.info(
+ "slack_app_untagged_followup_confirm_after_revoke",
+ integration_id=integration.id,
+ slack_channel_id=context.get("slack_channel_id"),
+ thread_ts=context.get("thread_ts"),
+ )
+ return True
+
+
+def _handle_untagged_followup_run(payload: dict) -> HttpResponse:
+ """Dispatch the message the replier just confirmed, then clear the prompt."""
+ response_url = payload.get("response_url", "")
+ context_token = _extract_context_token(payload)
+ context = _decode_picker_context(context_token) if context_token else None
+ if not context or context.get("kind") != UNTAGGED_FOLLOWUP_CONTEXT_KIND:
+ _delete_ephemeral_via_response_url(response_url)
+ return HttpResponse(status=200)
+
+ slack_team_id = payload.get("team", {}).get("id", "")
+ clicker_slack_user_id = payload.get("user", {}).get("id", "")
+ event = context.get("event")
+ integration_id = context.get("integration_id")
+ if not isinstance(event, dict) or not integration_id or not slack_team_id:
+ _delete_ephemeral_via_response_url(response_url)
+ return HttpResponse(status=200)
+
+ # The prompt is ephemeral, so only its recipient can click it — but the
+ # dispatch below runs as that recipient, so tie the two together explicitly.
+ if clicker_slack_user_id != context.get("slack_user_id"):
+ _delete_ephemeral_via_response_url(response_url)
+ return HttpResponse(status=200)
+
+ integration = (
+ Integration.objects.filter( # nosemgrep: idor-lookup-without-team
+ id=integration_id, # nosemgrep: idor-taint-user-input-to-model-get
+ kind=SLACK_INTEGRATION_KIND,
+ integration_id=slack_team_id,
+ )
+ .select_related("team__organization")
+ .first()
+ )
+ # A flag turned off between prompt and click means the whole untagged path is
+ # dark again; an unresolvable clicker means we have nobody to run as.
+ if integration is None or not is_slack_app_untagged_thread_followups_enabled(integration, slack_team_id):
+ _delete_ephemeral_via_response_url(response_url)
+ return HttpResponse(status=200)
+
+ # A confirmed run re-enters the pipeline past the gates the webhook applied to the
+ # original reply, so the two it can't inherit are re-checked here: the clicker's
+ # access to the mapped project, and the creator's mode as it stands now.
+ posthog_user = _is_org_member(integration, clicker_slack_user_id)
+ if posthog_user is None or not _can_access_team(posthog_user, integration):
+ logger.info(
+ "slack_app_untagged_followup_confirm_no_access",
+ integration_id=integration.id,
+ slack_workspace_id=slack_team_id,
+ slack_user_id=clicker_slack_user_id,
+ )
+ _delete_ephemeral_via_response_url(response_url)
+ return HttpResponse(status=200)
+
+ if _untagged_followups_revoked_since_prompt(integration, context):
+ _delete_ephemeral_via_response_url(response_url)
+ return HttpResponse(status=200)
+
+ cache.delete(_picker_context_cache_key(context_token))
+ _start_mention_workflow(
+ event,
+ integration,
+ slack_team_id,
+ None,
+ posthog_user=posthog_user,
+ untagged_followup=True,
+ untagged_followup_confirmed=True,
+ is_ext_shared_channel=bool(context.get("is_ext_shared_channel")),
+ )
+ logger.info(
+ "slack_app_untagged_followup_confirmed",
+ integration_id=integration.id,
+ slack_workspace_id=slack_team_id,
+ slack_channel_id=context.get("slack_channel_id"),
+ slack_user_id=clicker_slack_user_id,
+ )
+ _delete_ephemeral_via_response_url(response_url)
+ return HttpResponse(status=200)
+
+
+def _handle_untagged_followup_dismiss(payload: dict) -> HttpResponse:
+ """Drop the message the replier declined. Nothing is persisted — the choice
+ covers this one message, not the thread."""
+ context_token = _extract_context_token(payload)
+ if context_token:
+ cache.delete(_picker_context_cache_key(context_token))
+ _delete_ephemeral_via_response_url(payload.get("response_url", ""))
+ return HttpResponse(status=200)
+
+
def _report_slack_mention_received(
event: dict,
integration: Integration,
@@ -2900,6 +3195,7 @@ def _start_mention_workflow(
*,
posthog_user: User | None,
untagged_followup: bool = False,
+ untagged_followup_confirmed: bool = False,
is_ext_shared_channel: bool = False,
) -> str:
"""Start the mention workflow for either an explicit ``app_mention`` or an
@@ -2929,6 +3225,7 @@ def _start_mention_workflow(
slack_event_id=event_id,
user_id=posthog_user.id if posthog_user else None,
untagged_followup=untagged_followup,
+ untagged_followup_confirmed=untagged_followup_confirmed,
is_ext_shared_channel=is_ext_shared_channel,
)
# Events without channel/ts fall back to the per-message workflow.
@@ -4388,6 +4685,10 @@ def posthog_code_interactivity_handler(request: HttpRequest) -> HttpResponse:
return _handle_channel_approval_submit(payload)
if action_id == CHANNEL_APPROVAL_ACTION_DENY:
return _handle_channel_approval_deny(payload)
+ if action_id == UNTAGGED_FOLLOWUP_ACTION_RUN:
+ return _handle_untagged_followup_run(payload)
+ if action_id == UNTAGGED_FOLLOWUP_ACTION_DISMISS:
+ return _handle_untagged_followup_dismiss(payload)
if action_id == SIGNALS_DISMISS_REPORT_ACTION_ID:
return _handle_signals_dismiss_report(payload)
if action_id in (INSIGHT_ALERT_SNOOZE_ACTION_ID, INSIGHT_ALERT_SNOOZE_UNTIL_ACTION_ID):
diff --git a/products/slack_app/backend/migrations/0013_slacksettings_untagged_followup_mode.py b/products/slack_app/backend/migrations/0013_slacksettings_untagged_followup_mode.py
new file mode 100644
index 000000000000..4d7b3d1e420d
--- /dev/null
+++ b/products/slack_app/backend/migrations/0013_slacksettings_untagged_followup_mode.py
@@ -0,0 +1,27 @@
+# Generated by Django 5.2.17 on 2026-08-17 07:56
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+ dependencies = [
+ ("slack_app", "0012_slackthreadtaskmapping_workspace_created_idx"),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name="slacksettings",
+ name="untagged_followup_mode",
+ field=models.CharField(
+ blank=True,
+ choices=[
+ ("auto", "Always pick it up"),
+ ("ask", "Ask before picking it up"),
+ ("never", "Never pick it up"),
+ ],
+ help_text="What PostHog does with untagged replies in threads this user started.",
+ max_length=16,
+ null=True,
+ ),
+ ),
+ ]
diff --git a/products/slack_app/backend/migrations/max_migration.txt b/products/slack_app/backend/migrations/max_migration.txt
index 93c987dfd4df..878a0a1050ff 100644
--- a/products/slack_app/backend/migrations/max_migration.txt
+++ b/products/slack_app/backend/migrations/max_migration.txt
@@ -1 +1 @@
-0012_slackthreadtaskmapping_workspace_created_idx
+0013_slacksettings_untagged_followup_mode
diff --git a/products/slack_app/backend/models.py b/products/slack_app/backend/models.py
index b490d9674ddc..3632af9cd5f5 100644
--- a/products/slack_app/backend/models.py
+++ b/products/slack_app/backend/models.py
@@ -87,6 +87,19 @@ class SlackUserProfileCache(UUIDModel):
]
+class UntaggedFollowupMode(models.TextChoices):
+ """What PostHog does with an untagged reply in a thread it already owns.
+
+ Read from the thread creator's settings row, so it governs everyone
+ replying in a thread that user started. ``NEVER`` is what an unset row
+ resolves to, making untagged follow-ups opt-in per person.
+ """
+
+ AUTO = "auto", "Always pick it up"
+ ASK = "ask", "Ask before picking it up"
+ NEVER = "never", "Never pick it up"
+
+
class SlackSettings(UUIDModel):
"""Per-(Slack workspace, Slack user) settings for inbound Slack events.
Currently stores the routing default — which PostHog integration a mention
@@ -126,6 +139,15 @@ class SlackSettings(UUIDModel):
)
# Keys mirror the task-run request serializer.
ai_preferences = models.JSONField(blank=True, null=True)
+ # NULL means the user has never picked, which resolves to ``NEVER``: nothing
+ # is picked up in their threads until they turn it on from the Home tab.
+ untagged_followup_mode = models.CharField(
+ max_length=16,
+ null=True,
+ blank=True,
+ choices=UntaggedFollowupMode.choices,
+ help_text="What PostHog does with untagged replies in threads this user started.",
+ )
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
diff --git a/products/slack_app/backend/services/slack_app_home.py b/products/slack_app/backend/services/slack_app_home.py
index 9253dd9505b2..e874df5a9830 100644
--- a/products/slack_app/backend/services/slack_app_home.py
+++ b/products/slack_app/backend/services/slack_app_home.py
@@ -32,8 +32,12 @@ from posthog.models.user import User
from posthog.models.user_integration import UserIntegration
from posthog.user_permissions import UserPermissions
-from products.slack_app.backend.feature_flags import is_slack_app_home_enabled, is_slack_app_oauth_enabled
-from products.slack_app.backend.models import SlackSettings, SlackUserProfileCache
+from products.slack_app.backend.feature_flags import (
+ is_slack_app_home_enabled,
+ is_slack_app_oauth_enabled,
+ is_slack_app_untagged_thread_followups_enabled,
+)
+from products.slack_app.backend.models import SlackSettings, SlackUserProfileCache, UntaggedFollowupMode
from products.slack_app.backend.services.integration_resolver import load_integrations
from products.slack_app.backend.services.model_catalogue import (
REASONING_EFFORT_DISPLAY_NAMES,
@@ -62,6 +66,7 @@ from products.slack_app.backend.services.slack_settings import (
AIPreferences,
build_ai_preferences_payload,
resolve_ai_preferences,
+ resolve_untagged_followup_mode,
validate_ai_preferences,
)
from products.slack_app.backend.services.slack_user_info import is_slack_workspace_admin
@@ -88,6 +93,7 @@ ACTION_TASKS_PAGE_PREV = "slack_app_home:tasks_page_prev"
ACTION_TASKS_PAGE_NEXT = "slack_app_home:tasks_page_next"
ACTION_STATS_WINDOW = "slack_app_home:stats_window"
ACTION_STATS_REFRESH = "slack_app_home:stats_refresh"
+ACTION_SET_UNTAGGED_FOLLOWUP_MODE = "slack_app_home:set_untagged_followup_mode"
# Every control the Home tab renders, in one place. The interactivity endpoint reads
# this to claim region ownership and to dispatch, so a control that isn't listed here
@@ -108,6 +114,7 @@ HOME_ACTION_IDS: frozenset[str] = frozenset(
ACTION_TASKS_PAGE_NEXT,
ACTION_STATS_WINDOW,
ACTION_STATS_REFRESH,
+ ACTION_SET_UNTAGGED_FOLLOWUP_MODE,
}
)
@@ -400,6 +407,7 @@ def render_home_view(
project_state: ProjectState | None = None,
tasks_state: TasksState | None = None,
stats_state: StatsState | None = None,
+ untagged_followup_mode: UntaggedFollowupMode | None = None,
has_project_access: bool = True,
) -> dict:
"""Render the Block Kit payload for `views.publish` on the App Home tab."""
@@ -438,14 +446,21 @@ def render_home_view(
blocks.extend(_active_model_blocks(effective, source))
blocks.extend(_personal_section_blocks(user_row))
- # Section 4 — linked accounts: PostHog and GitHub side by side, shown
+ # Section 4 — thread follow-ups: whether replies other people leave in the
+ # threads you started reach PostHog on their own. Absent when the workspace
+ # hasn't been opted into untagged follow-ups at all.
+ if untagged_followup_mode is not None:
+ blocks.append({"type": "divider"})
+ blocks.extend(_untagged_followups_section_blocks(untagged_followup_mode))
+
+ # Section 5 — linked accounts: PostHog and GitHub side by side, shown
# before Tasks so the connect prompts are visible while the Tasks list
# is still empty. The PostHog half is flag-gated.
if (account_state and account_state.enabled) or github_state is not None:
blocks.append({"type": "divider"})
blocks.extend(_linked_accounts_section_blocks(account_state, github_state))
- # Section 5 — your tasks: a quiet list of tasks the calling user
+ # Section 6 — your tasks: a quiet list of tasks the calling user
# started via @PostHog mentions, so they can see status without
# the bot pinging the activity feed for every transition.
if tasks_state is not None:
@@ -820,6 +835,43 @@ def _personal_section_blocks(user_row: SlackSettings | None) -> list[dict]:
]
+UNTAGGED_FOLLOWUP_MODE_LABELS: dict[str, str] = {
+ UntaggedFollowupMode.AUTO: "Pick them up automatically",
+ UntaggedFollowupMode.ASK: "Ask them first",
+ UntaggedFollowupMode.NEVER: "Leave them alone",
+}
+
+
+def _untagged_followups_section_blocks(mode: UntaggedFollowupMode) -> list[dict]:
+ """Picker for how untagged replies land in the threads you started.
+
+ Off until picked, so the card doubles as the only way to turn the behaviour
+ on for your own threads. The choice covers every reply in those threads,
+ including the ones you write yourself.
+ """
+ options = [
+ {"text": {"type": "plain_text", "text": label, "emoji": True}, "value": value}
+ for value, label in UNTAGGED_FOLLOWUP_MODE_LABELS.items()
+ ]
+ select: dict[str, Any] = {
+ "type": "static_select",
+ "action_id": ACTION_SET_UNTAGGED_FOLLOWUP_MODE,
+ "options": options,
+ "initial_option": next(o for o in options if o["value"] == mode.value),
+ }
+ return [
+ _section_title(
+ "💬 Thread follow-ups",
+ "What I do with replies in a thread you started, when nobody tags @PostHog.",
+ ),
+ {"type": "actions", "elements": [select]},
+ {
+ "type": "context",
+ "elements": [{"type": "mrkdwn", "text": "Applies to every reply in those threads, yours included."}],
+ },
+ ]
+
+
def _footer_blocks() -> list[dict]:
return []
@@ -1459,6 +1511,7 @@ def handle_app_home_opened(event: dict, slack_team_id: str, *, integration: Inte
project_state=project_state,
tasks_state=tasks_state,
stats_state=stats_state,
+ untagged_followup_mode=_resolve_untagged_followup_mode_for_card(integration, slack_user_id),
has_project_access=bool(accessible),
)
try:
@@ -1531,6 +1584,14 @@ def handle_ai_preferences_block_action(payload: dict, action: dict) -> HttpRespo
republish()
return HttpResponse(status=200)
+ if action_id == ACTION_SET_UNTAGGED_FOLLOWUP_MODE:
+ # Same gate the card is rendered behind, so a stale view can't write a
+ # setting for a workspace that has since been switched off.
+ if is_slack_app_untagged_thread_followups_enabled(integration, integration.integration_id):
+ _apply_untagged_followup_mode_pick(integration, slack_user_id, action)
+ republish()
+ return HttpResponse(status=200)
+
if action_id == ACTION_UNLINK_ACCOUNT:
# Only act when the OAuth-link feature is on for this workspace —
# otherwise the button shouldn't have been rendered, and a stale
@@ -1772,6 +1833,32 @@ def _write_row(
)
+def _resolve_untagged_followup_mode_for_card(
+ integration: Integration, slack_user_id: str
+) -> UntaggedFollowupMode | None:
+ """The picker's current value, or ``None`` to leave the card out entirely.
+
+ The setting only means anything where untagged follow-ups run at all, so the
+ card lives behind the same flag as the behaviour it configures.
+ """
+ if not is_slack_app_untagged_thread_followups_enabled(integration, integration.integration_id):
+ return None
+ return resolve_untagged_followup_mode(integration, slack_user_id)
+
+
+def _apply_untagged_followup_mode_pick(integration: Integration, slack_user_id: str, action: dict) -> None:
+ """Persist the picked mode. An unrecognised value is ignored rather than stored."""
+
+ picked = (action.get("selected_option") or {}).get("value")
+ if picked not in UntaggedFollowupMode.values:
+ return
+ SlackSettings.objects.update_or_create(
+ slack_workspace_id=integration.integration_id,
+ slack_user_id=slack_user_id,
+ defaults={"untagged_followup_mode": picked},
+ )
+
+
def _clear_personal_override(integration: Integration, slack_user_id: str) -> None:
"""Clear just the AI fields on the user's row. Leaves routing alone."""
@@ -1782,7 +1869,7 @@ def _clear_personal_override(integration: Integration, slack_user_id: str) -> No
def _clear_project_personal(integration: Integration, slack_user_id: str) -> None:
- """Clear the personal routing override; drop the row if no AI overrides remain."""
+ """Clear the personal routing override; drop the row once it holds nothing else."""
row = SlackSettings.objects.filter(
slack_workspace_id=integration.integration_id,
@@ -1790,7 +1877,7 @@ def _clear_project_personal(integration: Integration, slack_user_id: str) -> Non
).first()
if row is None:
return
- if not row.ai_preferences:
+ if not row.ai_preferences and not row.untagged_followup_mode:
row.delete()
return
row.default_integration = None
@@ -1836,6 +1923,7 @@ def _republish_home(
project_state=project_state,
tasks_state=tasks_state,
stats_state=stats_state,
+ untagged_followup_mode=_resolve_untagged_followup_mode_for_card(integration, slack_user_id),
has_project_access=bool(accessible),
)
try:
diff --git a/products/slack_app/backend/services/slack_settings.py b/products/slack_app/backend/services/slack_settings.py
index d0f3981d5863..0c23b2768759 100644
--- a/products/slack_app/backend/services/slack_settings.py
+++ b/products/slack_app/backend/services/slack_settings.py
@@ -1,6 +1,6 @@
"""Read/write helpers for per-(Slack workspace, Slack user) settings backed
-by `models.SlackSettings`. Currently exposes AI-preference resolution; future
-per-user / per-workspace knobs belong here too.
+by `models.SlackSettings`. Exposes AI-preference resolution and the untagged
+follow-up mode; future per-user / per-workspace knobs belong here too.
Key names mirror the task-run request serializer
(`products/tasks/backend/presentation/serializers.py`) so the resolver output
@@ -25,6 +25,7 @@ from dataclasses import dataclass
from typing import TYPE_CHECKING, Any
from products.slack_app.backend.feature_flags import is_slack_app_home_enabled
+from products.slack_app.backend.models import UntaggedFollowupMode
from products.slack_app.backend.services.model_catalogue import filter_unsupported_effort
if TYPE_CHECKING:
@@ -95,6 +96,34 @@ def resolve_ai_preferences(integration: Integration, slack_user_id: str | None)
)
+def resolve_untagged_followup_mode(integration: Integration, slack_user_id: str | None) -> UntaggedFollowupMode:
+ """Resolve how untagged replies in a thread this Slack user started are treated.
+
+ Read from the thread creator's row, so one person's choice governs every
+ reply in the threads they started. An absent row, an empty column, or a
+ value we no longer recognise all resolve to `NEVER`: the feature is opt-in,
+ so nothing is picked up until someone asks for it.
+ """
+
+ if not slack_user_id:
+ return UntaggedFollowupMode.NEVER
+
+ from products.slack_app.backend.models import SlackSettings
+
+ row = (
+ SlackSettings.objects.filter(
+ slack_workspace_id=integration.integration_id,
+ slack_user_id=slack_user_id,
+ )
+ .values("untagged_followup_mode")
+ .first()
+ )
+ stored = row["untagged_followup_mode"] if row else None
+ if stored in UntaggedFollowupMode.values:
+ return UntaggedFollowupMode(stored)
+ return UntaggedFollowupMode.NEVER
+
+
def build_ai_preferences_payload(
runtime_adapter: str | None,
model: str | None,
@@ -150,5 +179,6 @@ __all__ = [
"AIPreferences",
"build_ai_preferences_payload",
"resolve_ai_preferences",
+ "resolve_untagged_followup_mode",
"validate_ai_preferences",
]
diff --git a/products/slack_app/backend/tests/services/test_slack_app_home.py b/products/slack_app/backend/tests/services/test_slack_app_home.py
index cf427fafc8c7..767aa619bee7 100644
--- a/products/slack_app/backend/tests/services/test_slack_app_home.py
+++ b/products/slack_app/backend/tests/services/test_slack_app_home.py
@@ -27,12 +27,18 @@ from posthog.models.team.team import Team
from posthog.models.user import User
from posthog.models.user_integration import UserIntegration
-from products.slack_app.backend.models import SlackSettings, SlackThreadTaskMapping, SlackUserProfileCache
+from products.slack_app.backend.models import (
+ SlackSettings,
+ SlackThreadTaskMapping,
+ SlackUserProfileCache,
+ UntaggedFollowupMode,
+)
from products.slack_app.backend.services import slack_app_home
from products.slack_app.backend.services.slack_app_home import (
ACTION_EDIT_PERSONAL,
ACTION_RESET_PERSONAL,
ACTION_RESET_PROJECT_PERSONAL,
+ ACTION_SET_UNTAGGED_FOLLOWUP_MODE,
ACTION_TASKS_FILTER_REPO,
ACTION_TASKS_PAGE_NEXT,
ACTION_TASKS_PAGE_PREV,
@@ -468,6 +474,7 @@ class TestRenderHomeView:
total_filtered=25,
),
stats_state=StatsState(tasks_started=4, tasks_with_pr=2, tasks_merged=1, active_people=2),
+ untagged_followup_mode=UntaggedFollowupMode.AUTO,
)
# Equality both ways: an unroutable control fails on the left, and a card that
@@ -484,6 +491,69 @@ class TestRenderHomeView:
)
+class TestThreadFollowupsCard:
+ def _view(self, mode) -> dict:
+ return render_home_view(
+ effective=AIPreferences(),
+ user_row=None,
+ is_admin=False,
+ untagged_followup_mode=mode,
+ )
+
+ def test_card_absent_where_untagged_followups_do_not_run(self):
+ # Nothing to configure when replies are never picked up in the first place.
+ view = self._view(None)
+ assert ACTION_SET_UNTAGGED_FOLLOWUP_MODE not in _action_ids(view)
+
+ @pytest.mark.parametrize("mode", list(UntaggedFollowupMode))
+ def test_picker_preselects_the_stored_mode(self, mode):
+ # Without the right initial option the tab misreports the setting, and picking
+ # the value already stored is a no-op click that looks broken.
+ view = self._view(mode)
+ select = next(
+ el
+ for block in view["blocks"]
+ for el in block.get("elements", []) or []
+ if el.get("action_id") == ACTION_SET_UNTAGGED_FOLLOWUP_MODE
+ )
+ assert select["initial_option"]["value"] == mode.value
+ assert {o["value"] for o in select["options"]} == set(UntaggedFollowupMode.values)
+
+
+class TestThreadFollowupsPicker:
+ def _pick(self, value: str) -> dict:
+ return {
+ "type": "block_actions",
+ "team": {"id": SLACK_WORKSPACE_ID},
+ "user": {"id": "U001"},
+ "actions": [
+ {"action_id": ACTION_SET_UNTAGGED_FOLLOWUP_MODE, "selected_option": {"value": value}},
+ ],
+ }
+
+ @pytest.mark.parametrize(
+ "picked,expected",
+ [
+ (UntaggedFollowupMode.ASK.value, UntaggedFollowupMode.ASK.value),
+ (UntaggedFollowupMode.NEVER.value, UntaggedFollowupMode.NEVER.value),
+ (UntaggedFollowupMode.AUTO.value, UntaggedFollowupMode.AUTO.value),
+ # A value the tab never rendered isn't worth persisting — it would read
+ # back as `auto` anyway, but only after a round trip through the DB.
+ ("something-else", None),
+ ],
+ )
+ def test_pick_is_persisted_against_the_clicking_user(
+ self, slack_integration, mock_slack_client, flag_on, picked, expected
+ ):
+ payload = self._pick(picked)
+ with patch("products.slack_app.backend.services.slack_app_home.is_slack_workspace_admin", return_value=False):
+ handle_ai_preferences_block_action(payload, payload["actions"][0])
+
+ row = SlackSettings.objects.filter(slack_workspace_id=SLACK_WORKSPACE_ID, slack_user_id="U001").first()
+ assert (row.untagged_followup_mode if row else None) == expected
+ assert mock_slack_client.views_publish.called
+
+
class TestLinkedAccountsCard:
def _view(self, *, account_state=None, github_state=None) -> dict:
return render_home_view(
diff --git a/products/slack_app/backend/tests/services/test_slack_settings.py b/products/slack_app/backend/tests/services/test_slack_settings.py
index b80cc772f550..e9970915b97e 100644
--- a/products/slack_app/backend/tests/services/test_slack_settings.py
+++ b/products/slack_app/backend/tests/services/test_slack_settings.py
@@ -10,10 +10,11 @@ from posthog.models.organization import Organization
from posthog.models.team.team import Team
from products.slack_app.backend.feature_flags import SLACK_APP_HOME_FLAG
-from products.slack_app.backend.models import SlackSettings
+from products.slack_app.backend.models import SlackSettings, UntaggedFollowupMode
from products.slack_app.backend.services.slack_settings import (
AIPreferences,
resolve_ai_preferences,
+ resolve_untagged_followup_mode,
validate_ai_preferences,
)
@@ -283,6 +284,43 @@ class TestResolveAIPreferences:
assert resolve_ai_preferences(integration, "U001") == AIPreferences()
+class TestResolveUntaggedFollowupMode:
+ @pytest.mark.parametrize(
+ "stored,expected",
+ [
+ (UntaggedFollowupMode.ASK, UntaggedFollowupMode.ASK),
+ (UntaggedFollowupMode.NEVER, UntaggedFollowupMode.NEVER),
+ (UntaggedFollowupMode.AUTO, UntaggedFollowupMode.AUTO),
+ # A row that predates the column, and a value retired since it was written,
+ # both leave the feature off rather than opting someone in by accident.
+ (None, UntaggedFollowupMode.NEVER),
+ ("retired-value", UntaggedFollowupMode.NEVER),
+ ],
+ )
+ def test_stored_value_governs_with_never_as_the_floor(self, slack_setup, stored, expected):
+ integration = slack_setup
+ SlackSettings.objects.create(
+ slack_workspace_id="T_WS",
+ slack_user_id="U001",
+ untagged_followup_mode=stored,
+ )
+ assert resolve_untagged_followup_mode(integration, "U001") == expected
+
+ def test_no_row_at_all_resolves_never(self, slack_setup):
+ assert resolve_untagged_followup_mode(slack_setup, "U001") == UntaggedFollowupMode.NEVER
+
+ def test_another_users_choice_does_not_leak(self, slack_setup):
+ # The mode is read per thread creator, so one person opting in must not
+ # turn follow-ups on in everybody else's threads.
+ integration = slack_setup
+ SlackSettings.objects.create(
+ slack_workspace_id="T_WS",
+ slack_user_id="U002",
+ untagged_followup_mode=UntaggedFollowupMode.AUTO,
+ )
+ assert resolve_untagged_followup_mode(integration, "U001") == UntaggedFollowupMode.NEVER
+
+
class TestValidateAIPreferences:
def test_all_none_is_valid(self):
validate_ai_preferences(None, None, None)
diff --git a/products/slack_app/backend/tests/test_thread_message_routing.py b/products/slack_app/backend/tests/test_thread_message_routing.py
index 457b4fa094a3..189c0bd9ba33 100644
--- a/products/slack_app/backend/tests/test_thread_message_routing.py
+++ b/products/slack_app/backend/tests/test_thread_message_routing.py
@@ -6,12 +6,19 @@ from django.test import TestCase, override_settings
from django.test.client import RequestFactory
from django.utils import timezone
+from parameterized import parameterized
+
from posthog.models.integration import Integration
from posthog.models.organization import Organization, OrganizationMembership
from posthog.models.team.team import Team
from posthog.models.user import User
-from products.slack_app.backend.models import SlackThreadTaskMapping, SlackUserProfileCache
+from products.slack_app.backend.models import (
+ SlackSettings,
+ SlackThreadTaskMapping,
+ SlackUserProfileCache,
+ UntaggedFollowupMode,
+)
class TestRouteThreadMessage(TestCase):
@@ -89,6 +96,15 @@ class TestRouteThreadMessage(TestCase):
mentioning_slack_user_id="U_ALICE",
)
+ # Follow-ups are off until the thread creator turns them on, so every
+ # routing test that expects a dispatch needs Alice opted in. The
+ # mode-specific tests below overwrite this row.
+ self.creator_settings = SlackSettings.objects.create(
+ slack_workspace_id="T_SLACK",
+ slack_user_id="U_ALICE",
+ untagged_followup_mode=UntaggedFollowupMode.AUTO,
+ )
+
# All routing tests assume the per-org feature flag is on. The
# dedicated ``test_feature_flag_off_dropped`` test stops the patcher
# to exercise the off path.
@@ -350,6 +366,40 @@ class TestRouteThreadMessage(TestCase):
mock_start.assert_called_once()
assert mock_start.call_args.kwargs["untagged_followup"] is True
+ # --- Thread creator's follow-up mode ----------------------------------
+
+ def _set_creator_mode(self, mode: str | None) -> None:
+ self.creator_settings.untagged_followup_mode = mode
+ self.creator_settings.save(update_fields=["untagged_followup_mode"])
+
+ @parameterized.expand(
+ [
+ ("auto_other_person", UntaggedFollowupMode.AUTO, "U_BOB", True),
+ # `ask` still dispatches here: the prompt is raised inside the workflow,
+ # once the classifier has judged the reply worth forwarding.
+ ("ask_other_person", UntaggedFollowupMode.ASK, "U_BOB", True),
+ ("ask_creator", UntaggedFollowupMode.ASK, "U_ALICE", True),
+ ("never_other_person", UntaggedFollowupMode.NEVER, "U_BOB", False),
+ # `never` means nobody, the creator included.
+ ("never_creator", UntaggedFollowupMode.NEVER, "U_ALICE", False),
+ # Never picked: the feature is opt-in, so an untouched row behaves as `never`.
+ ("unset", None, "U_BOB", False),
+ ]
+ )
+ @override_settings(DEBUG=False, CLOUD_DEPLOYMENT="US")
+ def test_webhook_dispatches_unless_the_creator_switched_followups_off(self, _name, mode, author, expect_workflow):
+ from products.slack_app.backend.api import ROUTE_HANDLED_LOCALLY
+
+ self._set_creator_mode(mode)
+ with patch(
+ "products.slack_app.backend.api._start_mention_workflow", return_value=ROUTE_HANDLED_LOCALLY
+ ) as mock_start:
+ result = self._route(self._make_event(user=author))
+ assert result == ROUTE_HANDLED_LOCALLY
+ assert mock_start.called is expect_workflow
+ if expect_workflow:
+ assert mock_start.call_args.kwargs["untagged_followup"] is True
+
# --- Symmetry with the app_mention path -------------------------------
@override_settings(DEBUG=False, CLOUD_DEPLOYMENT="US")
diff --git a/products/slack_app/backend/tests/test_untagged_followup_interactivity.py b/products/slack_app/backend/tests/test_untagged_followup_interactivity.py
new file mode 100644
index 000000000000..a2fd653be78f
--- /dev/null
+++ b/products/slack_app/backend/tests/test_untagged_followup_interactivity.py
@@ -0,0 +1,248 @@
+import json
+import time
+from typing import Any
+
+from unittest.mock import MagicMock, patch
+
+from django.apps import apps
+from django.core.cache import cache
+from django.test import TestCase, override_settings
+
+from rest_framework.test import APIClient
+
+from posthog.models.integration import Integration
+from posthog.models.organization import Organization, OrganizationMembership
+from posthog.models.team.team import Team
+from posthog.models.user import User
+
+from products.slack_app.backend.api import (
+ UNTAGGED_FOLLOWUP_ACTION_DISMISS,
+ UNTAGGED_FOLLOWUP_ACTION_RUN,
+ UNTAGGED_FOLLOWUP_BLOCK_ID_PREFIX,
+ UNTAGGED_FOLLOWUP_CONTEXT_KIND,
+ _picker_context_cache_key,
+)
+from products.slack_app.backend.models import SlackSettings, SlackThreadTaskMapping, UntaggedFollowupMode
+from products.slack_app.backend.tests.helpers import sign_slack_request
+
+
+@override_settings(DEBUG=True)
+@patch("products.slack_app.backend.api.requests.post")
+@patch("products.slack_app.backend.api.SlackIntegration")
+class TestUntaggedFollowupInteractivity(TestCase):
+ """The `ask` mode is only useful if the confirmation actually dispatches the
+ message it was raised for. DEBUG=True keeps the endpoint local-only, so an
+ unrecognised payload doesn't attempt a real cross-region proxy."""
+
+ signing_secret = "posthog-code-test-secret"
+ slack_team_id = "T12345"
+ slack_channel_id = "C001"
+ response_url = "https://hooks.slack.example/response/abc"
+ context_token = "untagged-token-123"
+
+ def setUp(self):
+ cache.clear()
+ self.client = APIClient()
+
+ self.organization = Organization.objects.create(name="Test Org")
+ self.team = Team.objects.create(organization=self.organization, name="Test Team")
+ self.member_user = User.objects.create(email="[email protected]", distinct_id="user-member")
+ OrganizationMembership.objects.create(user=self.member_user, organization=self.organization)
+ self.integration = Integration.objects.create(
+ team=self.team,
+ kind="slack",
+ integration_id=self.slack_team_id,
+ sensitive_config={"access_token": "xoxb-test"},
+ )
+
+ # The prompt only exists because the thread is mapped to a task, and the
+ # click re-reads that mapping to see the creator's current mode.
+ Task = apps.get_model("tasks", "Task")
+ TaskRun = apps.get_model("tasks", "TaskRun")
+ task = Task.objects.create(
+ team=self.team,
+ title="Fix the broken dashboard export",
+ description="desc",
+ origin_product=Task.OriginProduct.SLACK,
+ created_by=self.member_user,
+ repository="org/repo",
+ )
+ self.mapping = SlackThreadTaskMapping.objects.create(
+ team=self.team,
+ integration=self.integration,
+ slack_workspace_id=self.slack_team_id,
+ channel=self.slack_channel_id,
+ thread_ts="1000.0000",
+ task=task,
+ task_run=TaskRun.objects.create(task=task, team=self.team, status=TaskRun.Status.IN_PROGRESS),
+ mentioning_slack_user_id="U_ALICE",
+ )
+ SlackSettings.objects.create(
+ slack_workspace_id=self.slack_team_id,
+ slack_user_id="U_ALICE",
+ untagged_followup_mode=UntaggedFollowupMode.ASK,
+ )
+
+ self.event = {
+ "type": "message",
+ "channel": self.slack_channel_id,
+ "user": "U_BOB",
+ "ts": "1001.0000",
+ "thread_ts": "1000.0000",
+ "text": "and the export filter too",
+ }
+ cache.set(
+ _picker_context_cache_key(self.context_token),
+ {
+ "kind": UNTAGGED_FOLLOWUP_CONTEXT_KIND,
+ "integration_id": self.integration.id,
+ "slack_workspace_id": self.slack_team_id,
+ "slack_channel_id": self.slack_channel_id,
+ "thread_ts": "1000.0000",
+ "slack_user_id": "U_BOB",
+ "event": self.event,
+ "is_ext_shared_channel": False,
+ "created_at": int(time.time()),
+ },
+ timeout=900,
+ )
+
+ self._ff_patcher = patch(
+ "products.slack_app.backend.api.is_slack_app_untagged_thread_followups_enabled", return_value=True
+ )
+ self._ff_patcher.start()
+ self.addCleanup(self._ff_patcher.stop)
+
+ def _click(self, action_id: str, slack_user_id: str) -> Any:
+ payload = {
+ "type": "block_actions",
+ "team": {"id": self.slack_team_id},
+ "user": {"id": slack_user_id},
+ "response_url": self.response_url,
+ "actions": [
+ {
+ "action_id": action_id,
+ "block_id": f"{UNTAGGED_FOLLOWUP_BLOCK_ID_PREFIX}_actions:{self.context_token}",
+ "value": self.context_token,
+ }
+ ],
+ }
+ body_str = f"payload={json.dumps(payload)}"
+ signed = sign_slack_request(body_str.encode(), self.signing_secret)
+ return self.client.post(
+ "/slack/interactivity-callback/",
+ data=body_str,
+ content_type="application/x-www-form-urlencoded",
+ headers={"x-slack-signature": signed.signature, "x-slack-request-timestamp": signed.timestamp},
+ )
+
+ def _stub_slack_user_email(self, email: str) -> Any:
+ return patch(
+ "products.slack_app.backend.api.get_slack_user_info",
+ return_value={"user": {"profile": {"email": email}}},
+ )
+
+ def test_confirmation_dispatches_the_original_message(self, mock_slack_cls, mock_post):
+ mock_slack_cls.slack_config.return_value = {"SLACK_APP_SIGNING_SECRET": self.signing_secret}
+
+ with (
+ self._stub_slack_user_email(self.member_user.email),
+ patch("products.slack_app.backend.api._start_mention_workflow") as mock_start,
+ ):
+ response = self._click(UNTAGGED_FOLLOWUP_ACTION_RUN, "U_BOB")
+
+ assert response.status_code == 200
+ mock_start.assert_called_once()
+ assert mock_start.call_args.args[0] == self.event
+ assert mock_start.call_args.kwargs["untagged_followup"] is True
+ # Without this the re-dispatch would classify again and re-raise the prompt.
+ assert mock_start.call_args.kwargs["untagged_followup_confirmed"] is True
+ assert mock_start.call_args.kwargs["posthog_user"].id == self.member_user.id
+ # Burnt on use, so a forwarded or double click can't run the same message twice.
+ assert cache.get(_picker_context_cache_key(self.context_token)) is None
+ assert mock_post.call_args.kwargs["json"] == {"delete_original": True}
+
+ def test_dismissal_dispatches_nothing(self, mock_slack_cls, mock_post):
+ mock_slack_cls.slack_config.return_value = {"SLACK_APP_SIGNING_SECRET": self.signing_secret}
+
+ with patch("products.slack_app.backend.api._start_mention_workflow") as mock_start:
+ response = self._click(UNTAGGED_FOLLOWUP_ACTION_DISMISS, "U_BOB")
+
+ assert response.status_code == 200
+ mock_start.assert_not_called()
+ assert cache.get(_picker_context_cache_key(self.context_token)) is None
+ assert mock_post.call_args.kwargs["json"] == {"delete_original": True}
+
+ def test_click_from_anyone_but_the_message_author_dispatches_nothing(self, mock_slack_cls, mock_post):
+ # The prompt is ephemeral, so this shouldn't be reachable — but the run
+ # would execute as the clicker against somebody else's message.
+ mock_slack_cls.slack_config.return_value = {"SLACK_APP_SIGNING_SECRET": self.signing_secret}
+
+ with (
+ self._stub_slack_user_email(self.member_user.email),
+ patch("products.slack_app.backend.api._start_mention_workflow") as mock_start,
+ ):
+ response = self._click(UNTAGGED_FOLLOWUP_ACTION_RUN, "U_SOMEONE_ELSE")
+
+ assert response.status_code == 200
+ mock_start.assert_not_called()
+
+ def test_flag_turned_off_between_prompt_and_click_dispatches_nothing(self, mock_slack_cls, mock_post):
+ mock_slack_cls.slack_config.return_value = {"SLACK_APP_SIGNING_SECRET": self.signing_secret}
+ self._ff_patcher.stop()
+
+ with (
+ patch("products.slack_app.backend.api.is_slack_app_untagged_thread_followups_enabled", return_value=False),
+ self._stub_slack_user_email(self.member_user.email),
+ patch("products.slack_app.backend.api._start_mention_workflow") as mock_start,
+ ):
+ response = self._click(UNTAGGED_FOLLOWUP_ACTION_RUN, "U_BOB")
+
+ self._ff_patcher.start()
+ assert response.status_code == 200
+ mock_start.assert_not_called()
+
+ def test_confirmation_after_the_creator_switched_to_never_dispatches_nothing(self, mock_slack_cls, mock_post):
+ # The confirmed run skips the mode activity, so the click is the last place
+ # that can honour a mode changed while the prompt sat unanswered.
+ mock_slack_cls.slack_config.return_value = {"SLACK_APP_SIGNING_SECRET": self.signing_secret}
+ SlackSettings.objects.filter(slack_user_id="U_ALICE").update(untagged_followup_mode=UntaggedFollowupMode.NEVER)
+
+ with (
+ self._stub_slack_user_email(self.member_user.email),
+ patch("products.slack_app.backend.api._start_mention_workflow") as mock_start,
+ ):
+ response = self._click(UNTAGGED_FOLLOWUP_ACTION_RUN, "U_BOB")
+
+ assert response.status_code == 200
+ mock_start.assert_not_called()
+
+ def test_confirmation_from_a_member_without_project_access_dispatches_nothing(self, mock_slack_cls, mock_post):
+ # Org membership is all `_is_org_member` proves. The routing path drops a reply
+ # whose author can't reach the mapped project, so the click has to as well.
+ mock_slack_cls.slack_config.return_value = {"SLACK_APP_SIGNING_SECRET": self.signing_secret}
+
+ no_access = MagicMock()
+ no_access.team.return_value.effective_membership_level = None
+ with (
+ self._stub_slack_user_email(self.member_user.email),
+ patch("products.slack_app.backend.api.UserPermissions", return_value=no_access),
+ patch("products.slack_app.backend.api._start_mention_workflow") as mock_start,
+ ):
+ response = self._click(UNTAGGED_FOLLOWUP_ACTION_RUN, "U_BOB")
+
+ assert response.status_code == 200
+ mock_start.assert_not_called()
+
+ def test_thread_whose_mapping_disappeared_dispatches_nothing(self, mock_slack_cls, mock_post):
+ mock_slack_cls.slack_config.return_value = {"SLACK_APP_SIGNING_SECRET": self.signing_secret}
+ self.mapping.delete()
+
+ with (
+ self._stub_slack_user_email(self.member_user.email),
+ patch("products.slack_app.backend.api._start_mention_workflow") as mock_start,
+ ):
+ response = self._click(UNTAGGED_FOLLOWUP_ACTION_RUN, "U_BOB")
+
+ assert response.status_code == 200
+ mock_start.assert_not_called()