: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(signals): skip scheduled scout runs without ai data processing consent (#114576)
posthog[bot]460e21aad9a7
diff --git a/products/signals/backend/temporal/agentic/scout_coordinator.py b/products/signals/backend/temporal/agentic/scout_coordinator.pyindex e4a7f49fc1c0..42b6fba364e9 100644--- a/products/signals/backend/temporal/agentic/scout_coordinator.py+++ b/products/signals/backend/temporal/agentic/scout_coordinator.py@@ -517,6 +517,7 @@ def _collect_planned_runs(except Exception:logger.exception("signals_scout coordinator: background reconcile failed; continuing")paused_by_team = _breaker_paused_configs_by_team()+ skipped_without_consent = 0reconcile_by_team = operational_configs_needing_reconcile() if enrollment.wildcard else {}for team, needs_seed in _participating_teams(enrollment, reconcile_team_ids=set(reconcile_by_team)):# Scouts held back from this team via the `withheld_skills` denylist (resolved most-@@ -568,6 +569,11 @@ def _collect_planned_runs(withheld_for_team,[team_configs.get(team.id) or {}, default_team_config],)+ # The tools drop every output of a run without AI data processing consent, so the run+ # only spends model time. The configs keep their status and dispatch again after approval.+ if not _ai_data_processing_approved(team):+ skipped_without_consent += 1+ continue# Skip enabled configs whose skill was deleted or is no longer the# latest version: dispatching them would spawn a child workflow that fails fast in# load_skill_for_run on every tick.@@ -580,6 +586,12 @@ def _collect_planned_runs(due.append(_DueRun(overdue_s, str(config.pk), team.id, config.skill_name))due.extend(_collect_probe_runs(paused_by_team.get(team.id, []), live_skills, now))+ if skipped_without_consent:+ logger.info(+ "signals_scout coordinator: skipped teams without AI data processing consent",+ team_count=skipped_without_consent,+ )+if background is not None and background.enabled:due.extend(_collect_background_runs(background, background_team_ids, team_configs, default_team_config, now))@@ -774,7 +786,7 @@ def _participating_teams(enrollment: Enrollment, reconcile_team_ids: set[int] |all_ids = explicit | wildcard_idsif not all_ids:return []- teams = {team.id: team for team in Team.objects.filter(id__in=all_ids)}+ teams = {team.id: team for team in Team.objects.filter(id__in=all_ids).select_related("organization")}return [(teams[team_id], team_id in explicit) for team_id in sorted(all_ids) if team_id in teams]diff --git a/products/signals/backend/test/test_scout_coordinator.py b/products/signals/backend/test/test_scout_coordinator.pyindex cdbb4f2cfac0..c653ac9f5fdc 100644--- a/products/signals/backend/test/test_scout_coordinator.py+++ b/products/signals/backend/test/test_scout_coordinator.py@@ -1096,11 +1096,17 @@ class TestFailureStreakProbeCollection:@pytest.mark.asyncio@pytest.mark.django_db-async def test_planning_dispatches_a_probe_for_a_breaker_paused_lane(ateam):[email protected]("approved", [True, False, None])+async def test_planning_dispatches_a_probe_for_a_breaker_paused_lane(ateam, aorganization, approved):# Wiring guard for the whole half-open path: a lane the breaker paused is invisible to the# `enabled=True` dispatch query, so only `_collect_probe_runs` inside `_collect_planned_runs`# can bring it back — if that call is dropped, a wedged lane whose cause was fixed stays# paused forever with no human in the loop.+ # Without AI data processing consent every output is dropped, so neither lane may dispatch.+ aorganization.is_ai_data_processing_approved = approved+ await sync_to_async(aorganization.save)(update_fields=["is_ai_data_processing_approved"])+ await database_sync_to_async(_create_skill)(ateam, "signals-scout-errors")+ await database_sync_to_async(_create_config)(ateam, "signals-scout-errors", enabled=True)await database_sync_to_async(_create_skill)(ateam, "signals-scout-broken")await database_sync_to_async(_create_config)(ateam,@@ -1113,7 +1119,8 @@ async def test_planning_dispatches_a_probe_for_a_breaker_paused_lane(ateam):planned = await _run_activity()- assert [p.skill_name for p in planned] == ["signals-scout-broken"]+ expected = ["signals-scout-broken", "signals-scout-errors"] if approved is True else []+ assert [p.skill_name for p in planned] == expectedclass TestCronScheduleDueCheck: