Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(tasks): make hogdesk-originated tasks team-visible (#67929)

Ben Leabeb83ef1a3c0
diff --git a/products/tasks/backend/tests/test_api.py b/products/tasks/backend/tests/test_api.py
index 644a2f2099d8..dbbb3282bf32 100644
--- a/products/tasks/backend/tests/test_api.py
+++ b/products/tasks/backend/tests/test_api.py
@@ -333,6 +333,38 @@ class TestTaskCreatorScoping(BaseTaskAPITest):
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(response.json()["id"], str(task.id))
+ def test_retrieve_hogdesk_task_owned_by_another_user_is_visible(self):
+ # HogDesk Code threads are pinned to a support ticket via a shared ticket
+ # tag; any agent opening the ticket must be able to load the same task.
+ other_user = self.create_organization_user("hogdesk-owner")
+ task = Task.objects.create(
+ team=self.team,
+ created_by=other_user,
+ title="HogDesk Task",
+ description="Started from a support ticket",
+ origin_product=Task.OriginProduct.HOGDESK,
+ )
+
+ response = self.client.get(f"/api/projects/@current/tasks/{task.id}/")
+ self.assertEqual(response.status_code, status.HTTP_200_OK)
+ self.assertEqual(response.json()["id"], str(task.id))
+
+ def test_list_runs_hogdesk_task_owned_by_another_user_succeeds(self):
+ other_user = self.create_organization_user("hogdesk-owner")
+ task = Task.objects.create(
+ team=self.team,
+ created_by=other_user,
+ title="HogDesk Task",
+ description="Started from a support ticket",
+ origin_product=Task.OriginProduct.HOGDESK,
+ )
+ run = TaskRun.objects.create(task=task, team=self.team, status=TaskRun.Status.COMPLETED)
+
+ response = self.client.get(f"/api/projects/@current/tasks/{task.id}/runs/")
+ self.assertEqual(response.status_code, status.HTTP_200_OK)
+ ids = {r["id"] for r in response.json()["results"]}
+ self.assertEqual(ids, {str(run.id)})
+
def test_retrieve_other_user_non_signal_internal_task_returns_404(self):
# Non-signal internal tasks created by another user remain private.
other_user = self.create_organization_user("victim")
diff --git a/products/tasks/backend/visibility.py b/products/tasks/backend/visibility.py
index be70bebbf118..4345cd229966 100644
--- a/products/tasks/backend/visibility.py
+++ b/products/tasks/backend/visibility.py
@@ -16,10 +16,14 @@ from products.tasks.backend.models import Task
# - ONBOARDING: the "Set up PostHog" wizard task. Its `created_by` is the real person who
# went through onboarding (not a system pick), but we surface it team-wide so anyone on
# the team can see and pick up the setup, not just whoever happened to start it.
+# - HOGDESK: support-desk Code threads. The task is pinned to the support ticket via a
+# shared ticket tag, so any agent opening the ticket resumes the same thread — it must
+# be viewable by the whole team, not just the agent who started it.
TEAM_VISIBLE_ORIGIN_PRODUCTS = [
Task.OriginProduct.SIGNAL_REPORT,
Task.OriginProduct.SIGNALS_SCOUT,
Task.OriginProduct.ONBOARDING,
+ Task.OriginProduct.HOGDESK,
]