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): retire drained temporal patches (#120291)

Vojta Bartošd0aefd6a1419
diff --git a/products/slack_app/backend/temporal/slack_app_mention.py b/products/slack_app/backend/temporal/slack_app_mention.py
index f0fbaff4725d..10a33b88be39 100644
--- a/products/slack_app/backend/temporal/slack_app_mention.py
+++ b/products/slack_app/backend/temporal/slack_app_mention.py
@@ -15,7 +15,6 @@ 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.activities.task_creation import MENTION_WORKFLOW_ID_PREFIX
from products.slack_app.backend.temporal.slack_app_mention_processing import SlackAppMentionProcessingWorkflow
from products.slack_app.backend.temporal.types import (
PostHogCodeSlackMentionWorkflowInputs,
@@ -24,11 +23,8 @@ from products.slack_app.backend.temporal.types import (
)
SLACK_APP_MENTION_IDLE_TIMEOUT_SECONDS = 30
-# deprecate_patch keeps runs that recorded the rename marker replayable.
-_PATCH_ID_MENTION_PROCESSING_RENAME = "slack-app-mention-processing-rename-2026-10"
-# Runs that started a child before this patch replay the child under its legacy workflow ID.
+# The legacy child workflow ID branch is gone. deprecate_patch keeps runs that recorded the marker replayable.
_PATCH_ID_MENTION_PROCESSING_ID_RENAME = "slack-app-mention-processing-id-rename-2026-10"
-_LEGACY_MENTION_WORKFLOW_ID_PREFIX = "posthog-code-mention-"
# 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
# minutes of the original event.
@@ -97,10 +93,6 @@ class SlackAppMentionWorkflow(PostHogWorkflow):
def _seed(self, inputs: SlackAppMentionWorkflowInputs) -> None:
for key in inputs.processed_event_keys:
- # Keys carried over by continue_as_new before the ID rename use the legacy prefix.
- # Map them to the current prefix so that a Slack retry of a carried message stays deduped.
- if key.startswith(_LEGACY_MENTION_WORKFLOW_ID_PREFIX):
- key = MENTION_WORKFLOW_ID_PREFIX + key.removeprefix(_LEGACY_MENTION_WORKFLOW_ID_PREFIX)
self._seen_keys[key] = None
for message in inputs.pending_messages:
self._seen_keys.setdefault(derive_mention_workflow_id(message), None)
@@ -186,10 +178,8 @@ class SlackAppMentionWorkflow(PostHogWorkflow):
ALLOW_DUPLICATE mirrors the standalone dispatch's reuse policy for
retries that outlive this instance's dedup keys.
"""
- workflow.deprecate_patch(_PATCH_ID_MENTION_PROCESSING_RENAME)
+ workflow.deprecate_patch(_PATCH_ID_MENTION_PROCESSING_ID_RENAME)
child_id = derive_mention_workflow_id(message)
- if not workflow.patched(_PATCH_ID_MENTION_PROCESSING_ID_RENAME):
- child_id = _LEGACY_MENTION_WORKFLOW_ID_PREFIX + child_id.removeprefix(MENTION_WORKFLOW_ID_PREFIX)
try:
# The default parent close policy (terminate) is deliberate: an
# operator killing this queue means "stop this conversation", so
diff --git a/products/slack_app/backend/temporal/slack_app_mention_processing.py b/products/slack_app/backend/temporal/slack_app_mention_processing.py
index 7d18c0417868..21941eabfbf7 100644
--- a/products/slack_app/backend/temporal/slack_app_mention_processing.py
+++ b/products/slack_app/backend/temporal/slack_app_mention_processing.py
@@ -43,17 +43,14 @@ if TYPE_CHECKING:
POSTHOG_CODE_SLACK_MENTION_TIMEOUT_SECONDS = 10 * 60
POSTHOG_CODE_SLACK_PICKER_TIMEOUT_MINUTES = 15
-# Temporal patch ID — an arbitrary string recorded in workflow history. The gate has
+# Temporal patch IDs — arbitrary strings recorded in workflow history. These gates 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, so the pre-patch histories are gone within
-# hours of a deploy. The branch is gone and only `deprecate_patch` remains, keeping the
-# recorded marker compatible for executions in flight across the deploy that removes the
-# branch. Standard two-step Temporal patch lifecycle: the call comes out once the
+# hours of a deploy. The old branches are gone and only `deprecate_patch` remains, keeping the
+# recorded markers compatible for executions in flight across the deploy that removes the
+# branches. Standard two-step Temporal patch lifecycle: the calls come out once the
# histories that recorded a plain marker have drained as well.
-_PATCH_ID_MODEL_ROUTER = "slack-app-model-router-v1"
-# Histories recorded without this marker replay `_prework_in_sequence`.
_PATCH_ID_PARALLEL_PREWORK = "slack-app-parallel-prework-v1"
-# Histories recorded without this marker offer the picker after a usage-limited discovery.
_PATCH_ID_REPO_SELECTION_USAGE_LIMIT = "slack-app-repo-selection-usage-limit-v1"
@@ -107,10 +104,8 @@ class SlackAppMentionProcessingWorkflow(PostHogWorkflow):
if blocked:
return
- if workflow.patched(_PATCH_ID_PARALLEL_PREWORK):
- prework = await _prework_in_parallel(inputs, channel, thread_ts, slack_user_id)
- else:
- prework = await _prework_in_sequence(inputs, channel, thread_ts, slack_user_id)
+ workflow.deprecate_patch(_PATCH_ID_PARALLEL_PREWORK)
+ prework = await _prework_in_parallel(inputs, channel, thread_ts, slack_user_id)
if prework is None:
return
inputs = prework.inputs
@@ -170,10 +165,11 @@ class SlackAppMentionProcessingWorkflow(PostHogWorkflow):
repository = outcome.repository
elif outcome.status == "no_match":
repository = None
- elif workflow.patched(_PATCH_ID_REPO_SELECTION_USAGE_LIMIT) and outcome.usage_limited:
- # The activity told the thread the team is out of credits. A picked repo would fail the same way.
- return
else:
+ workflow.deprecate_patch(_PATCH_ID_REPO_SELECTION_USAGE_LIMIT)
+ if outcome.usage_limited:
+ # The activity told the thread the team is out of credits. A picked repo would fail the same way.
+ return
# Agent crashed/timed out/hallucinated — italicize its reason
# above the picker guidance so the user sees why.
picker_guidance = f"_{outcome.reason}_\n\n{POSTHOG_CODE_SLACK_MENTION_PICKER_GUIDANCE}"
@@ -202,7 +198,6 @@ class SlackAppMentionProcessingWorkflow(PostHogWorkflow):
repository = self._selected_repo
# After repo selection, so the repository can inform the pick.
- workflow.deprecate_patch(_PATCH_ID_MODEL_ROUTER)
model_override = await _execute_posthog_code_activity(
classify_slack_app_model_router_activity,
SlackAppModelRouterInput(
@@ -371,76 +366,18 @@ async def _apply_project_route(
return None if blocked else inputs
-async def _prework_in_sequence(
- inputs: PostHogCodeSlackMentionWorkflowInputs, channel: str, thread_ts: str, slack_user_id: str
-) -> _NewThreadPrework | None:
- """The command order of histories recorded before `_PATCH_ID_PARALLEL_PREWORK`."""
- # Untagged thread replies face the Haiku classifier before any
- # forward. The webhook handler punted on this so its 3-second ack
- # budget stays unencumbered; here we run it under Temporal's retry
- # policy. Drop on chitchat or any failure (default-deny).
- # File-only replies skip the classifier: there is no text to
- # 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.
- unconfirmed_followup = inputs.untagged_followup and not inputs.untagged_followup_confirmed
- if unconfirmed_followup and not _is_file_only_followup(inputs.event):
- if not await _untagged_followup_is_agent_directed(inputs, channel, thread_ts, slack_user_id):
- return None
-
- # 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 unconfirmed_followup and await _awaiting_followup_confirmation(inputs, channel, thread_ts, slack_user_id):
- return None
-
- # Read a model or effort request ("use fable for this one", "actually run
- # this on opus") out of the message. Classified above the follow-up/new-task
- # split because the mapping lookup that tells the two apart lives inside the
- # follow-up activity: one call here serves whichever path the message takes,
- # and recording the choice in history once stops a retry of either activity
- # from landing on a different model than the first attempt announced.
- model_override: SlackAppModelOverride | None = await _execute_posthog_code_activity(
- classify_slack_app_model_override_activity, _model_override_input(inputs, thread_ts)
- )
-
- if await _forward_followup(inputs, channel, thread_ts, slack_user_id, model_override):
- return None
-
- # Untagged thread replies must not fall through to the new-task path.
- # The user never @mentioned us — they only typed in a thread that
- # used to have an active task. If the mapping is gone by the time we
- # got here, the right behaviour is to do nothing.
- if inputs.untagged_followup:
- return None
-
- # Past both returns above the message opens a thread: explicit @mention, and
- # the forward activity found no task mapped to it. Only such a message may
- # pick its own project, because a task, its mapping and its run all belong to
- # one. Everything below reads the integration from `inputs`, so the switch
- # lands above the repo cascade. Eligibility is decided inside the activity.
- project_route = await _execute_posthog_code_activity(
- classify_slack_app_project_route_activity, _project_route_input(inputs, thread_ts, slack_user_id)
- )
- routed_inputs = await _apply_project_route(inputs, project_route, channel, thread_ts, slack_user_id)
- if routed_inputs is None:
- return None
-
- thread_messages = await _collect_thread_messages(routed_inputs, channel, thread_ts)
- if not thread_messages:
- return None
- return _NewThreadPrework(inputs=routed_inputs, model_override=model_override, thread_messages=thread_messages)
-
-
async def _prework_in_parallel(
inputs: PostHogCodeSlackMentionWorkflowInputs, channel: str, thread_ts: str, slack_user_id: str
) -> _NewThreadPrework | None:
- """Same decisions as `_prework_in_sequence`, with the independent steps run together.
+ """The steps before repo selection, with the independent steps run together.
Each step reads only the message and the resolved project, so the slowest step sets
the wall time instead of the sum of all of them.
"""
+ # Read a model or effort request ("use fable for this one", "actually run
+ # this on opus") out of the message. One call serves whichever path the
+ # message takes, and recording the choice in history once stops a retry of
+ # either activity from landing on a different model than the first attempt announced.
model_override_task = asyncio.create_task(
_execute_posthog_code_activity(
classify_slack_app_model_override_activity, _model_override_input(inputs, thread_ts)
@@ -450,9 +387,14 @@ async def _prework_in_parallel(
if inputs.untagged_followup:
# Untagged replies never open a thread. The override is wasted on a dropped reply.
unconfirmed_followup = not inputs.untagged_followup_confirmed
+ # Untagged thread replies face the Haiku classifier before any forward.
+ # Drop on chitchat or any failure (default-deny). File-only replies skip
+ # the classifier: there is no text to classify, and default-deny would
+ # silently drop the attachment.
if unconfirmed_followup and not _is_file_only_followup(inputs.event):
if not await _untagged_followup_is_agent_directed(inputs, channel, thread_ts, slack_user_id):
return None
+ # A confirmed run skips the prompt, because the answer is what re-dispatched this.
if unconfirmed_followup and await _awaiting_followup_confirmation(inputs, channel, thread_ts, slack_user_id):
return None
await _forward_followup(inputs, channel, thread_ts, slack_user_id, await model_override_task)
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
deleted file mode 100644
index 3410198443e0..000000000000
--- a/products/slack_app/backend/temporal/tests/histories/mention_queue_with_rename_patch.json
+++ /dev/null
@@ -1,449 +0,0 @@
-{
- "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
deleted file mode 100644
index fc1b0cb4e4f4..000000000000
--- a/products/slack_app/backend/temporal/tests/test_replay.py
+++ /dev/null
@@ -1,23 +0,0 @@
-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_slack_app_mention_processing_workflow.py b/products/slack_app/backend/temporal/tests/test_slack_app_mention_processing_workflow.py
index c7c13cb79180..18577fcec002 100644
--- a/products/slack_app/backend/temporal/tests/test_slack_app_mention_processing_workflow.py
+++ b/products/slack_app/backend/temporal/tests/test_slack_app_mention_processing_workflow.py
@@ -12,7 +12,6 @@ _FORWARD = "forward_posthog_code_followup_activity"
@pytest.mark.asyncio
[email protected]("parallel", [False, True])
@pytest.mark.parametrize(
"text,expected_after_billing",
[
@@ -22,9 +21,7 @@ _FORWARD = "forward_posthog_code_followup_activity"
("nice weather today", [_CLASSIFY, _CONFIRM, _OVERRIDE, _FORWARD]),
],
)
-async def test_untagged_followup_with_files_classifier_gating(
- text: str, parallel: bool, expected_after_billing: list[str]
-) -> None:
+async def test_untagged_followup_with_files_classifier_gating(text: str, expected_after_billing: list[str]) -> None:
workflow = slack_app_mention_processing.SlackAppMentionProcessingWorkflow()
calls: list[str] = []
inputs = PostHogCodeSlackMentionWorkflowInputs(
@@ -58,7 +55,7 @@ async def test_untagged_followup_with_files_classifier_gating(
with (
patch.object(slack_app_mention_processing, "_execute_posthog_code_activity", side_effect=fake_execute_activity),
- patch.object(slack_app_mention_processing.workflow, "patched", return_value=parallel),
+ patch.object(slack_app_mention_processing.workflow, "deprecate_patch"),
):
await workflow.run(inputs)
@@ -66,8 +63,7 @@ async def test_untagged_followup_with_files_classifier_gating(
@pytest.mark.asyncio
[email protected]("parallel", [False, True])
-async def test_confirmed_untagged_followup_skips_the_classifier_and_the_prompt(parallel: bool) -> None:
+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 = slack_app_mention_processing.SlackAppMentionProcessingWorkflow()
@@ -93,7 +89,7 @@ async def test_confirmed_untagged_followup_skips_the_classifier_and_the_prompt(p
with (
patch.object(slack_app_mention_processing, "_execute_posthog_code_activity", side_effect=fake_execute_activity),
- patch.object(slack_app_mention_processing.workflow, "patched", return_value=parallel),
+ patch.object(slack_app_mention_processing.workflow, "deprecate_patch"),
):
await workflow.run(inputs)
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 fa1f8ac93027..855f620619f9 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
@@ -635,8 +635,7 @@ async def test_hung_child_times_out_and_queue_continues(monkeypatch):
@pytest.mark.asyncio
[email protected]("carried_key_prefix", ["slack-app-mention-processing-", "posthog-code-mention-"])
-async def test_continue_as_new_carry_over_processes_pending_and_dedups_seen(carried_key_prefix: str):
+async def test_continue_as_new_carry_over_processes_pending_and_dedups_seen():
rec = _Recorder()
pending = _message("1.1", event_id="Ev-pending")
already_seen = _message("1.2", event_id="Ev-seen")
@@ -651,10 +650,7 @@ async def test_continue_as_new_carry_over_processes_pending_and_dedups_seen(carr
SlackAppMentionWorkflow.run,
SlackAppMentionWorkflowInputs(
pending_messages=[pending],
- processed_event_keys=[
- carried_key_prefix
- + derive_mention_workflow_id(already_seen).removeprefix("slack-app-mention-processing-")
- ],
+ processed_event_keys=[derive_mention_workflow_id(already_seen)],
),
id=f"wf-{uuid.uuid4()}",
task_queue=h.task_queue,