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.

fix(signals): show signals scout tasks in list (#61886)

Andrew Maguire626168b5b821
diff --git a/products/tasks/backend/api.py b/products/tasks/backend/api.py
index 6b1a4dcd8419..38d4e2cab504 100644
--- a/products/tasks/backend/api.py
+++ b/products/tasks/backend/api.py
@@ -264,12 +264,17 @@ def task_visibility_q(user_id: int | None) -> Q:
- it has no creator at all (legacy unowned tasks remain visible to any
team member — they cannot be executed in any case because oauth.py
requires `task.created_by` to mint OAuth tokens), or
- - it was generated by the signals pipeline (`origin_product=SIGNAL_REPORT`).
+ - it was generated by the signals pipeline or Signals scout
+ (`origin_product=SIGNAL_REPORT` or `origin_product=SIGNALS_SCOUT`).
Signals tasks are team-scoped artifacts that the pipeline must attach to
a system-picked `created_by` so the agent can mint an OAuth token, but
they are not personal — any team member should be able to view them.
"""
- return Q(created_by_id=user_id) | Q(created_by__isnull=True) | Q(origin_product=Task.OriginProduct.SIGNAL_REPORT)
+ return (
+ Q(created_by_id=user_id)
+ | Q(created_by__isnull=True)
+ | Q(origin_product__in=[Task.OriginProduct.SIGNAL_REPORT, Task.OriginProduct.SIGNALS_SCOUT])
+ )
def task_run_visibility_q(user_id: int | None) -> Q:
@@ -277,7 +282,7 @@ def task_run_visibility_q(user_id: int | None) -> Q:
return (
Q(task__created_by_id=user_id)
| Q(task__created_by__isnull=True)
- | Q(task__origin_product=Task.OriginProduct.SIGNAL_REPORT)
+ | Q(task__origin_product__in=[Task.OriginProduct.SIGNAL_REPORT, Task.OriginProduct.SIGNALS_SCOUT])
)
diff --git a/products/tasks/backend/tests/test_api.py b/products/tasks/backend/tests/test_api.py
index 7f0768324a0a..74e59d0da39b 100644
--- a/products/tasks/backend/tests/test_api.py
+++ b/products/tasks/backend/tests/test_api.py
@@ -270,6 +270,40 @@ class TestTaskCreatorScoping(BaseTaskAPITest):
self.assertIn(str(mine.id), ids)
self.assertNotIn(str(signal_task.id), ids)
+ def test_list_signals_scout_tasks_owned_by_another_user(self):
+ # Signals scout task runs are team-scoped, but created under the user
+ # resolved from the team's GitHub integration so the sandbox can mint
+ # OAuth tokens. They should still show in the shared Tasks list.
+ other_user = self.create_organization_user("scout-owner")
+ scout_task = Task.objects.create(
+ team=self.team,
+ created_by=other_user,
+ title="Signals Scout Task",
+ description="Generated by Signals scout",
+ origin_product=Task.OriginProduct.SIGNALS_SCOUT,
+ )
+ mine = self.create_task("Mine", created_by=self.user)
+
+ response = self.client.get("/api/projects/@current/tasks/")
+ self.assertEqual(response.status_code, status.HTTP_200_OK)
+ ids = {t["id"] for t in response.json()["results"]}
+ self.assertIn(str(mine.id), ids)
+ self.assertIn(str(scout_task.id), ids)
+
+ def test_retrieve_signals_scout_task_owned_by_another_user_is_visible(self):
+ other_user = self.create_organization_user("scout-owner")
+ task = Task.objects.create(
+ team=self.team,
+ created_by=other_user,
+ title="Signals Scout Task",
+ description="Generated by Signals scout",
+ origin_product=Task.OriginProduct.SIGNALS_SCOUT,
+ )
+
+ 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_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")
@@ -302,6 +336,22 @@ class TestTaskCreatorScoping(BaseTaskAPITest):
ids = {r["id"] for r in response.json()["results"]}
self.assertEqual(ids, {str(run.id)})
+ def test_list_runs_signals_scout_task_owned_by_another_user_succeeds(self):
+ other_user = self.create_organization_user("scout-owner")
+ task = Task.objects.create(
+ team=self.team,
+ created_by=other_user,
+ title="Signals Scout Task",
+ description="Generated by Signals scout",
+ origin_product=Task.OriginProduct.SIGNALS_SCOUT,
+ )
+ 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_run_signal_report_task_owned_by_another_user_succeeds(self):
other_user = self.create_organization_user("signal-owner")
task = Task.objects.create(