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.

chore(slack-app): remove the old mention processing name and module (#118370)

Vojta Bartoš94bd40e50a4f
diff --git a/products/slack_app/backend/api.py b/products/slack_app/backend/api.py
index db7ff47ad694..62e1f556e136 100644
--- a/products/slack_app/backend/api.py
+++ b/products/slack_app/backend/api.py
@@ -138,7 +138,6 @@ from products.slack_app.backend.temporal import (
SlackAppMentionWorkflowInputs,
derive_mention_workflow_id,
)
-from products.slack_app.backend.temporal.posthog_code_slack_mention import SlackAppMentionProcessingWorkflow
from products.slack_app.backend.temporal.posthog_code_slack_mention_command import (
PostHogCodeSlackMentionCommandWorkflow,
)
@@ -147,6 +146,7 @@ from products.slack_app.backend.temporal.slack_app_mention import (
SlackAppMentionWorkflow,
derive_slack_app_mention_workflow_id,
)
+from products.slack_app.backend.temporal.slack_app_mention_processing import SlackAppMentionProcessingWorkflow
from products.slack_app.backend.temporal.types import SlackAppForkThreadInputs
logger = structlog.get_logger(__name__)
diff --git a/products/slack_app/backend/facade/temporal.py b/products/slack_app/backend/facade/temporal.py
index 00b6cc7ddb7d..5cfa6eb753d7 100644
--- a/products/slack_app/backend/facade/temporal.py
+++ b/products/slack_app/backend/facade/temporal.py
@@ -4,21 +4,17 @@ Kept apart from ``facade/api.py`` so ``temporalio`` stays off the light data-sur
"""
from products.slack_app.backend.temporal import SLACK_APP_ACTIVITIES
-from products.slack_app.backend.temporal.posthog_code_slack_mention import (
- LegacyPostHogCodeSlackMentionWorkflow,
- SlackAppMentionProcessingWorkflow,
-)
from products.slack_app.backend.temporal.posthog_code_slack_mention_command import (
PostHogCodeSlackMentionCommandWorkflow,
)
from products.slack_app.backend.temporal.posthog_slack_inbox_onboarding import PostHogSlackInboxOnboardingWorkflow
from products.slack_app.backend.temporal.slack_app_fork import SlackAppForkThreadWorkflow
from products.slack_app.backend.temporal.slack_app_mention import SlackAppMentionWorkflow
+from products.slack_app.backend.temporal.slack_app_mention_processing import SlackAppMentionProcessingWorkflow
from products.slack_app.backend.temporal.slack_app_unfurl_charts import SlackAppUnfurlChartsWorkflow
WORKFLOWS = [
SlackAppMentionProcessingWorkflow,
- LegacyPostHogCodeSlackMentionWorkflow,
SlackAppMentionWorkflow,
PostHogCodeSlackMentionCommandWorkflow,
SlackAppForkThreadWorkflow,
diff --git a/products/slack_app/backend/temporal/README.md b/products/slack_app/backend/temporal/README.md
index e71ea355a4cd..f077719ca945 100644
--- a/products/slack_app/backend/temporal/README.md
+++ b/products/slack_app/backend/temporal/README.md
@@ -12,5 +12,5 @@ For general Temporal conventions, read [`posthog/temporal/AGENTS.md`](../../../.
Quick sanity checks that `discover_posthog_code_repository_via_agent_activity` is working after a deploy:
-- **Temporal UI.** Filter `slack-app-mention-processing` runs. Runs that started before the rename use `posthog-code-slack-mention-processing`. Healthy: `discover_posthog_code_repository_via_agent_activity` followed by `create_posthog_code_task_for_repo_activity`. Picker-fallback (`post_posthog_code_repo_picker_activity` after the agent) is fine occasionally, alarming if dominant.
+- **Temporal UI.** Filter `slack-app-mention-processing` runs. Healthy: `discover_posthog_code_repository_via_agent_activity` followed by `create_posthog_code_task_for_repo_activity`. Picker-fallback (`post_posthog_code_repo_picker_activity` after the agent) is fine occasionally, alarming if dominant.
- **Slack smoke test.** In a channel with the app and >1 connected repo, `@PostHog Desktop` a message that doesn't name a repo (e.g. "investigate the failing checkout test"). A 🔍 reaction within ~10–60s means the agent ran; the task starting on a real repo means it picked one. A picker on a clear request = something's off.
diff --git a/products/slack_app/backend/temporal/__init__.py b/products/slack_app/backend/temporal/__init__.py
index 33b7a7c635d5..7afeb10d7537 100644
--- a/products/slack_app/backend/temporal/__init__.py
+++ b/products/slack_app/backend/temporal/__init__.py
@@ -1,7 +1,7 @@
"""Temporal activities for the PostHog Slack App.
Activities living here run on ``settings.TASKS_TASK_QUEUE`` and are imported by
-``posthog_code_slack_mention.py`` and ``posthog_code_slack_mention_command.py``
+``slack_app_mention_processing.py`` and ``posthog_code_slack_mention_command.py``
in this package at module load time.
"""
diff --git a/products/slack_app/backend/temporal/eval_slack_repo_selection.py b/products/slack_app/backend/temporal/eval_slack_repo_selection.py
index 58849652dd61..db767f149b08 100644
--- a/products/slack_app/backend/temporal/eval_slack_repo_selection.py
+++ b/products/slack_app/backend/temporal/eval_slack_repo_selection.py
@@ -6,7 +6,7 @@ actual Slack traffic. Each case declares its expected terminal stage/outcome;
the eval prints a pass/fail summary so you can re-run after touching repo selection
and spot regressions immediately.
-Lives next to the Slack workflow it exercises (`posthog_code_slack_mention.py`) rather
+Lives next to the Slack workflow it exercises (`slack_app_mention_processing.py`) rather
than in `posthog/management/commands/` because (a) it's co-located with the thing it
tests and (b) `products/slack_app/` can't tach-depend on `products/tasks/`, which the
eval needs to import from.
diff --git a/products/slack_app/backend/temporal/slack_app_mention.py b/products/slack_app/backend/temporal/slack_app_mention.py
index c9985544dafd..78dbac9d84fa 100644
--- a/products/slack_app/backend/temporal/slack_app_mention.py
+++ b/products/slack_app/backend/temporal/slack_app_mention.py
@@ -15,10 +15,7 @@ from products.slack_app.backend.temporal import (
mark_slack_app_message_queued_activity,
post_posthog_code_internal_error_activity,
)
-from products.slack_app.backend.temporal.posthog_code_slack_mention import (
- LegacyPostHogCodeSlackMentionWorkflow,
- SlackAppMentionProcessingWorkflow,
-)
+from products.slack_app.backend.temporal.slack_app_mention_processing import SlackAppMentionProcessingWorkflow
from products.slack_app.backend.temporal.types import (
PostHogCodeSlackMentionWorkflowInputs,
SlackAppMentionWorkflowInputs,
@@ -26,7 +23,7 @@ from products.slack_app.backend.temporal.types import (
)
SLACK_APP_MENTION_IDLE_TIMEOUT_SECONDS = 30
-# Temporal patch ID: runs that started a child before this patch replay the old child type name.
+# deprecate_patch keeps runs that recorded the rename marker replayable.
_PATCH_ID_MENTION_PROCESSING_RENAME = "slack-app-mention-processing-rename-2026-10"
# Dedup keys carried across continue_as_new. Bounded so the carry-over payload
# stays small; old keys only matter for Slack retries, which arrive within
@@ -181,11 +178,7 @@ class SlackAppMentionWorkflow(PostHogWorkflow):
ALLOW_DUPLICATE mirrors the standalone dispatch's reuse policy for
retries that outlive this instance's dedup keys.
"""
- child_type: type[SlackAppMentionProcessingWorkflow] = (
- SlackAppMentionProcessingWorkflow
- if workflow.patched(_PATCH_ID_MENTION_PROCESSING_RENAME)
- else LegacyPostHogCodeSlackMentionWorkflow
- )
+ workflow.deprecate_patch(_PATCH_ID_MENTION_PROCESSING_RENAME)
try:
# The default parent close policy (terminate) is deliberate: an
# operator killing this queue means "stop this conversation", so
@@ -193,7 +186,7 @@ class SlackAppMentionWorkflow(PostHogWorkflow):
# return, continue_as_new) never have a child in flight — the
# serial await completes it first.
await workflow.execute_child_workflow(
- child_type.run,
+ SlackAppMentionProcessingWorkflow.run,
message,
id=derive_mention_workflow_id(message),
id_reuse_policy=WorkflowIDReusePolicy.ALLOW_DUPLICATE,
diff --git a/products/slack_app/backend/temporal/posthog_code_slack_mention.py b/products/slack_app/backend/temporal/slack_app_mention_processing.py
similarity index 97%
rename from products/slack_app/backend/temporal/posthog_code_slack_mention.py
rename to products/slack_app/backend/temporal/slack_app_mention_processing.py
index 1931912200fb..af92ffb981e3 100644
--- a/products/slack_app/backend/temporal/posthog_code_slack_mention.py
+++ b/products/slack_app/backend/temporal/slack_app_mention_processing.py
@@ -373,12 +373,3 @@ async def _execute_posthog_code_agent_activity(activity_fn: Any, *args: Any) ->
heartbeat_timeout=timedelta(minutes=5),
retry_policy=RetryPolicy(maximum_attempts=1),
)
-
-
[email protected](name="posthog-code-slack-mention-processing")
-class LegacyPostHogCodeSlackMentionWorkflow(SlackAppMentionProcessingWorkflow):
- """Previous type name, kept registered until no execution of it remains in any region."""
-
- @workflow.run
- async def run(self, inputs: PostHogCodeSlackMentionWorkflowInputs) -> None:
- await super().run(inputs)
diff --git a/products/slack_app/backend/temporal/tests/activities/test_classify_message_is_agent_directed.py b/products/slack_app/backend/temporal/tests/activities/test_classify_message_is_agent_directed.py
index 7344f4f751e1..8aa8a5ce8674 100644
--- a/products/slack_app/backend/temporal/tests/activities/test_classify_message_is_agent_directed.py
+++ b/products/slack_app/backend/temporal/tests/activities/test_classify_message_is_agent_directed.py
@@ -4,7 +4,7 @@ from parameterized import parameterized
from products.slack_app.backend.services.slack_messages import SlackThreadMessage
from products.slack_app.backend.temporal.activities.classifiers import classify_message_is_agent_directed
-from products.slack_app.backend.temporal.posthog_code_slack_mention import POSTHOG_CODE_SLACK_MENTION_TIMEOUT_SECONDS
+from products.slack_app.backend.temporal.slack_app_mention_processing import POSTHOG_CODE_SLACK_MENTION_TIMEOUT_SECONDS
TASK_TITLE = "Fix the checkout button not firing autocapture events"
THREAD = [
diff --git a/products/slack_app/backend/temporal/tests/activities/test_classify_slack_app_model_override.py b/products/slack_app/backend/temporal/tests/activities/test_classify_slack_app_model_override.py
index a88ddf7bec5d..9cb25243ef2f 100644
--- a/products/slack_app/backend/temporal/tests/activities/test_classify_slack_app_model_override.py
+++ b/products/slack_app/backend/temporal/tests/activities/test_classify_slack_app_model_override.py
@@ -4,7 +4,7 @@ from parameterized import parameterized
from products.slack_app.backend.services.model_catalogue import ModelChoice
from products.slack_app.backend.temporal.activities.classifiers import classify_slack_app_model_override
-from products.slack_app.backend.temporal.posthog_code_slack_mention import POSTHOG_CODE_SLACK_MENTION_TIMEOUT_SECONDS
+from products.slack_app.backend.temporal.slack_app_mention_processing import POSTHOG_CODE_SLACK_MENTION_TIMEOUT_SECONDS
CHOICES = (
ModelChoice("claude", "claude-opus-5", "Claude Opus 5", ("low", "medium", "high", "max")),
diff --git a/products/slack_app/backend/temporal/tests/activities/test_classify_slack_app_project_route.py b/products/slack_app/backend/temporal/tests/activities/test_classify_slack_app_project_route.py
index 9748c41f0961..d0eba45f6261 100644
--- a/products/slack_app/backend/temporal/tests/activities/test_classify_slack_app_project_route.py
+++ b/products/slack_app/backend/temporal/tests/activities/test_classify_slack_app_project_route.py
@@ -8,7 +8,7 @@ from posthog.models.organization import Organization
from posthog.models.team.team import Team
from products.slack_app.backend.temporal.activities.classifiers import classify_slack_app_project_route
-from products.slack_app.backend.temporal.posthog_code_slack_mention import POSTHOG_CODE_SLACK_MENTION_TIMEOUT_SECONDS
+from products.slack_app.backend.temporal.slack_app_mention_processing import POSTHOG_CODE_SLACK_MENTION_TIMEOUT_SECONDS
def _project(*, team_id: int, integration_id: int, name: str) -> Integration:
diff --git a/products/slack_app/backend/temporal/tests/histories/mention_queue_with_rename_patch.json b/products/slack_app/backend/temporal/tests/histories/mention_queue_with_rename_patch.json
new file mode 100644
index 000000000000..3410198443e0
--- /dev/null
+++ b/products/slack_app/backend/temporal/tests/histories/mention_queue_with_rename_patch.json
@@ -0,0 +1,449 @@
+{
+ "events": [
+ {
+ "eventId": "1",
+ "eventTime": "2026-10-16T07:53:22.618Z",
+ "eventType": "EVENT_TYPE_WORKFLOW_EXECUTION_STARTED",
+ "workflowExecutionStartedEventAttributes": {
+ "workflowType": {
+ "name": "slack-app-mention"
+ },
+ "taskQueue": {
+ "name": "bdf989c0-f8df-4efd-8add-cf7dae2917d3"
+ },
+ "input": {
+ "payloads": [
+ {
+ "metadata": {
+ "encoding": "anNvbi9wbGFpbg=="
+ },
+ "data": "eyJwZW5kaW5nX21lc3NhZ2VzIjpbXSwicHJvY2Vzc2VkX2V2ZW50X2tleXMiOltdfQ=="
+ }
+ ]
+ },
+ "workflowExecutionTimeout": "315360000s",
+ "workflowRunTimeout": "315360000s",
+ "workflowTaskTimeout": "10s",
+ "originalExecutionRunId": "fa0b6fc9-70c5-43a2-bbec-6b71d7363bea",
+ "identity": "test-worker",
+ "firstExecutionRunId": "fa0b6fc9-70c5-43a2-bbec-6b71d7363bea",
+ "attempt": 1,
+ "firstWorkflowTaskBackoff": "0s",
+ "priority": {}
+ }
+ },
+ {
+ "eventId": "2",
+ "eventTime": "2026-10-16T07:53:22.618Z",
+ "eventType": "EVENT_TYPE_WORKFLOW_TASK_SCHEDULED",
+ "workflowTaskScheduledEventAttributes": {
+ "taskQueue": {
+ "name": "bdf989c0-f8df-4efd-8add-cf7dae2917d3"
+ },
+ "startToCloseTimeout": "10s",
+ "attempt": 1
+ }
+ },
+ {
+ "eventId": "3",
+ "eventTime": "2026-10-16T07:53:22.619Z",
+ "eventType": "EVENT_TYPE_WORKFLOW_EXECUTION_SIGNALED",
+ "workflowExecutionSignaledEventAttributes": {
+ "signalName": "new_message",
+ "input": {
+ "payloads": [
+ {
+ "metadata": {
+ "encoding": "anNvbi9wbGFpbg=="
+ },
+ "data": "eyJldmVudCI6eyJjaGFubmVsIjoiQzEiLCJ0ZXh0IjoiZml4IHRoZSBidWciLCJ0aHJlYWRfdHMiOiIxMDAuMCIsInRzIjoiMS4xIiwidXNlciI6IlUxIn0sImZvcmtfc291cmNlX2NoYW5uZWwiOm51bGwsImZvcmtfc291cmNlX21lc3NhZ2VfdHMiOm51bGwsImZvcmtfc291cmNlX3Rhc2tfaWQiOm51bGwsImZvcmtfc291cmNlX3RocmVhZF90cyI6bnVsbCwiaW50ZWdyYXRpb25faWQiOjEsImlzX2V4dF9zaGFyZWRfY2hhbm5lbCI6ZmFsc2UsInNsYWNrX2V2ZW50X2lkIjpudWxsLCJzbGFja190ZWFtX2lkIjoiVDEiLCJ1bnRhZ2dlZF9mb2xsb3d1cCI6ZmFsc2UsInVudGFnZ2VkX2ZvbGxvd3VwX2NvbmZpcm1lZCI6ZmFsc2UsInVzZXJfaWQiOjQyfQ=="
+ }
+ ]
+ },
+ "identity": "test-worker"
+ }
+ },
+ {
+ "eventId": "4",
+ "eventTime": "2026-10-16T07:53:22.619Z",
+ "eventType": "EVENT_TYPE_WORKFLOW_TASK_STARTED",
+ "workflowTaskStartedEventAttributes": {
+ "scheduledEventId": "2",
+ "identity": "test-worker",
+ "historySizeBytes": "797"
+ }
+ },
+ {
+ "eventId": "5",
+ "eventTime": "2026-10-16T07:53:22.627Z",
+ "eventType": "EVENT_TYPE_WORKFLOW_TASK_COMPLETED",
+ "workflowTaskCompletedEventAttributes": {
+ "scheduledEventId": "2",
+ "identity": "test-worker",
+ "binaryChecksum": "aee90271a67b51fdbabd76e52e8f72aa",
+ "sdkMetadata": {
+ "coreUsedFlags": [3, 1, 2],
+ "sdkName": "temporal-python",
+ "sdkVersion": "1.33.0"
+ },
+ "meteringMetadata": {}
+ }
+ },
+ {
+ "eventId": "6",
+ "eventTime": "2026-10-16T07:53:22.627Z",
+ "eventType": "EVENT_TYPE_ACTIVITY_TASK_SCHEDULED",
+ "activityTaskScheduledEventAttributes": {
+ "activityId": "1",
+ "activityType": {
+ "name": "mark_slack_app_message_processing_activity"
+ },
+ "taskQueue": {
+ "name": "bdf989c0-f8df-4efd-8add-cf7dae2917d3",
+ "kind": "TASK_QUEUE_KIND_NORMAL"
+ },
+ "header": {},
+ "input": {
+ "payloads": [
+ {
+ "metadata": {
+ "encoding": "anNvbi9wbGFpbg=="
+ },
+ "data": "eyJjaGFubmVsIjoiQzEiLCJpbnRlZ3JhdGlvbl9pZCI6MSwibWVzc2FnZV90cyI6IjEuMSIsInNsYWNrX3RlYW1faWQiOiJUMSJ9"
+ }
+ ]
+ },
+ "scheduleToCloseTimeout": "315360000s",
+ "scheduleToStartTimeout": "315360000s",
+ "startToCloseTimeout": "10s",
+ "heartbeatTimeout": "0s",
+ "workflowTaskCompletedEventId": "4",
+ "retryPolicy": {
+ "initialInterval": "1s",
+ "backoffCoefficient": 2.0,
+ "maximumInterval": "100s",
+ "maximumAttempts": 1
+ },
+ "priority": {}
+ }
+ },
+ {
+ "eventId": "7",
+ "eventTime": "2026-10-16T07:53:22.627Z",
+ "eventType": "EVENT_TYPE_ACTIVITY_TASK_STARTED",
+ "activityTaskStartedEventAttributes": {
+ "scheduledEventId": "6",
+ "identity": "test-worker",
+ "attempt": 1
+ }
+ },
+ {
+ "eventId": "8",
+ "eventTime": "2026-10-16T07:53:22.629Z",
+ "eventType": "EVENT_TYPE_ACTIVITY_TASK_COMPLETED",
+ "activityTaskCompletedEventAttributes": {
+ "result": {
+ "payloads": [
+ {
+ "metadata": {
+ "encoding": "YmluYXJ5L251bGw="
+ }
+ }
+ ]
+ },
+ "scheduledEventId": "6",
+ "startedEventId": "7",
+ "identity": "test-worker"
+ }
+ },
+ {
+ "eventId": "9",
+ "eventTime": "2026-10-16T07:53:22.629Z",
+ "eventType": "EVENT_TYPE_WORKFLOW_TASK_SCHEDULED",
+ "workflowTaskScheduledEventAttributes": {
+ "taskQueue": {
+ "name": "bdf989c0-f8df-4efd-8add-cf7dae2917d3"
+ },
+ "startToCloseTimeout": "10s",
+ "attempt": 1
+ }
+ },
+ {
+ "eventId": "10",
+ "eventTime": "2026-10-16T07:53:22.629Z",
+ "eventType": "EVENT_TYPE_WORKFLOW_TASK_STARTED",
+ "workflowTaskStartedEventAttributes": {
+ "scheduledEventId": "9",
+ "identity": "test-worker",
+ "historySizeBytes": "1375"
+ }
+ },
+ {
+ "eventId": "11",
+ "eventTime": "2026-10-16T07:53:22.631Z",
+ "eventType": "EVENT_TYPE_WORKFLOW_TASK_COMPLETED",
+ "workflowTaskCompletedEventAttributes": {
+ "scheduledEventId": "9",
+ "identity": "test-worker",
+ "binaryChecksum": "aee90271a67b51fdbabd76e52e8f72aa",
+ "sdkMetadata": {},
+ "meteringMetadata": {}
+ }
+ },
+ {
+ "eventId": "12",
+ "eventTime": "2026-10-16T07:53:22.631Z",
+ "eventType": "EVENT_TYPE_MARKER_RECORDED",
+ "markerRecordedEventAttributes": {
+ "markerName": "core_patch",
+ "details": {
+ "patch-data": {
+ "payloads": [
+ {
+ "metadata": {
+ "encoding": "anNvbi9wbGFpbg=="
+ },
+ "data": "eyJpZCI6InNsYWNrLWFwcC1tZW50aW9uLXByb2Nlc3NpbmctcmVuYW1lLTIwMjYtMTAiLCJkZXByZWNhdGVkIjpmYWxzZX0="
+ }
+ ]
+ }
+ },
+ "workflowTaskCompletedEventId": "10"
+ }
+ },
+ {
+ "eventId": "13",
+ "eventTime": "2026-10-16T07:53:22.631Z",
+ "eventType": "EVENT_TYPE_UPSERT_WORKFLOW_SEARCH_ATTRIBUTES",
+ "upsertWorkflowSearchAttributesEventAttributes": {
+ "workflowTaskCompletedEventId": "10",
+ "searchAttributes": {
+ "indexedFields": {
+ "TemporalChangeVersion": {
+ "metadata": {
+ "encoding": "anNvbi9wbGFpbg==",
+ "type": "S2V5d29yZExpc3Q="
+ },
+ "data": "WyJzbGFjay1hcHAtbWVudGlvbi1wcm9jZXNzaW5nLXJlbmFtZS0yMDI2LTEwIl0="
+ }
+ }
+ }
+ }
+ },
+ {
+ "eventId": "14",
+ "eventTime": "2026-10-16T07:53:22.631Z",
+ "eventType": "EVENT_TYPE_START_CHILD_WORKFLOW_EXECUTION_INITIATED",
+ "startChildWorkflowExecutionInitiatedEventAttributes": {
+ "namespace": "default",
+ "workflowId": "posthog-code-mention-T1:C1:1.1",
+ "workflowType": {
+ "name": "slack-app-mention-processing"
+ },
+ "taskQueue": {
+ "name": "bdf989c0-f8df-4efd-8add-cf7dae2917d3",
+ "kind": "TASK_QUEUE_KIND_NORMAL"
+ },
+ "input": {
+ "payloads": [
+ {
+ "metadata": {
+ "encoding": "anNvbi9wbGFpbg=="
+ },
+ "data": "eyJldmVudCI6eyJjaGFubmVsIjoiQzEiLCJ0ZXh0IjoiZml4IHRoZSBidWciLCJ0aHJlYWRfdHMiOiIxMDAuMCIsInRzIjoiMS4xIiwidXNlciI6IlUxIn0sImZvcmtfc291cmNlX2NoYW5uZWwiOm51bGwsImZvcmtfc291cmNlX21lc3NhZ2VfdHMiOm51bGwsImZvcmtfc291cmNlX3Rhc2tfaWQiOm51bGwsImZvcmtfc291cmNlX3RocmVhZF90cyI6bnVsbCwiaW50ZWdyYXRpb25faWQiOjEsImlzX2V4dF9zaGFyZWRfY2hhbm5lbCI6ZmFsc2UsInNsYWNrX2V2ZW50X2lkIjpudWxsLCJzbGFja190ZWFtX2lkIjoiVDEiLCJ1bnRhZ2dlZF9mb2xsb3d1cCI6ZmFsc2UsInVudGFnZ2VkX2ZvbGxvd3VwX2NvbmZpcm1lZCI6ZmFsc2UsInVzZXJfaWQiOjQyfQ=="
+ }
+ ]
+ },
+ "workflowExecutionTimeout": "3600s",
+ "workflowRunTimeout": "0s",
+ "workflowTaskTimeout": "10s",
+ "parentClosePolicy": "PARENT_CLOSE_POLICY_TERMINATE",
+ "workflowTaskCompletedEventId": "10",
+ "workflowIdReusePolicy": "WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE",
+ "header": {},
+ "memo": {},
+ "priority": {}
+ }
+ },
+ {
+ "eventId": "15",
+ "eventTime": "2026-10-16T07:53:22.632Z",
+ "eventType": "EVENT_TYPE_CHILD_WORKFLOW_EXECUTION_STARTED",
+ "childWorkflowExecutionStartedEventAttributes": {
+ "namespace": "default",
+ "initiatedEventId": "14",
+ "workflowExecution": {
+ "workflowId": "posthog-code-mention-T1:C1:1.1",
+ "runId": "d790f4e0-4ddd-46de-a2b6-d07880dec11a"
+ },
+ "workflowType": {
+ "name": "slack-app-mention-processing"
+ }
+ }
+ },
+ {
+ "eventId": "16",
+ "eventTime": "2026-10-16T07:53:22.632Z",
+ "eventType": "EVENT_TYPE_WORKFLOW_TASK_SCHEDULED",
+ "workflowTaskScheduledEventAttributes": {
+ "taskQueue": {
+ "name": "bdf989c0-f8df-4efd-8add-cf7dae2917d3"
+ },
+ "startToCloseTimeout": "10s",
+ "attempt": 1
+ }
+ },
+ {
+ "eventId": "17",
+ "eventTime": "2026-10-16T07:53:22.632Z",
+ "eventType": "EVENT_TYPE_WORKFLOW_TASK_STARTED",
+ "workflowTaskStartedEventAttributes": {
+ "scheduledEventId": "16",
+ "identity": "test-worker",
+ "historySizeBytes": "2550"
+ }
+ },
+ {
+ "eventId": "18",
+ "eventTime": "2026-10-16T07:53:22.633Z",
+ "eventType": "EVENT_TYPE_WORKFLOW_TASK_COMPLETED",
+ "workflowTaskCompletedEventAttributes": {
+ "scheduledEventId": "16",
+ "identity": "test-worker",
+ "binaryChecksum": "aee90271a67b51fdbabd76e52e8f72aa",
+ "sdkMetadata": {},
+ "meteringMetadata": {}
+ }
+ },
+ {
+ "eventId": "19",
+ "eventTime": "2026-10-16T07:53:22.649Z",
+ "eventType": "EVENT_TYPE_CHILD_WORKFLOW_EXECUTION_COMPLETED",
+ "childWorkflowExecutionCompletedEventAttributes": {
+ "result": {
+ "payloads": [
+ {
+ "metadata": {
+ "encoding": "YmluYXJ5L251bGw="
+ }
+ }
+ ]
+ },
+ "namespace": "default",
+ "workflowExecution": {
+ "workflowId": "posthog-code-mention-T1:C1:1.1",
+ "runId": "d790f4e0-4ddd-46de-a2b6-d07880dec11a"
+ },
+ "workflowType": {
+ "name": "slack-app-mention-processing"
+ },
+ "initiatedEventId": "14",
+ "startedEventId": "15"
+ }
+ },
+ {
+ "eventId": "20",
+ "eventTime": "2026-10-16T07:53:22.649Z",
+ "eventType": "EVENT_TYPE_WORKFLOW_TASK_SCHEDULED",
+ "workflowTaskScheduledEventAttributes": {
+ "taskQueue": {
+ "name": "bdf989c0-f8df-4efd-8add-cf7dae2917d3"
+ },
+ "startToCloseTimeout": "10s",
+ "attempt": 1
+ }
+ },
+ {
+ "eventId": "21",
+ "eventTime": "2026-10-16T07:53:22.649Z",
+ "eventType": "EVENT_TYPE_WORKFLOW_TASK_STARTED",
+ "workflowTaskStartedEventAttributes": {
+ "scheduledEventId": "20",
+ "identity": "test-worker",
+ "historySizeBytes": "2895"
+ }
+ },
+ {
+ "eventId": "22",
+ "eventTime": "2026-10-16T07:53:22.650Z",
+ "eventType": "EVENT_TYPE_WORKFLOW_TASK_COMPLETED",
+ "workflowTaskCompletedEventAttributes": {
+ "scheduledEventId": "20",
+ "identity": "test-worker",
+ "binaryChecksum": "aee90271a67b51fdbabd76e52e8f72aa",
+ "sdkMetadata": {},
+ "meteringMetadata": {}
+ }
+ },
+ {
+ "eventId": "23",
+ "eventTime": "2026-10-16T07:53:22.650Z",
+ "eventType": "EVENT_TYPE_TIMER_STARTED",
+ "timerStartedEventAttributes": {
+ "timerId": "2",
+ "startToFireTimeout": "30s",
+ "workflowTaskCompletedEventId": "21"
+ }
+ },
+ {
+ "eventId": "24",
+ "eventTime": "2026-10-16T07:53:52.650Z",
+ "eventType": "EVENT_TYPE_TIMER_FIRED",
+ "timerFiredEventAttributes": {
+ "timerId": "2",
+ "startedEventId": "23"
+ }
+ },
+ {
+ "eventId": "25",
+ "eventTime": "2026-10-16T07:53:52.650Z",
+ "eventType": "EVENT_TYPE_WORKFLOW_TASK_SCHEDULED",
+ "workflowTaskScheduledEventAttributes": {
+ "taskQueue": {
+ "name": "bdf989c0-f8df-4efd-8add-cf7dae2917d3"
+ },
+ "startToCloseTimeout": "10s",
+ "attempt": 1
+ }
+ },
+ {
+ "eventId": "26",
+ "eventTime": "2026-10-16T07:53:52.650Z",
+ "eventType": "EVENT_TYPE_WORKFLOW_TASK_STARTED",
+ "workflowTaskStartedEventAttributes": {
+ "scheduledEventId": "25",
+ "identity": "test-worker",
+ "historySizeBytes": "3128"
+ }
+ },
+ {
+ "eventId": "27",
+ "eventTime": "2026-10-16T07:53:52.651Z",
+ "eventType": "EVENT_TYPE_WORKFLOW_TASK_COMPLETED",
+ "workflowTaskCompletedEventAttributes": {
+ "scheduledEventId": "25",
+ "identity": "test-worker",
+ "binaryChecksum": "aee90271a67b51fdbabd76e52e8f72aa",
+ "sdkMetadata": {},
+ "meteringMetadata": {}
+ }
+ },
+ {
+ "eventId": "28",
+ "eventTime": "2026-10-16T07:53:52.651Z",
+ "eventType": "EVENT_TYPE_WORKFLOW_EXECUTION_COMPLETED",
+ "workflowExecutionCompletedEventAttributes": {
+ "result": {
+ "payloads": [
+ {
+ "metadata": {
+ "encoding": "YmluYXJ5L251bGw="
+ }
+ }
+ ]
+ },
+ "workflowTaskCompletedEventId": "26"
+ }
+ }
+ ]
+}
diff --git a/products/slack_app/backend/temporal/tests/test_replay.py b/products/slack_app/backend/temporal/tests/test_replay.py
new file mode 100644
index 000000000000..fc1b0cb4e4f4
--- /dev/null
+++ b/products/slack_app/backend/temporal/tests/test_replay.py
@@ -0,0 +1,23 @@
+from pathlib import Path
+
+import pytest
+
+from temporalio.client import WorkflowHistory
+from temporalio.worker import Replayer, UnsandboxedWorkflowRunner
+
+from products.slack_app.backend.temporal.slack_app_mention import SlackAppMentionWorkflow
+
+HISTORIES = sorted((Path(__file__).parent / "histories").glob("*.json"))
+
+
[email protected](params=HISTORIES, ids=[path.stem for path in HISTORIES])
+def history(request: pytest.FixtureRequest) -> WorkflowHistory:
+ return WorkflowHistory.from_json("slack-app-mention-replay", request.param.read_text())
+
+
+async def test_saved_history_replays(history: WorkflowHistory) -> None:
+ await Replayer(
+ workflows=[SlackAppMentionWorkflow],
+ workflow_runner=UnsandboxedWorkflowRunner(),
+ ).replay_workflow(history)
diff --git a/products/slack_app/backend/temporal/tests/test_posthog_code_slack_mention_workflow.py b/products/slack_app/backend/temporal/tests/test_slack_app_mention_processing_workflow.py
similarity index 68%
rename from products/slack_app/backend/temporal/tests/test_posthog_code_slack_mention_workflow.py
rename to products/slack_app/backend/temporal/tests/test_slack_app_mention_processing_workflow.py
index 15f91ff104ad..dd9f778b2e6e 100644
--- a/products/slack_app/backend/temporal/tests/test_posthog_code_slack_mention_workflow.py
+++ b/products/slack_app/backend/temporal/tests/test_slack_app_mention_processing_workflow.py
@@ -1,7 +1,7 @@
import pytest
from unittest.mock import patch
-from products.slack_app.backend.temporal import posthog_code_slack_mention
+from products.slack_app.backend.temporal import slack_app_mention_processing
from products.slack_app.backend.temporal.types import PostHogCodeSlackMentionWorkflowInputs
@@ -16,7 +16,7 @@ from products.slack_app.backend.temporal.types import PostHogCodeSlackMentionWor
],
)
async def test_untagged_followup_with_files_classifier_gating(text: str, expect_classifier: bool) -> None:
- workflow = posthog_code_slack_mention.SlackAppMentionProcessingWorkflow()
+ workflow = slack_app_mention_processing.SlackAppMentionProcessingWorkflow()
calls: list[str] = []
inputs = PostHogCodeSlackMentionWorkflowInputs(
event={
@@ -34,20 +34,22 @@ async def test_untagged_followup_with_files_classifier_gating(text: str, expect_
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:
+ if activity_fn is slack_app_mention_processing.enforce_posthog_code_billing_quota_activity:
return False
- if activity_fn is posthog_code_slack_mention.classify_untagged_followup_activity:
+ if activity_fn is slack_app_mention_processing.classify_untagged_followup_activity:
return True
- if activity_fn is posthog_code_slack_mention.request_untagged_followup_confirmation_activity:
+ if activity_fn is slack_app_mention_processing.request_untagged_followup_confirmation_activity:
return False
- if activity_fn is posthog_code_slack_mention.classify_slack_app_model_override_activity:
+ if activity_fn is slack_app_mention_processing.classify_slack_app_model_override_activity:
return None
- if activity_fn is posthog_code_slack_mention.forward_posthog_code_followup_activity:
+ if activity_fn is slack_app_mention_processing.forward_posthog_code_followup_activity:
return True
raise AssertionError(f"unexpected activity: {activity_fn.__name__}")
- with patch.object(posthog_code_slack_mention, "_execute_posthog_code_activity", side_effect=fake_execute_activity):
+ with patch.object(
+ slack_app_mention_processing, "_execute_posthog_code_activity", side_effect=fake_execute_activity
+ ):
await workflow.run(inputs)
expected = ["enforce_posthog_code_billing_quota_activity"]
@@ -67,7 +69,7 @@ async def test_untagged_followup_with_files_classifier_gating(text: str, expect_
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.SlackAppMentionProcessingWorkflow()
+ workflow = slack_app_mention_processing.SlackAppMentionProcessingWorkflow()
calls: list[str] = []
inputs = PostHogCodeSlackMentionWorkflowInputs(
event={"channel": "C123", "ts": "1234.5679", "user": "U_BOB", "text": "and the export filter too"},
@@ -80,15 +82,17 @@ async def test_confirmed_untagged_followup_skips_the_classifier_and_the_prompt()
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:
+ if activity_fn is slack_app_mention_processing.enforce_posthog_code_billing_quota_activity:
return False
- if activity_fn is posthog_code_slack_mention.classify_slack_app_model_override_activity:
+ if activity_fn is slack_app_mention_processing.classify_slack_app_model_override_activity:
return None
- if activity_fn is posthog_code_slack_mention.forward_posthog_code_followup_activity:
+ if activity_fn is slack_app_mention_processing.forward_posthog_code_followup_activity:
return True
raise AssertionError(f"unexpected activity: {activity_fn.__name__}")
- with patch.object(posthog_code_slack_mention, "_execute_posthog_code_activity", side_effect=fake_execute_activity):
+ with patch.object(
+ slack_app_mention_processing, "_execute_posthog_code_activity", side_effect=fake_execute_activity
+ ):
await workflow.run(inputs)
assert calls == [
diff --git a/products/slack_app/backend/temporal/tests/test_slack_app_mention_workflow.py b/products/slack_app/backend/temporal/tests/test_slack_app_mention_workflow.py
index 58daf65808dc..93868c4caa2b 100644
--- a/products/slack_app/backend/temporal/tests/test_slack_app_mention_workflow.py
+++ b/products/slack_app/backend/temporal/tests/test_slack_app_mention_workflow.py
@@ -7,19 +7,14 @@ from typing import Any, Literal
import pytest
from temporalio import activity
-from temporalio.api.enums.v1 import EventType
-from temporalio.client import WorkflowHistory
from temporalio.common import WorkflowIDConflictPolicy, WorkflowIDReusePolicy
from temporalio.testing import WorkflowEnvironment
-from temporalio.worker import Replayer, UnsandboxedWorkflowRunner, Worker
+from temporalio.worker import UnsandboxedWorkflowRunner, Worker
from products.slack_app.backend.services.slack_messages import SlackThreadMessage
from products.slack_app.backend.temporal import derive_mention_workflow_id, slack_app_mention
-from products.slack_app.backend.temporal.posthog_code_slack_mention import (
- LegacyPostHogCodeSlackMentionWorkflow,
- SlackAppMentionProcessingWorkflow,
-)
from products.slack_app.backend.temporal.slack_app_mention import SlackAppMentionWorkflow
+from products.slack_app.backend.temporal.slack_app_mention_processing import SlackAppMentionProcessingWorkflow
from products.slack_app.backend.temporal.types import (
PostHogCodeRepoCascadeOutcome,
PostHogCodeSlackMentionWorkflowInputs,
@@ -331,11 +326,7 @@ class _Harness:
self._worker_cm = Worker(
self.env.client,
task_queue=self.task_queue,
- workflows=[
- SlackAppMentionWorkflow,
- SlackAppMentionProcessingWorkflow,
- LegacyPostHogCodeSlackMentionWorkflow,
- ],
+ workflows=[SlackAppMentionWorkflow, SlackAppMentionProcessingWorkflow],
activities=_fake_activities(self.rec),
workflow_runner=UnsandboxedWorkflowRunner(),
)
@@ -507,42 +498,6 @@ async def test_untagged_followup_forwards_without_task_creation_or_reactions():
assert rec.processing_marked == []
-def _child_workflow_types(history: WorkflowHistory) -> list[str]:
- return [
- event.start_child_workflow_execution_initiated_event_attributes.workflow_type.name
- for event in history.events
- if event.event_type == EventType.EVENT_TYPE_START_CHILD_WORKFLOW_EXECUTION_INITIATED
- ]
-
-
-async def test_child_type_rename_replays_runs_started_before_the_patch(monkeypatch):
- original_patched = slack_app_mention.workflow.patched
-
- def legacy_patched(patch_id: str) -> bool:
- if patch_id == slack_app_mention._PATCH_ID_MENTION_PROCESSING_RENAME:
- return False
- return original_patched(patch_id)
-
- rec = _Recorder()
- async with _Harness(rec) as h:
- monkeypatch.setattr(slack_app_mention.workflow, "patched", legacy_patched)
- legacy_handle = await _signal_with_start(h.env, h.task_queue, f"wf-{uuid.uuid4()}", _message("1.1"))
- await asyncio.wait_for(legacy_handle.result(), timeout=30)
- legacy_history = await legacy_handle.fetch_history()
-
- monkeypatch.setattr(slack_app_mention.workflow, "patched", original_patched)
- new_handle = await _signal_with_start(h.env, h.task_queue, f"wf-{uuid.uuid4()}", _message("1.2"))
- await asyncio.wait_for(new_handle.result(), timeout=30)
- new_history = await new_handle.fetch_history()
-
- assert _child_workflow_types(legacy_history) == ["posthog-code-slack-mention-processing"]
- assert _child_workflow_types(new_history) == ["slack-app-mention-processing"]
- replayer = Replayer(workflows=[SlackAppMentionWorkflow], workflow_runner=UnsandboxedWorkflowRunner())
- await replayer.replay_workflow(legacy_history)
- await replayer.replay_workflow(new_history)
-
-
@pytest.mark.asyncio
async def test_idle_exit_then_signal_with_start_processes_in_fresh_run():
rec = _Recorder()