: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
chore(slack_app): retire drained Temporal patches and user_id shims (#83662)
Vojta Bartošaa534d16745f
diff --git a/posthog/temporal/ai/slack_app/__init__.py b/posthog/temporal/ai/slack_app/__init__.pyindex 7ecaf6e426d4..8d77d6235429 100644--- a/posthog/temporal/ai/slack_app/__init__.py+++ b/posthog/temporal/ai/slack_app/__init__.py@@ -32,7 +32,6 @@ from posthog.temporal.ai.slack_app.activities import (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,)from posthog.temporal.ai.slack_app.types import (@@ -54,7 +53,6 @@ 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,cascade_posthog_code_repository_activity,@@ -118,6 +116,5 @@ __all__ = ["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__.pyindex 05bcc6e61cb7..7395ee07601b 100644--- a/posthog/temporal/ai/slack_app/activities/__init__.py+++ b/posthog/temporal/ai/slack_app/activities/__init__.py@@ -39,10 +39,7 @@ from posthog.temporal.ai.slack_app.activities.task_creation import (forward_posthog_code_followup_activity,)from posthog.temporal.ai.slack_app.activities.thread import collect_posthog_code_thread_messages_activity-from posthog.temporal.ai.slack_app.activities.user_resolution import (- resolve_posthog_code_slack_command_user_activity,- resolve_posthog_code_slack_user_activity,-)+from posthog.temporal.ai.slack_app.activities.user_resolution import resolve_posthog_code_slack_command_user_activity__all__ = ["CLASSIFIER_THREAD_HISTORY_MESSAGES",@@ -73,7 +70,6 @@ __all__ = ["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","run_posthog_slack_inbox_onboarding_activity",]diff --git a/posthog/temporal/ai/slack_app/activities/messaging.py b/posthog/temporal/ai/slack_app/activities/messaging.pyindex cc7b70fd8a39..78f5c0a25966 100644--- a/posthog/temporal/ai/slack_app/activities/messaging.py+++ b/posthog/temporal/ai/slack_app/activities/messaging.py@@ -61,26 +61,10 @@ def post_posthog_code_repo_picker_activity(workflow_id: str,guidance: str,allow_no_repo: bool,- user_id: int | None = None,+ user_id: int,) -> None:- """Post the repository picker block in the Slack thread.-- ``user_id`` is appended last and defaults to ``None`` so a worker draining an- activity task scheduled by a pre-2026-06 workflow (recorded with 8 positional- args) still binds: the eight legacy slots align by position and ``user_id``- falls through to the default. The body short-circuits in that case rather than- posting a picker with a missing ``mentioning_user_id``, which would break the- downstream external-select handler. New workflows go through the patched call- site at the workflow body and pass ``user_id`` as the final positional arg.- """+ """Post the repository picker block in the Slack thread."""inputs = coerce_mention_workflow_inputs(inputs)- if user_id is None:- logger.warning(- "posthog_code_picker_legacy_call_skipped",- integration_id=inputs.integration_id,- slack_team_id=inputs.slack_team_id,- )- returnfrom products.slack_app.backend.api import _post_repo_picker_messagediff --git a/posthog/temporal/ai/slack_app/activities/repo_selection.py b/posthog/temporal/ai/slack_app/activities/repo_selection.pyindex 251d8bfefa94..519706a4719d 100644--- a/posthog/temporal/ai/slack_app/activities/repo_selection.py+++ b/posthog/temporal/ai/slack_app/activities/repo_selection.py@@ -21,7 +21,7 @@ logger = structlog.get_logger(__name__)def cascade_posthog_code_repository_activity(inputs: PostHogCodeSlackMentionWorkflowInputs,event_text: str,- user_id: int | None = None,+ user_id: int,) -> PostHogCodeRepoCascadeOutcome:"""Synchronous fast-path before the discovery agent.@@ -29,22 +29,9 @@ def cascade_posthog_code_repository_activity(personal install, exactly one connected, or an explicit `org/repo` mentioned in themessage — without paying for the sandbox-backed agent. Anything else returns`mode='agent_needed'` and the workflow takes over.-- ``user_id`` defaults to ``None`` for backwards compatibility with the pre-2026-06- call shape: if a worker drains an activity task that was scheduled by an older- workflow (recorded with two positional args), the call still binds, and an- unidentifiable mentioner resolves no repos anyway."""from posthog.models.integration import Integration- if user_id is None:- logger.warning(- "posthog_code_cascade_legacy_call",- integration_id=inputs.integration_id,- slack_team_id=inputs.slack_team_id,- )- return PostHogCodeRepoCascadeOutcome(mode="no_repo", repository=None, reason="legacy_no_user_id")-from products.slack_app.backend.api import _extract_explicit_repo, _get_full_repo_namesintegration = Integration.objects.select_related("team", "team__organization").get(diff --git a/posthog/temporal/ai/slack_app/activities/user_resolution.py b/posthog/temporal/ai/slack_app/activities/user_resolution.pyindex 01b54814039a..8ab2a1b52dd0 100644--- a/posthog/temporal/ai/slack_app/activities/user_resolution.py+++ b/posthog/temporal/ai/slack_app/activities/user_resolution.py@@ -1,34 +1,9 @@from temporalio import activity-from posthog.temporal.ai.slack_app.types import (- PostHogCodeSlackMentionCommandWorkflowInputs,- PostHogCodeSlackMentionWorkflowInputs,-)+from posthog.temporal.ai.slack_app.types import PostHogCodeSlackMentionCommandWorkflowInputsfrom posthog.temporal.common.utils import close_db_connections-@close_db_connections-def resolve_posthog_code_slack_user_activity(- inputs: PostHogCodeSlackMentionWorkflowInputs,- channel: str,- thread_ts: str,- slack_user_id: str,-) -> int | None:- from posthog.models.integration import Integration, SlackIntegration-- from products.slack_app.backend.api import resolve_slack_user-- integration = Integration.objects.select_related("team", "team__organization").get(- id=inputs.integration_id,- kind="slack",- integration_id=inputs.slack_team_id,- )- slack = SlackIntegration(integration)- user_context = resolve_slack_user(slack, integration, slack_user_id, channel, thread_ts)- return user_context.user.id if user_context else None--@activity.defn@close_db_connectionsdef resolve_posthog_code_slack_command_user_activity(diff --git a/posthog/temporal/ai/slack_app/posthog_code_slack_mention.py b/posthog/temporal/ai/slack_app/posthog_code_slack_mention.pyindex b9d59356e984..1a78403b4dc7 100644--- a/posthog/temporal/ai/slack_app/posthog_code_slack_mention.py+++ b/posthog/temporal/ai/slack_app/posthog_code_slack_mention.py@@ -10,7 +10,6 @@ from posthog.temporal.ai.slack_app import (POSTHOG_CODE_SLACK_MENTION_PICKER_GUIDANCE,PostHogCodeSlackMentionWorkflowInputs,SlackAppModelOverrideInput,- block_posthog_code_task_if_no_personal_github_activity,cascade_posthog_code_repository_activity,classify_posthog_code_task_needs_repo_activity,classify_slack_app_model_override_activity,@@ -24,14 +23,21 @@ from posthog.temporal.ai.slack_app import (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 PostHogWorkflowPOSTHOG_CODE_SLACK_MENTION_TIMEOUT_SECONDS = 10 * 60POSTHOG_CODE_SLACK_PICKER_TIMEOUT_MINUTES = 15-# Temporal patch IDs — arbitrary strings recorded in workflow history.+# Temporal patch IDs — arbitrary strings recorded in workflow history. The+# pre-patch histories behind the first three have drained: this workflow's+# longest wait is the 15-minute repo picker, and it is bounded at an hour as a+# child of the queue workflow. Their gates are gone and only `deprecate_patch`+# remains, keeping the recorded marker compatible for executions in flight+# across the deploy that removes them. Standard two-step Temporal patch+# lifecycle: those calls come out once the histories that recorded a plain+# marker have drained in turn. The confirmation patch is younger and still+# gated, so it stays a full `workflow.patched` branch until it drains too._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"@@ -96,28 +102,25 @@ class PostHogCodeSlackMentionWorkflow(PostHogWorkflow):# classify, and default-deny would silently drop the attachment.# Replies with text still face it even when files are attached, so# chitchat with a screenshot doesn't wake the agent.- # workflow.patched() returns False for executions started before- # this deploy so replay still schedules the classifier for- # file-only replies. Delete the gate once history retention- # exceeds our longest possible run.event_files = event.get("files")event_has_files = isinstance(event_files, list) and len(event_files) > 0file_only_followup = event_has_files and not (event.get("text") or "").strip()- 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,- inputs,- channel,- thread_ts,- slack_user_id,- event.get("text", ""),- )- if not should_forward:- return+ if inputs.untagged_followup and not inputs.untagged_followup_confirmed:+ if file_only_followup:+ # The gate this replaces was only ever reached behind both+ # flags, so only these histories carry the marker.+ workflow.deprecate_patch(_PATCH_ID_FILE_ONLY_FOLLOWUP_BYPASS)+ else:+ should_forward = await _execute_posthog_code_activity(+ classify_untagged_followup_activity,+ inputs,+ channel,+ thread_ts,+ slack_user_id,+ event.get("text", ""),+ )+ 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@@ -157,20 +160,7 @@ class PostHogCodeSlackMentionWorkflow(PostHogWorkflow):if inputs.untagged_followup:return- # New starts carry ``user_id`` from routing-time resolution and skip- # the activity. Legacy histories started before the field existed- # deserialize with ``user_id=None`` and replay through the activity so- # the recorded command stream still matches. Drop this fallback (and- # make ``user_id`` required on inputs) once the workflow history- # retention window has elapsed.- if inputs.user_id is not None:- user_id = inputs.user_id- else:- user_id = await _execute_posthog_code_activity(- resolve_posthog_code_slack_user_activity, inputs, channel, thread_ts, slack_user_id- )- if not user_id:- return+ user_id = inputs.user_idthread_messages = await _execute_posthog_code_activity(collect_posthog_code_thread_messages_activity,@@ -203,23 +193,7 @@ class PostHogCodeSlackMentionWorkflow(PostHogWorkflow):# that here meant a single false positive from the needs-repo classifier# walled a plain analytics question behind a Connect button.repository = None- if not workflow.patched(_PATCH_ID_NO_PERSONAL_GITHUB_GATE):- # Replay-only, for executions that recorded the classify-then-block pair.- needs_repo = await _execute_posthog_code_activity(- classify_posthog_code_task_needs_repo_activity,- event.get("text", ""),- thread_messages,- )- if needs_repo:- blocked = await _execute_posthog_code_activity(- block_posthog_code_task_if_no_personal_github_activity,- inputs,- channel,- thread_ts,- user_id,- )- if blocked:- return+ workflow.deprecate_patch(_PATCH_ID_NO_PERSONAL_GITHUB_GATE)else:# Multiple candidates and no explicit mention. Cheap Haiku# check first to skip the agent entirely for analytics/config@@ -279,16 +253,15 @@ class PostHogCodeSlackMentionWorkflow(PostHogWorkflow):# mention, so the reply announcing the model only ever describes a task# that gets created. The feature flag is checked inside the activity —# branching the workflow on a flag would be non-deterministic on replay.- model_override = None- if workflow.patched(_PATCH_ID_MODEL_CLASSIFIER):- model_override = await _execute_posthog_code_activity(- classify_slack_app_model_override_activity,- SlackAppModelOverrideInput(- integration_id=inputs.integration_id,- slack_team_id=inputs.slack_team_id,- event_text=event.get("text", ""),- ),- )+ workflow.deprecate_patch(_PATCH_ID_MODEL_CLASSIFIER)+ model_override = await _execute_posthog_code_activity(+ classify_slack_app_model_override_activity,+ SlackAppModelOverrideInput(+ integration_id=inputs.integration_id,+ slack_team_id=inputs.slack_team_id,+ event_text=event.get("text", ""),+ ),+ )await _execute_posthog_code_activity(create_posthog_code_task_for_repo_activity,diff --git a/posthog/temporal/ai/slack_app/posthog_code_slack_mention_command.py b/posthog/temporal/ai/slack_app/posthog_code_slack_mention_command.pyindex 5cad30d7ea21..f42ed70b01c1 100644--- a/posthog/temporal/ai/slack_app/posthog_code_slack_mention_command.py+++ b/posthog/temporal/ai/slack_app/posthog_code_slack_mention_command.py@@ -52,12 +52,9 @@ class PostHogCodeSlackMentionCommandWorkflow(PostHogWorkflow):@workflow.runasync def run(self, inputs: PostHogCodeSlackMentionCommandWorkflowInputs) -> None:- # New starts carry ``user_id`` from routing-time resolution and skip the- # activity. Legacy histories started before the field existed deserialize- # with ``user_id=None`` and replay through the activity so the recorded- # command stream still matches. Drop this fallback (and make ``user_id``- # required on inputs) once the workflow history retention window has- # elapsed.+ # The mention surface resolves the user at routing time and passes it in.+ # The slash surface passes ``None`` on purpose so its webhook ack stays+ # inside Slack's 3s budget, and resolution happens here instead.user_id = inputs.user_idif user_id is None:user_id = await workflow.execute_activity(@@ -94,14 +91,15 @@ class PostHogCodeSlackMentionCommandWorkflow(PostHogWorkflow):# shape, but today they only read ``integration_id`` / ``slack_team_id``# / ``event`` from it. Synthesise a compatible record for the resolved# target so we can reuse the existing picker plumbing without- # duplicating it. Forward ``user_id`` so any future activity that reads- # it (e.g. for attribution) stays consistent with the surrounding- # command workflow's resolved user.+ # duplicating it. Forward the resolved ``user_id`` so any activity that+ # reads it (e.g. for attribution) sees the same actor as the surrounding+ # command workflow — on the slash surface ``inputs.user_id`` is still None+ # here, since that surface defers resolution to the activity above.picker_inputs = PostHogCodeSlackMentionWorkflowInputs(event=inputs.event,integration_id=target_integration_id,slack_team_id=inputs.slack_team_id,- user_id=inputs.user_id,+ user_id=user_id,)blocked = await workflow.execute_activity(diff --git a/posthog/temporal/ai/slack_app/slack_app_mention.py b/posthog/temporal/ai/slack_app/slack_app_mention.pyindex 3c7c823a5808..2307a5e3523c 100644--- a/posthog/temporal/ai/slack_app/slack_app_mention.py+++ b/posthog/temporal/ai/slack_app/slack_app_mention.py@@ -27,11 +27,12 @@ SLACK_APP_MENTION_IDLE_TIMEOUT_SECONDS = 30SLACK_APP_MENTION_MAX_PROCESSED_KEYS = 200# Temporal runs buffered signal handlers before run() starts, so dedup state seeded in# run() arrived too late: a redelivered Slack event signalled into the first workflow task-# missed the dedup keys and started a duplicate child workflow. Seeding moved to __init__,-# which runs first. That changes which child workflows an execution starts, so executions-# that already recorded the old order keep replaying it through this patch. The patch can-# be deleted once no pre-patch executions remain, which takes minutes because these-# workflows complete after a 30 second idle timeout.+# missed the dedup keys and started a duplicate child workflow. Seeding happens in+# __init__, which runs first. Pre-patch histories drained long ago — these workflows+# complete after a 30 second idle timeout — so only `deprecate_patch` remains, keeping the+# recorded marker compatible for executions in flight across the deploy that removes the+# gate. Standard two-step Temporal patch lifecycle: the call comes out once the histories+# that recorded a plain marker have drained in turn.SLACK_APP_MENTION_SEED_IN_INIT_PATCH = "slack-app-mention-seed-in-init"# The queue awaits each child serially, so a child that never completes stalls every@@ -40,8 +41,10 @@ SLACK_APP_MENTION_SEED_IN_INIT_PATCH = "slack-app-mention-seed-in-init"# (15 minutes for the repo picker) plus its 10-minute activity timeouts stay well# inside an hour.SLACK_APP_MENTION_CHILD_EXECUTION_TIMEOUT = timedelta(hours=1)-# Bounding the child and telling the user when it dies both add workflow commands, so-# executions started before this shipped keep replaying the unbounded, silent path.+# Bounding the child and telling the user when it dies both add workflow commands. The+# executions that replayed the unbounded, silent path are long gone; `deprecate_patch`+# only keeps their marker compatible across the deploy that removes the gate, and comes+# out on the same lifecycle as the seeding patch above.SLACK_APP_MENTION_CHILD_TIMEOUT_PATCH = "slack-app-mention-child-timeout"@@ -95,8 +98,8 @@ class SlackAppMentionWorkflow(PostHogWorkflow):# iteration order stays deterministic for the continue_as_new carry-over.self._seen_keys: dict[str, None] = {}self._queue: list[PostHogCodeSlackMentionWorkflowInputs] = []- if workflow.patched(SLACK_APP_MENTION_SEED_IN_INIT_PATCH):- self._seed(inputs)+ workflow.deprecate_patch(SLACK_APP_MENTION_SEED_IN_INIT_PATCH)+ self._seed(inputs)def _seed(self, inputs: SlackAppMentionWorkflowInputs) -> None:for key in inputs.processed_event_keys:@@ -185,7 +188,7 @@ class SlackAppMentionWorkflow(PostHogWorkflow):ALLOW_DUPLICATE mirrors the standalone dispatch's reuse policy forretries that outlive this instance's dedup keys."""- bounded = workflow.patched(SLACK_APP_MENTION_CHILD_TIMEOUT_PATCH)+ workflow.deprecate_patch(SLACK_APP_MENTION_CHILD_TIMEOUT_PATCH)try:# The default parent close policy (terminate) is deliberate: an# operator killing this queue means "stop this conversation", so@@ -197,7 +200,7 @@ class SlackAppMentionWorkflow(PostHogWorkflow):message,id=derive_mention_workflow_id(message),id_reuse_policy=WorkflowIDReusePolicy.ALLOW_DUPLICATE,- execution_timeout=SLACK_APP_MENTION_CHILD_EXECUTION_TIMEOUT if bounded else None,+ execution_timeout=SLACK_APP_MENTION_CHILD_EXECUTION_TIMEOUT,)except exceptions.WorkflowAlreadyStartedError:# A standalone execution for this exact message is already@@ -209,15 +212,11 @@ class SlackAppMentionWorkflow(PostHogWorkflow):# expected to fail; this backstop keeps one poisoned message from# wedging the conversation's queue.workflow.logger.exception("slack_app_mention_child_failed")- if bounded:- await self._notify_child_failed(message)+ await self._notify_child_failed(message)@workflow.runasync def run(self, inputs: SlackAppMentionWorkflowInputs) -> None:- # Executions that predate the patch recorded their seeding here, so they keep it.- if not workflow.patched(SLACK_APP_MENTION_SEED_IN_INIT_PATCH):- self._seed(inputs)-+ # Seeding happens in __init__ — see _seed's call site for why.while True:try:await workflow.wait_condition(diff --git a/posthog/temporal/ai/slack_app/types.py b/posthog/temporal/ai/slack_app/types.pyindex b68e2aa74b22..1dfe2631b763 100644--- a/posthog/temporal/ai/slack_app/types.py+++ b/posthog/temporal/ai/slack_app/types.py@@ -10,24 +10,24 @@ from typing import Any, Literalfrom pydantic import BaseModel+from posthog.dataclasses import frozen+@dataclassclass PostHogSlackInboxOnboardingInputs:integration_id: int-@dataclass(frozen=True)+@frozenclass PostHogCodeSlackMentionWorkflowInputs:event: dict[str, Any]integration_id: intslack_team_id: str+ # Resolved at routing time: dispatch never reaches this workflow without a+ # PostHog user, on either the ``app_mention`` or the untagged-reply path.+ user_id: int# Event that dispatched the workflowslack_event_id: str | None = None- # Resolved at routing time. ``None`` only on in-flight workflow histories- # started before this field existed; those fall back to the in-workflow- # resolve activity below. Remove the fallback (and this field's optionality)- # once the workflow history retention window has elapsed.- user_id: int | None = None# True when the workflow was started for an untagged thread reply (event type# ``message``) rather than an explicit ``app_mention``. The routing layer# already verified a ``SlackThreadTaskMapping`` exists before dispatch, but@@ -149,18 +149,17 @@ class PostHogCodeSlackMentionCommandWorkflowInputs:command_prefix: str = "@PostHog"-@dataclass+@frozenclass PostHogCodeRepoCascadeOutcome:"""Synchronous fast-path repo resolution before the discovery agent runs.`auto` → use `repository` directly. `no_repo` → the mentioning user resolves norepos, so the mention becomes a repo-less task and the agent decides whether theask needs code. `agent_needed` → there are multiple candidates and no explicit- mention. `needs_user_github` is neither emitted nor handled any more; the value- stays in the `Literal` only so an old payload still parses.+ mention."""- mode: Literal["auto", "no_repo", "agent_needed", "needs_user_github"]+ mode: Literal["auto", "no_repo", "agent_needed"]repository: str | Nonereason: strdiff --git a/posthog/temporal/tests/ai/slack_app/activities/test_task_creation.py b/posthog/temporal/tests/ai/slack_app/activities/test_task_creation.pyindex a0b588e302ad..d191e2b4d4ac 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@@ -475,6 +475,7 @@ class TestDeriveMentionWorkflowId:"integration_id": 1,"slack_team_id": "T_SLACK","slack_event_id": "Ev123",+ "user_id": 1,**overrides,}return PostHogCodeSlackMentionWorkflowInputs(**fields)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.pyindex af873c8e396e..4b8314e93e1e 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@@ -64,7 +64,7 @@ class _Recorder:# a deleted trigger message reads as.self.thread_messages: dict[str, list[dict[str, str]]] = {}# ts -> cascade mode; missing means "auto" with a fixed repository.- self.cascade_modes: dict[str, Literal["auto", "no_repo", "agent_needed", "needs_user_github"]] = {}+ self.cascade_modes: dict[str, Literal["auto", "no_repo", "agent_needed"]] = {}# ts per personal-GitHub gate call, in execution order.self.github_gate_calls: list[str] = []# event text per needs-repo classifier call, in execution order.@@ -212,12 +212,6 @@ def _fake_activities(rec: _Recorder) -> list:async def internal_error(inputs: PostHogCodeSlackMentionWorkflowInputs, channel: str, thread_ts: str) -> None:rec.internal_errors.append(inputs.event["ts"])- @activity.defn(name="resolve_posthog_code_slack_user_activity")- async def resolve_user(- inputs: PostHogCodeSlackMentionWorkflowInputs, channel: str, thread_ts: str, slack_user_id: str- ) -> int | None:- return 42-@activity.defn(name="mark_slack_app_message_processing_activity")async def mark_processing(input: SlackAppMessageReactionInput) -> None:rec.processing_marked.append(input.message_ts)@@ -243,7 +237,6 @@ def _fake_activities(rec: _Recorder) -> list:create_task,picker_timeout,internal_error,- resolve_user,]diff --git a/posthog/temporal/tests/ai/slack_app/test_types.py b/posthog/temporal/tests/ai/slack_app/test_types.pyindex e66b8c93f096..91e109fefc74 100644--- a/posthog/temporal/tests/ai/slack_app/test_types.py+++ b/posthog/temporal/tests/ai/slack_app/test_types.py@@ -4,7 +4,9 @@ from posthog.temporal.ai.slack_app.types import PostHogCodeSlackMentionWorkflowIdef test_coerce_returns_dataclass_unchanged():- inputs = PostHogCodeSlackMentionWorkflowInputs(event={"ts": "1.2"}, integration_id=7, slack_team_id="T1")+ inputs = PostHogCodeSlackMentionWorkflowInputs(+ event={"ts": "1.2"}, integration_id=7, slack_team_id="T1", user_id=42+ )assert coerce_mention_workflow_inputs(inputs) is inputs@@ -23,7 +25,7 @@ def test_coerce_rebuilds_dataclass_from_dict():def test_coerce_drops_unknown_keys_from_dict():# A newer sender's extra field must not blow up an older activity mid-deploy.coerced = coerce_mention_workflow_inputs(- {"event": {}, "integration_id": 1, "slack_team_id": "T1", "some_future_field": "x"}+ {"event": {}, "integration_id": 1, "slack_team_id": "T1", "user_id": 42, "some_future_field": "x"})assert coerced.integration_id == 1diff --git a/posthog/temporal/tests/ai/test_block_missing_user_github.py b/posthog/temporal/tests/ai/test_block_missing_user_github.pyindex 3dfaca84e78b..27f0c18a3f61 100644--- a/posthog/temporal/tests/ai/test_block_missing_user_github.py+++ b/posthog/temporal/tests/ai/test_block_missing_user_github.py@@ -13,11 +13,14 @@ from posthog.temporal.ai.slack_app import ()-def _make_inputs(integration_id: int, slack_team_id: str = "T_SLACK") -> PostHogCodeSlackMentionWorkflowInputs:+def _make_inputs(+ integration_id: int, user_id: int, slack_team_id: str = "T_SLACK"+) -> PostHogCodeSlackMentionWorkflowInputs:return PostHogCodeSlackMentionWorkflowInputs(event={"channel": "C123", "ts": "1234.5678", "user": "U_ALICE", "text": "<@BOT> do something"},integration_id=integration_id,slack_team_id=slack_team_id,+ user_id=user_id,)@@ -34,7 +37,7 @@ class TestBlockPostHogCodeTaskIfNoPersonalGitHub(TestCase):mock_slack_cls.return_value = mock_slackblocked = block_posthog_code_task_if_no_personal_github_activity(- _make_inputs(self.integration.id), "C123", "1234.5678", self.user.id+ _make_inputs(self.integration.id, self.user.id), "C123", "1234.5678", self.user.id)assert blocked is True@@ -70,7 +73,7 @@ class TestBlockPostHogCodeTaskIfNoPersonalGitHub(TestCase):mock_slack_cls.return_value = mock_slackblocked = block_posthog_code_task_if_no_personal_github_activity(- _make_inputs(self.integration.id), "C123", "1234.5678", self.user.id+ _make_inputs(self.integration.id, self.user.id), "C123", "1234.5678", self.user.id)assert blocked is False@@ -83,7 +86,7 @@ class TestBlockPostHogCodeTaskIfNoPersonalGitHub(TestCase):mock_slack_cls.return_value = mock_slackblocked = block_posthog_code_task_if_no_personal_github_activity(- _make_inputs(self.integration.id), "C123", "1234.5678", self.user.id+ _make_inputs(self.integration.id, self.user.id), "C123", "1234.5678", self.user.id)assert blocked is True@@ -105,7 +108,7 @@ class TestBlockPostHogCodeTaskIfNoPersonalGitHub(TestCase):mock_slack_cls.return_value = mock_slackblocked = block_posthog_code_task_if_no_personal_github_activity(- _make_inputs(self.integration.id), "C123", "1234.5678", self.user.id+ _make_inputs(self.integration.id, self.user.id), "C123", "1234.5678", self.user.id)assert blocked is True@@ -125,7 +128,7 @@ class TestBlockPostHogCodeTaskIfNoPersonalGitHub(TestCase):mock_slack_cls.return_value = mock_slackblocked = block_posthog_code_task_if_no_personal_github_activity(- _make_inputs(self.integration.id), "C123", "1234.5678", self.user.id+ _make_inputs(self.integration.id, self.user.id), "C123", "1234.5678", self.user.id)assert blocked is Truediff --git a/posthog/temporal/tests/ai/test_cascade_team_install.py b/posthog/temporal/tests/ai/test_cascade_team_install.pyindex 08e6dd061a6c..c654df7c3165 100644--- a/posthog/temporal/tests/ai/test_cascade_team_install.py+++ b/posthog/temporal/tests/ai/test_cascade_team_install.py@@ -15,11 +15,14 @@ from posthog.temporal.ai.slack_app import ()-def _make_inputs(integration_id: int, slack_team_id: str = "T_SLACK") -> PostHogCodeSlackMentionWorkflowInputs:+def _make_inputs(+ integration_id: int, user_id: int, slack_team_id: str = "T_SLACK"+) -> PostHogCodeSlackMentionWorkflowInputs:return PostHogCodeSlackMentionWorkflowInputs(event={"channel": "C123", "ts": "1234.5678", "user": "U_ALICE", "text": "<@BOT> fix the thing"},integration_id=integration_id,slack_team_id=slack_team_id,+ user_id=user_id,)@@ -52,7 +55,7 @@ class TestCascadeTeamInstall(TestCase):)outcome = cascade_posthog_code_repository_activity(- _make_inputs(self.slack_integration.id), "fix the thing", self.user.id+ _make_inputs(self.slack_integration.id, self.user.id), "fix the thing", self.user.id)assert outcome.mode == "no_repo"@@ -75,7 +78,7 @@ class TestCascadeTeamInstall(TestCase):mock_user_github_class.return_value = mock_user_githuboutcome = cascade_posthog_code_repository_activity(- _make_inputs(self.slack_integration.id), "fix the thing", self.user.id+ _make_inputs(self.slack_integration.id, self.user.id), "fix the thing", self.user.id)assert outcome.mode == "auto"diff --git a/posthog/temporal/tests/ai/test_classify_untagged_followup_activity.py b/posthog/temporal/tests/ai/test_classify_untagged_followup_activity.pyindex 826924751dca..6595285e7d2e 100644--- a/posthog/temporal/tests/ai/test_classify_untagged_followup_activity.py+++ b/posthog/temporal/tests/ai/test_classify_untagged_followup_activity.py@@ -52,6 +52,7 @@ class TestClassifyUntaggedFollowupActivity(TestCase):event={},integration_id=self.integration.id,slack_team_id="T_SLACK",+ user_id=self.user.id,untagged_followup=True,)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.pyindex c71d5081b24b..21d23dab3961 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@@ -13,8 +13,8 @@ from posthog.temporal.ai.slack_app.types import PostHogCodeSlackMentionWorkflowI("", True, False),# Replies with text still face the classifier even when files are attached.("nice weather today", True, True),- # Replays of histories recorded before the patch keep the old always-classify sequence.- ("", False, True),+ # Replays of histories recorded before the confirmation patch skip the prompt.+ ("", False, False),],)async def test_untagged_followup_with_files_classifier_gating(@@ -51,6 +51,8 @@ async def test_untagged_followup_with_files_classifier_gating(with (patch.object(posthog_code_slack_mention.workflow, "patched", return_value=patched),+ # Runs outside a workflow context, where the real marker call would raise.+ patch.object(posthog_code_slack_mention.workflow, "deprecate_patch"),patch.object(posthog_code_slack_mention, "_execute_posthog_code_activity", side_effect=fake_execute_activity),):await workflow.run(inputs)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.pyindex 6011c8e13884..855c24ac0937 100644--- a/posthog/temporal/tests/ai/test_request_untagged_followup_confirmation_activity.py+++ b/posthog/temporal/tests/ai/test_request_untagged_followup_confirmation_activity.py@@ -55,6 +55,7 @@ class TestRequestUntaggedFollowupConfirmationActivity(TestCase):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",+ user_id=self.user.id,untagged_followup=True,)diff --git a/posthog/test/dataclass_frozen_baseline.txt b/posthog/test/dataclass_frozen_baseline.txtindex 6cae3d2be083..a02b9ad9d974 100644--- a/posthog/test/dataclass_frozen_baseline.txt+++ b/posthog/test/dataclass_frozen_baseline.txt@@ -1602,6 +1602,7 @@6 posthog/hogql/base.py6 posthog/hogql/scripts/build_grammar_strategies.py6 posthog/local_bootstrap/config.py+6 posthog/temporal/ai/slack_app/types.py6 posthog/temporal/ai/sync_vectors.py6 posthog/temporal/salesforce_enrichment/stripe_workflow.py6 products/batch_exports/backend/temporal/destinations/redshift_batch_export.py@@ -1620,7 +1621,6 @@7 products/web_analytics/backend/temporal/digest_notification/types.py7 products/web_analytics/backend/temporal/weekly_digest/types.py8 ee/vercel/integration.py-8 posthog/temporal/ai/slack_app/types.py8 posthog/temporal/ai_observability/evaluation_clustering/activities.py8 posthog/temporal/delete_teams/types.py8 products/signals/backend/temporal/signal_queries.pydiff --git a/products/slack_app/backend/api.py b/products/slack_app/backend/api.pyindex 1f62f0af3632..64d066ea503c 100644--- a/products/slack_app/backend/api.py+++ b/products/slack_app/backend/api.py@@ -3193,7 +3193,7 @@ def _start_mention_workflow(slack_team_id: str,event_id: str | None,*,- posthog_user: User | None,+ posthog_user: User,untagged_followup: bool = False,untagged_followup_confirmed: bool = False,is_ext_shared_channel: bool = False,@@ -3208,13 +3208,8 @@ def _start_mention_workflow(is also threaded into the workflow inputs so the workflow runs theclassifier activity at the top of its body and short-circuits if themapping is gone by the time the followup activity runs.-- ``posthog_user`` is optional only to keep the door open for the legacy- in-workflow resolution path; in practice both event types resolve the- user at routing time and pass it in."""if not untagged_followup:- assert posthog_user is not None, "app_mention path must always resolve a user before dispatch"_report_slack_mention_received(event, integration, slack_team_id, posthog_user=posthog_user)if _resolve_pending_repo_picker_from_followup(event, integration):return ROUTE_HANDLED_LOCALLY@@ -3223,7 +3218,7 @@ def _start_mention_workflow(integration_id=integration.id,slack_team_id=slack_team_id,slack_event_id=event_id,- user_id=posthog_user.id if posthog_user else None,+ user_id=posthog_user.id,untagged_followup=untagged_followup,untagged_followup_confirmed=untagged_followup_confirmed,is_ext_shared_channel=is_ext_shared_channel,diff --git a/products/slack_app/backend/tests/test_followup_forwarding.py b/products/slack_app/backend/tests/test_followup_forwarding.pyindex 13c0917c00da..c700801ed30e 100644--- a/products/slack_app/backend/tests/test_followup_forwarding.py+++ b/products/slack_app/backend/tests/test_followup_forwarding.py@@ -28,11 +28,14 @@ from products.slack_app.backend.models import SlackThreadTaskMappingfrom products.slack_app.backend.services.run_preferences import SLACK_DEFAULT_MODEL-def _make_inputs(integration_id: int, slack_team_id: str = "T_SLACK") -> PostHogCodeSlackMentionWorkflowInputs:+def _make_inputs(+ integration_id: int, user_id: int, slack_team_id: str = "T_SLACK"+) -> PostHogCodeSlackMentionWorkflowInputs:return PostHogCodeSlackMentionWorkflowInputs(event={"channel": "C123", "ts": "1234.5678", "user": "U_ALICE", "text": "<@BOT> do something"},integration_id=integration_id,slack_team_id=slack_team_id,+ user_id=user_id,)@@ -204,7 +207,7 @@ class TestCreatePostHogCodeTaskForRepoActivity(TestCase):}mock_slack_cls.return_value = mock_slack_instance- inputs = _make_inputs(self.integration.id)+ inputs = _make_inputs(self.integration.id, self.user.id)create_posthog_code_task_for_repo_activity(inputs,"C123",@@ -263,6 +266,7 @@ class TestCreatePostHogCodeTaskForRepoActivity(TestCase):event=event,integration_id=self.integration.id,slack_team_id="T_SLACK",+ user_id=self.user.id,)with (@@ -324,7 +328,7 @@ class TestCreatePostHogCodeTaskForRepoActivity(TestCase):mentioning_slack_user_id="U_ALICE",)- inputs = _make_inputs(self.integration.id)+ inputs = _make_inputs(self.integration.id, self.user.id)create_posthog_code_task_for_repo_activity(inputs,"C123",@@ -359,6 +363,7 @@ class TestCreatePostHogCodeTaskForRepoActivity(TestCase):integration_id=self.integration.id,slack_team_id="T_SLACK",slack_event_id="Ev01234567",+ user_id=self.user.id,)create_posthog_code_task_for_repo_activity(inputs,@@ -384,7 +389,7 @@ class TestCreatePostHogCodeTaskForRepoActivity(TestCase):}mock_slack_cls.return_value = mock_slack_instance- inputs = _make_inputs(self.integration.id)+ inputs = _make_inputs(self.integration.id, self.user.id)create_posthog_code_task_for_repo_activity(inputs,"C123",@@ -415,7 +420,7 @@ class TestCreatePostHogCodeTaskForRepoActivity(TestCase):}mock_slack_cls.return_value = mock_slack_instance- inputs = _make_inputs(self.integration.id)+ inputs = _make_inputs(self.integration.id, self.user.id)create_posthog_code_task_for_repo_activity(inputs,"C123",@@ -442,7 +447,7 @@ class TestCreatePostHogCodeTaskForRepoActivity(TestCase):}mock_slack_cls.return_value = mock_slack_instance- inputs = _make_inputs(self.integration.id)+ inputs = _make_inputs(self.integration.id, self.user.id)create_posthog_code_task_for_repo_activity(inputs,"C123",@@ -481,7 +486,7 @@ class TestCreatePostHogCodeTaskForRepoActivity(TestCase):}mock_slack_cls.return_value = mock_slack_instance- inputs = _make_inputs(self.integration.id)+ inputs = _make_inputs(self.integration.id, self.user.id)create_posthog_code_task_for_repo_activity(inputs,"C123",@@ -517,7 +522,7 @@ class TestCreatePostHogCodeTaskForRepoActivity(TestCase):}mock_slack_cls.return_value = mock_slack_instance- inputs = _make_inputs(self.integration.id)+ inputs = _make_inputs(self.integration.id, self.user.id)create_posthog_code_task_for_repo_activity(inputs,"C123",@@ -555,7 +560,7 @@ class TestCreatePostHogCodeTaskForRepoActivity(TestCase):}mock_slack_cls.return_value = mock_slack_instance- inputs = _make_inputs(self.integration.id)+ inputs = _make_inputs(self.integration.id, self.user.id)create_posthog_code_task_for_repo_activity(inputs,"C123",@@ -587,7 +592,7 @@ class TestCreatePostHogCodeTaskForRepoActivity(TestCase):mock_slack_instance = MagicMock()mock_slack_cls.return_value = mock_slack_instance- inputs = _make_inputs(self.integration.id)+ inputs = _make_inputs(self.integration.id, self.user.id)create_posthog_code_task_for_repo_activity(inputs,"C123",@@ -651,7 +656,7 @@ class TestForwardPostHogCodeFollowupActivity(TestCase):)def test_no_mapping_returns_false(self):- inputs = _make_inputs(self.integration.id)+ inputs = _make_inputs(self.integration.id, self.user.id)result = forward_posthog_code_followup_activity(inputs, "C123", "1234.5678", "U_ALICE", "do something", "1234.5679")@@ -668,7 +673,7 @@ class TestForwardPostHogCodeFollowupActivity(TestCase):mock_slack_instance = MagicMock()mock_slack_cls.return_value = mock_slack_instance- inputs = _make_inputs(self.integration.id)+ inputs = _make_inputs(self.integration.id, self.user.id)result = forward_posthog_code_followup_activity(inputs, "C123", "1234.5678", "U_ALICE", "do something", "1234.5679")@@ -687,7 +692,7 @@ class TestForwardPostHogCodeFollowupActivity(TestCase):mock_slack_instance = MagicMock()mock_slack_cls.return_value = mock_slack_instance- inputs = _make_inputs(self.integration.id)+ inputs = _make_inputs(self.integration.id, self.user.id)result = forward_posthog_code_followup_activity(inputs, "C123", "1234.5678", "U_ALICE", "<@BOT> do something", "1234.5679")@@ -743,6 +748,7 @@ class TestForwardPostHogCodeFollowupActivity(TestCase):event=event,integration_id=self.integration.id,slack_team_id="T_SLACK",+ user_id=self.user.id,)with (@@ -778,7 +784,7 @@ class TestForwardPostHogCodeFollowupActivity(TestCase):self._create_mapping()mock_slack_cls.return_value = MagicMock()- inputs = _make_inputs(self.integration.id)+ inputs = _make_inputs(self.integration.id, self.user.id)result = forward_posthog_code_followup_activity(inputs, "C123", "1234.5678", "U_ALICE", "<@BOT> clone org/repo and open PR", "1234.5679")@@ -796,7 +802,7 @@ class TestForwardPostHogCodeFollowupActivity(TestCase):self._create_mapping()mock_slack_cls.return_value = MagicMock()- inputs = _make_inputs(self.integration.id)+ inputs = _make_inputs(self.integration.id, self.user.id)forward_posthog_code_followup_activity(inputs, "C123", "1234.5678", "U_ALICE", "<@BOT> fix the tests", "1234.5679")@@ -824,7 +830,7 @@ class TestForwardPostHogCodeFollowupActivity(TestCase):self._create_mapping()mock_slack_cls.return_value = MagicMock()- inputs = _make_inputs(self.integration.id)+ inputs = _make_inputs(self.integration.id, self.user.id)result = forward_posthog_code_followup_activity(inputs, "C123", "1234.5678", "U_ALICE", "<@BOT> I connected GitHub, try again", "1234.5679")@@ -851,7 +857,7 @@ class TestForwardPostHogCodeFollowupActivity(TestCase):mock_slack_instance = MagicMock()mock_slack_cls.return_value = mock_slack_instance- inputs = _make_inputs(self.integration.id)+ inputs = _make_inputs(self.integration.id, self.user.id)result = forward_posthog_code_followup_activity(inputs, "C123", "1234.5678", "U_BOB", "<@BOT> do something", "1234.5679")@@ -870,7 +876,7 @@ class TestForwardPostHogCodeFollowupActivity(TestCase):mock_slack_instance = MagicMock()mock_slack_cls.return_value = mock_slack_instance- inputs = _make_inputs(self.integration.id)+ inputs = _make_inputs(self.integration.id, self.user.id)result = forward_posthog_code_followup_activity(inputs, "C123", "1234.5678", "U_ALICE", "<@BOT> do something", "1234.5679")@@ -888,7 +894,7 @@ class TestForwardPostHogCodeFollowupActivity(TestCase):mock_slack_instance = MagicMock()mock_slack_cls.return_value = mock_slack_instance- inputs = _make_inputs(self.integration.id)+ inputs = _make_inputs(self.integration.id, self.user.id)result = forward_posthog_code_followup_activity(inputs, "C123", "1234.5678", "U_ALICE", "<@BOT> do something", "1234.5679")@@ -909,7 +915,7 @@ class TestForwardPostHogCodeFollowupActivity(TestCase):mock_slack_instance = MagicMock()mock_slack_cls.return_value = mock_slack_instance- inputs = _make_inputs(self.integration.id)+ inputs = _make_inputs(self.integration.id, self.user.id)result = forward_posthog_code_followup_activity(inputs, "C123", "1234.5678", "U_BOB", "do something", "1234.5679")@@ -930,7 +936,7 @@ class TestForwardPostHogCodeFollowupActivity(TestCase):mock_slack_cls.return_value = mock_slack_instancemock_resolve.return_value = SlackUserContext(user=bob, slack_email="[email protected]")- inputs = _make_inputs(self.integration.id)+ inputs = _make_inputs(self.integration.id, self.user.id)result = forward_posthog_code_followup_activity(inputs, "C123", "1234.5678", "U_BOB", "<@BOT> please retry the build", "1234.5679")@@ -959,7 +965,7 @@ class TestForwardPostHogCodeFollowupActivity(TestCase):mock_slack_cls.return_value = MagicMock()mock_resolve.return_value = SlackUserContext(user=bob, slack_email="[email protected]")- inputs = _make_inputs(self.integration.id)+ inputs = _make_inputs(self.integration.id, self.user.id)forward_posthog_code_followup_activity(inputs, "C123", "1234.5678", "U_BOB", "<@BOT> ping", "1234.5679")mock_signal.assert_called_once()@@ -978,7 +984,7 @@ class TestForwardPostHogCodeFollowupActivity(TestCase):mock_slack_instance = MagicMock()mock_slack_cls.return_value = mock_slack_instance- inputs = _make_inputs(self.integration.id)+ inputs = _make_inputs(self.integration.id, self.user.id)result = forward_posthog_code_followup_activity(inputs, "C123", "1234.5678", "U_BOB", "<@BOT> sneak in", "1234.5679")@@ -1003,7 +1009,7 @@ class TestForwardPostHogCodeFollowupActivity(TestCase):mock_slack_cls.return_value = MagicMock()mock_resolve.return_value = SlackUserContext(user=bob, slack_email="[email protected]")- inputs = _make_inputs(self.integration.id)+ inputs = _make_inputs(self.integration.id, self.user.id)result = forward_posthog_code_followup_activity(inputs, "C123", "1234.5678", "U_BOB", "<@BOT> fix the tests", "1234.5679")@@ -1028,7 +1034,7 @@ class TestForwardPostHogCodeFollowupActivity(TestCase):self._create_mapping()mock_slack_cls.return_value = MagicMock()- inputs = _make_inputs(self.integration.id)+ inputs = _make_inputs(self.integration.id, self.user.id)result = forward_posthog_code_followup_activity(inputs, "C123", "1234.5678", "U_ALICE", "<@BOT> fix the tests", "1234.5679")@@ -1050,7 +1056,7 @@ class TestForwardPostHogCodeFollowupActivity(TestCase):mock_slack_instance = MagicMock()mock_slack_cls.return_value = mock_slack_instance- inputs = _make_inputs(self.integration.id)+ inputs = _make_inputs(self.integration.id, self.user.id)result = forward_posthog_code_followup_activity(inputs, "C123", "1234.5678", "U_ALICE", "do something", "1234.5679")@@ -1067,7 +1073,7 @@ class TestForwardPostHogCodeFollowupActivity(TestCase):mock_slack_instance = MagicMock()mock_slack_cls.return_value = mock_slack_instance- inputs = _make_inputs(self.integration.id)+ inputs = _make_inputs(self.integration.id, self.user.id)result = forward_posthog_code_followup_activity(inputs, "C123", "1234.5678", "U_ALICE", "<@BOT> do something", "1234.5679")@@ -1110,6 +1116,7 @@ class TestForwardPostHogCodeFollowupActivity(TestCase):event=event,integration_id=self.integration.id,slack_team_id="T_SLACK",+ user_id=self.user.id,)with (@@ -1173,6 +1180,7 @@ class TestForwardPostHogCodeFollowupActivity(TestCase):event=event,integration_id=self.integration.id,slack_team_id="T_SLACK",+ user_id=self.user.id,)with (@@ -1203,7 +1211,7 @@ class TestForwardPostHogCodeFollowupActivity(TestCase):mock_slack_instance = MagicMock()mock_slack_cls.return_value = mock_slack_instance- inputs = _make_inputs(self.integration.id)+ inputs = _make_inputs(self.integration.id, self.user.id)result = forward_posthog_code_followup_activity(inputs, "C123", "1234.5678", "U_ALICE", "<@BOT> do something", "1234.5679")@@ -1226,6 +1234,7 @@ class TestEnforcePostHogCodeBillingQuotaActivity(TestCase):def setUp(self):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={})@patch("posthog.models.integration.SlackIntegration")@@ -1234,7 +1243,7 @@ class TestEnforcePostHogCodeBillingQuotaActivity(TestCase):mock_slack_instance = MagicMock()mock_slack_cls.return_value = mock_slack_instance- inputs = _make_inputs(self.integration.id)+ inputs = _make_inputs(self.integration.id, self.user.id)blocked = enforce_posthog_code_billing_quota_activity(inputs,"C123",@@ -1251,7 +1260,7 @@ class TestEnforcePostHogCodeBillingQuotaActivity(TestCase):mock_slack_instance = MagicMock()mock_slack_cls.return_value = mock_slack_instance- inputs = _make_inputs(self.integration.id)+ inputs = _make_inputs(self.integration.id, self.user.id)blocked = enforce_posthog_code_billing_quota_activity(inputs,"C123",diff --git a/products/slack_app/backend/tests/test_guess_repository.py b/products/slack_app/backend/tests/test_guess_repository.pyindex f8314fe90224..ab14b90f595b 100644--- a/products/slack_app/backend/tests/test_guess_repository.py+++ b/products/slack_app/backend/tests/test_guess_repository.py@@ -451,6 +451,7 @@ class TestHandleRulesCommandActivity:event={"text": text, "channel": self.channel, "thread_ts": self.thread_ts, "user": self.slack_user_id},integration_id=self.integration.id,slack_team_id="T12345",+ user_id=self.user.id,)@patch("posthog.models.integration.SlackIntegration")