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(temporal): register posthog-code slack workflows on tasks queue (#62168)

Vojta Bartoše9d586ff1ef9
diff --git a/.github/workflows/container-images-cd.yml b/.github/workflows/container-images-cd.yml
index 042561e874aa..0a9825239ba6 100644
--- a/.github/workflows/container-images-cd.yml
+++ b/.github/workflows/container-images-cd.yml
@@ -349,7 +349,7 @@ jobs:
- name: Check for changes that affect Tasks Agent Temporal worker
id: check_changes_tasks_agent_temporal_worker
run: |
- if git diff --name-only HEAD^ HEAD | grep -qE '^posthog/temporal/common|^products/tasks/backend|^posthog/tasks/|^posthog/management/commands/start_temporal_worker.py$|^pyproject.toml$|^bin/temporal-django-worker$|^posthog/clickhouse/migrations/'; then
+ if git diff --name-only HEAD^ HEAD | grep -qE '^posthog/temporal/common|^posthog/temporal/ai/posthog_code_slack_|^posthog/temporal/ai/slack_app/|^products/slack_app/backend|^products/tasks/backend|^posthog/tasks/|^posthog/management/commands/start_temporal_worker.py$|^pyproject.toml$|^bin/temporal-django-worker$|^posthog/clickhouse/migrations/'; then
echo "changed=true" >> $GITHUB_OUTPUT
else
echo "changed=false" >> $GITHUB_OUTPUT
diff --git a/posthog/management/commands/start_temporal_worker.py b/posthog/management/commands/start_temporal_worker.py
index 5388e9d3e436..b7e654fe843f 100644
--- a/posthog/management/commands/start_temporal_worker.py
+++ b/posthog/management/commands/start_temporal_worker.py
@@ -20,7 +20,7 @@ with workflow.unsafe.imports_passed_through():
from django.core.management.base import BaseCommand
from posthog.clickhouse.query_tagging import tag_queries
-from posthog.temporal.ai import AI_ACTIVITIES, AI_WORKFLOWS
+from posthog.temporal.ai import AI_ACTIVITIES, AI_WORKFLOWS, POSTHOG_CODE_SLACK_ACTIVITIES, POSTHOG_CODE_SLACK_WORKFLOWS
from posthog.temporal.ai_observability import (
ACTIVITIES as LLM_ANALYTICS_ACTIVITIES,
EVAL_ACTIVITIES as LLM_ANALYTICS_EVAL_ACTIVITIES,
@@ -287,8 +287,13 @@ _task_queue_specs = [
),
(
settings.TASKS_TASK_QUEUE,
- TASKS_WORKFLOWS,
- TASKS_ACTIVITIES,
+ # PostHog Code Slack workflows are also registered on MAX_AI_TASK_QUEUE.
+ # First step of merging them onto this queue — once master traffic has
+ # cut over and any in-flight runs have drained, drop them from
+ # AI_WORKFLOWS / AI_ACTIVITIES and flip the start_workflow callers in
+ # products/slack_app to settings.TASKS_TASK_QUEUE.
+ TASKS_WORKFLOWS + POSTHOG_CODE_SLACK_WORKFLOWS,
+ TASKS_ACTIVITIES + POSTHOG_CODE_SLACK_ACTIVITIES,
),
(
settings.MAX_AI_TASK_QUEUE,
diff --git a/posthog/temporal/ai/__init__.py b/posthog/temporal/ai/__init__.py
index a76119fe1044..9475aac37188 100644
--- a/posthog/temporal/ai/__init__.py
+++ b/posthog/temporal/ai/__init__.py
@@ -32,6 +32,21 @@ from .sync_vectors import (
get_approximate_actions_count,
)
+# The PostHog Code Slack workflows handed off to ProcessTaskWorkflow on the tasks
+# queue once a repo was picked, so the two queues were already paired. Exposing
+# them as a subset lets the tasks-agent worker register them alongside the AI
+# worker during the migration to a single queue.
+POSTHOG_CODE_SLACK_WORKFLOWS = [
+ PostHogCodeSlackMentionWorkflow,
+ PostHogCodeSlackMentionCommandWorkflow,
+ PostHogCodeSlackTerminateTaskWorkflow,
+]
+
+POSTHOG_CODE_SLACK_ACTIVITIES = [
+ *SLACK_APP_ACTIVITIES,
+ process_posthog_code_terminate_task_activity,
+]
+
AI_WORKFLOWS = [
SyncVectorsWorkflow,
AssistantConversationRunnerWorkflow,
@@ -39,9 +54,7 @@ AI_WORKFLOWS = [
ResearchAgentWorkflow,
SummarizeLLMTracesWorkflow,
SlackConversationRunnerWorkflow,
- PostHogCodeSlackMentionWorkflow,
- PostHogCodeSlackMentionCommandWorkflow,
- PostHogCodeSlackTerminateTaskWorkflow,
+ *POSTHOG_CODE_SLACK_WORKFLOWS,
AnomalyInvestigationWorkflow,
]
@@ -54,8 +67,7 @@ AI_ACTIVITIES = [
process_research_agent_activity,
summarize_llm_traces_activity,
process_slack_conversation_activity,
- *SLACK_APP_ACTIVITIES,
- process_posthog_code_terminate_task_activity,
+ *POSTHOG_CODE_SLACK_ACTIVITIES,
investigate_anomaly_activity,
]