: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): gate anomaly scoring on the product analytics source (#129479)
posthog[bot]39ca7660f6d8
diff --git a/products/signals/backend/anomaly_scores/config.py b/products/signals/backend/anomaly_scores/config.pyindex e5e06ca3e3ef..7f707403d5e6 100644--- a/products/signals/backend/anomaly_scores/config.py+++ b/products/signals/backend/anomaly_scores/config.py@@ -374,24 +374,32 @@ def in_rollout(config: AnomalyScoringConfig, organization_id: "uuid.UUID | str")return organization_rollout_bucket(organization_id) < threshold-def covers_team(config: AnomalyScoringConfig, team: "Team") -> bool:- """Whether the tick scores this team's insights. The single-team form of `queue.eligible_teams`.+def enrolls_team(config: AnomalyScoringConfig, team: "Team") -> bool:+ """Whether the payload enrolls this team, by its list or by its percentage rollout.- The event quota check of `queue.eligible_teams` is left out. The skip list and the denylist win over every- enrollment. The percentage rollout enrolls only the projects that have an enabled signal source.+ The skip list and the denylist win over every enrollment. `covers_team` also requires the Product analytics source."""organization_id = str(team.organization_id)if not config.enabled or team.id in config.skip_team_ids or organization_id in config.deny_organization_ids:return Falseif organization_id in config.organization_ids:return not config.allow_team_ids or team.id in config.allow_team_ids- if not in_rollout(config, organization_id):+ return in_rollout(config, organization_id)+++def covers_team(config: AnomalyScoringConfig, team: "Team") -> bool:+ """Whether the tick scores this team's insights. The single-team form of `queue.eligible_teams`.++ The event quota check of `queue.eligible_teams` is left out. Every enrollment path requires the Product+ analytics source, so turning that source off stops scoring.+ """+ if not enrolls_team(config, team):return False- from products.signals.backend.facade.api import (- has_enabled_source, # noqa: PLC0415 — the facade imports this module through `search`+ from products.signals.backend.facade.source_configs import (+ analytics_source_enabled, # noqa: PLC0415 — keeps the models off the import path of the flag payload parse)- return has_enabled_source(team.id)+ return analytics_source_enabled(team.id)def deployment_payload(payload: Any, deployment: str | None) -> Any:diff --git a/products/signals/backend/anomaly_scores/queue.py b/products/signals/backend/anomaly_scores/queue.pyindex 8e756642bc34..b156b721a7d9 100644--- a/products/signals/backend/anomaly_scores/queue.py+++ b/products/signals/backend/anomaly_scores/queue.py@@ -73,7 +73,8 @@ from products.signals.backend.anomaly_scores.selection import ()from products.signals.backend.anomaly_scores.spend import CpuSpendReport, cpu_gatefrom products.signals.backend.anomaly_scores.state import RunPlan, load_states, plan_run, score_ready_by_insight-from products.signals.backend.models import AnomalyScoringDueInsight, SignalTeamConfig+from products.signals.backend.contracts import ALERT_SCOPE_SOURCE+from products.signals.backend.models import AnomalyScoringDueInsight, SignalSourceConfig, SignalTeamConfigfrom products.subscriptions.backend.facade.api import insight_ids_with_active_subscriptionsfrom ee.billing.quota_limiting import QuotaLimitingCaches, QuotaResource, list_limited_team_attributes@@ -260,8 +261,13 @@ def eligible_teams(config: AnomalyScoringConfig) -> list[Team]:"""The teams that `config.covers_team` enrolls, in a fixed number of queries, less the teams over their event quota."""if not config.enabled:return []+ source_product, source_type = ALERT_SCOPE_SOURCE+ with_source = SignalSourceConfig.objects.filter(+ source_product=source_product, source_type=source_type, enabled=True+ ).values("team_id")teams = (- Team.objects.exclude(id__in=config.skip_team_ids)+ Team.objects.filter(id__in=with_source)+ .exclude(id__in=config.skip_team_ids).exclude(organization_id__in=config.deny_organization_ids).exclude(id__in=SignalTeamConfig.objects.filter(anomaly_scoring_enabled=False).values("team_id")))@@ -272,12 +278,11 @@ def eligible_teams(config: AnomalyScoringConfig) -> list[Team]:listed = listed.filter(id__in=config.allow_team_ids)enrolled.update(listed.values_list("id", flat=True))if config.self_driving_organization_percentage > 0:- from products.signals.backend.facade.api import (- team_ids_with_enabled_source, # noqa: PLC0415 — the facade imports this module through `search`+ enrolled.update(+ team_id+ for team_id, organization_id in teams.values_list("id", "organization_id")+ if in_rollout(config, organization_id))-- with_source = teams.filter(id__in=team_ids_with_enabled_source()).values_list("id", "organization_id")- enrolled.update(team_id for team_id, organization_id in with_source if in_rollout(config, organization_id))if not enrolled:return []# Capture drops every event of a project over its event quota, so scoring it wastes the query.diff --git a/products/signals/backend/anomaly_scores/search.py b/products/signals/backend/anomaly_scores/search.pyindex 2fd6c5e8c757..b1f352600e34 100644--- a/products/signals/backend/anomaly_scores/search.py+++ b/products/signals/backend/anomaly_scores/search.py@@ -24,7 +24,7 @@ from products.product_analytics.backend.facade.contracts import ViewableInsightfrom products.signals.backend.anomaly_scores.config import (MAX_LIMITS,AnomalyScoringConfig,- covers_team,+ enrolls_team,parse_config,read_payload,)@@ -45,6 +45,7 @@ from products.signals.backend.anomaly_scores.read import ()from products.signals.backend.anomaly_scores.scoring import bucket_endfrom products.signals.backend.anomaly_scores.selection import insight_usage+from products.signals.backend.facade.source_configs import analytics_source_enabledTOP_SERIES = 3FLAGGED_POINTS = 5@@ -53,6 +54,10 @@ URL_PADDING_BUCKETS = 7# The scorer writes at most this many series per insight. More come from events any member can capture.MAX_INSIGHT_SERIES = MAX_LIMITS.max_seriesSCORING_DISABLED_MESSAGE = "Anomaly scoring is not enabled for this project, so no insight is scored."+SCORING_SOURCE_OFF_MESSAGE = (+ "The Product analytics source is turned off in this project's self-driving settings, so no insight is scored. "+ "Scores written before it was turned off stay readable."+)SCORING_TURNED_OFF_MESSAGE = ("Anomaly scoring is turned off in this project's self-driving settings, so no insight is scored. ""Scores written before it was turned off stay readable."@@ -209,8 +214,10 @@ def _requested_insight_ids(team: Team, user: User, filters: AnomalySearchFiltersdef _scoring_off_message(config: AnomalyScoringConfig, team: Team) -> str | None:"""Why the tick does not score this team's insights, or None when it does."""- if not covers_team(config, team):+ if not enrolls_team(config, team):return SCORING_DISABLED_MESSAGE+ if not analytics_source_enabled(team.id):+ return SCORING_SOURCE_OFF_MESSAGEif turned_off_in_settings(team):return SCORING_TURNED_OFF_MESSAGEreturn Nonediff --git a/products/signals/backend/facade/source_configs.py b/products/signals/backend/facade/source_configs.pyindex 7b2bd2fb878d..ebdaa5bc5187 100644--- a/products/signals/backend/facade/source_configs.py+++ b/products/signals/backend/facade/source_configs.py@@ -71,6 +71,14 @@ def latest_enabled_source_config(return _to_snapshot(row)+def analytics_source_enabled(team_id: int) -> bool:+ """Whether the team turned on the Product analytics source, which also controls anomaly scoring."""+ source_product, source_type = ALERT_SCOPE_SOURCE+ return SignalSourceConfig.objects.filter(+ team_id=team_id, source_product=source_product, source_type=source_type, enabled=True+ ).exists()++def get_analytics_alert_scope(*, team_id: int) -> AlertScope:"""Which firing insight alerts the team's analytics source turns into signals.diff --git a/products/signals/backend/serializers.py b/products/signals/backend/serializers.pyindex b8a7b020fdd9..4ba21cca92b2 100644--- a/products/signals/backend/serializers.py+++ b/products/signals/backend/serializers.py@@ -27,7 +27,7 @@ from posthog.models.integration import SUPPORTED_EXTERNAL_ISSUE_PROVIDERSfrom products.signals.backend import contractsfrom products.signals.backend.agent_instructions import AGENT_STEERING_MAX_LENGTH, STEERING_FIELDS-from products.signals.backend.anomaly_scores.config import covers_team, parse_config, read_payload+from products.signals.backend.anomaly_scores.config import enrolls_team, parse_config, read_payloadfrom products.signals.backend.billing import REFUND_INELIGIBILITY_REASONS, refund_ineligibility_reasonfrom products.signals.backend.contracts import (ALERT_ALLOW_PATTERNS_KEY,@@ -586,16 +586,17 @@ class SignalTeamConfigSerializer(serializers.ModelSerializer):anomaly_scoring_enabled = serializers.BooleanField(required=False,help_text=(- "Whether anomaly scoring scores this project's active trends insights every hour and writes "- "the results as $anomaly_score events, which are not billed. True by default. Set false to "- "stop new scores; events written before stay. Turning it on does not enroll a project that "- "anomaly_scoring_available reports as not covered."+ "Legacy off switch for anomaly scoring. The Product analytics source (analytics / "+ "anomaly_investigation) now controls scoring: when that source is on, anomaly scoring scores "+ "this project's active trends insights and writes the results as $anomaly_score events, which "+ "are not billed. True by default. False still stops new scores; events written before stay. "+ "Turning it on does not enroll a project that anomaly_scoring_available reports as not covered."),)anomaly_scoring_available = serializers.SerializerMethodField(help_text=(- "Whether anomaly scoring covers this project, so anomaly_scoring_enabled has an effect. "- "PostHog decides which projects anomaly scoring covers."+ "Whether the anomaly scoring rollout covers this project. PostHog decides which projects it "+ "covers. A covered project is scored only while its Product analytics source is on."))reports_generated_today = serializers.SerializerMethodField(@@ -659,7 +660,7 @@ class SignalTeamConfigSerializer(serializers.ModelSerializer):@extend_schema_field(serializers.BooleanField())def get_anomaly_scoring_available(self, obj: SignalTeamConfig) -> bool:- return covers_team(parse_config(read_payload()), obj.team)+ return enrolls_team(parse_config(read_payload()), obj.team)@extend_schema_field(serializers.BooleanField())def get_daily_report_limit_reached(self, obj: SignalTeamConfig) -> bool:diff --git a/products/signals/backend/test/test_anomaly_scoring_tick.py b/products/signals/backend/test/test_anomaly_scoring_tick.pyindex bda09efa978d..776a94318d2e 100644--- a/products/signals/backend/test/test_anomaly_scoring_tick.py+++ b/products/signals/backend/test/test_anomaly_scoring_tick.py@@ -111,6 +111,7 @@ from products.signals.backend.anomaly_scores.tick import (run_insight,shard_picks,)+from products.signals.backend.contracts import ALERT_SCOPE_SOURCEfrom products.signals.backend.models import (AnomalyScoringDueInsight,AnomalyScoringState,@@ -124,6 +125,13 @@ ORGANIZATION_ID = "4dc8564d-bd82-1065-2f40-97f7c50f67cf"NOW = datetime(2026, 10, 22, 12, tzinfo=UTC)+def _enable_analytics_source(team: Team, *, enabled: bool = True) -> None:+ source_product, source_type = ALERT_SCOPE_SOURCE+ SignalSourceConfig.objects.create(+ team=team, source_product=source_product, source_type=source_type, enabled=enabled+ )++def _trends(**source: Any) -> dict[str, Any]:return {"kind": "InsightVizNode",@@ -978,6 +986,8 @@ class TestEligibleTeams(BaseTest):expected: set[str],) -> None:teams = {"main": self.team, "second": Team.objects.create(organization=self.organization, name="second")}+ for team in teams.values():+ _enable_analytics_source(team)if second_setting is not None:SignalTeamConfig.objects.create(team=teams["second"], anomaly_scoring_enabled=second_setting)other = Organization.objects.create(name="other")@@ -997,15 +1007,20 @@ class TestEligibleTeams(BaseTest):@parameterized.expand([- # name, listed, percentage, denied, skipped, allow_other, has_source, enrolled- ("listed_without_source", True, 0.0, False, False, False, False, True),- ("listed_and_denied", True, 0.0, True, False, False, False, False),- ("rollout", False, 100.0, False, False, False, True, True),- ("rollout_without_source", False, 100.0, False, False, False, False, False),- ("rollout_at_zero", False, 0.0, False, False, False, True, False),- ("rollout_denied", False, 100.0, True, False, False, True, False),- ("rollout_team_skipped", False, 100.0, False, True, False, True, False),- ("rollout_ignores_the_allowlist", False, 100.0, False, False, True, True, True),+ # name, listed, percentage, denied, skipped, allow_other, source, enrolled+ ("listed", True, 0.0, False, False, False, "analytics", True),+ ("listed_without_source", True, 0.0, False, False, False, None, False),+ ("listed_with_another_source", True, 0.0, False, False, False, "other", False),+ ("listed_with_analytics_off", True, 0.0, False, False, False, "analytics_off", False),+ ("listed_and_denied", True, 0.0, True, False, False, "analytics", False),+ ("rollout", False, 100.0, False, False, False, "analytics", True),+ ("rollout_without_source", False, 100.0, False, False, False, None, False),+ ("rollout_with_another_source", False, 100.0, False, False, False, "other", False),+ ("rollout_with_analytics_off", False, 100.0, False, False, False, "analytics_off", False),+ ("rollout_at_zero", False, 0.0, False, False, False, "analytics", False),+ ("rollout_denied", False, 100.0, True, False, False, "analytics", False),+ ("rollout_team_skipped", False, 100.0, False, True, False, "analytics", False),+ ("rollout_ignores_the_allowlist", False, 100.0, False, False, True, "analytics", True),])def test_enrollment_by_list_and_rollout(@@ -1016,7 +1031,7 @@ class TestEligibleTeams(BaseTest):denied: bool,skipped: bool,allow_other: bool,- has_source: bool,+ source: str | None,enrolled: bool,) -> None:other = Team.objects.create(organization=Organization.objects.create(name="other"), name="other")@@ -1029,10 +1044,12 @@ class TestEligibleTeams(BaseTest):skip_team_ids=(self.team.id,) if skipped else (),allow_team_ids=(other.id,) if allow_other else (),)- if has_source:+ if source == "other":SignalSourceConfig.objects.create(team=self.team, source_product="error_tracking", source_type="issue_created", enabled=True)+ elif source is not None:+ _enable_analytics_source(self.team, enabled=source == "analytics")with patch("products.signals.backend.anomaly_scores.queue.list_limited_team_attributes", return_value=[]):eligible = {team.id for team in eligible_teams(config)}@@ -1042,9 +1059,7 @@ class TestEligibleTeams(BaseTest):assert other.id not in eligibledef test_rollout_skips_a_team_that_turned_scoring_off(self) -> None:- SignalSourceConfig.objects.create(- team=self.team, source_product="error_tracking", source_type="issue_created", enabled=True- )+ _enable_analytics_source(self.team)SignalTeamConfig.objects.create(team=self.team, anomaly_scoring_enabled=False)config = AnomalyScoringConfig(enabled=True, self_driving_organization_percentage=100.0)@@ -1163,6 +1178,10 @@ class TestActiveInsights(BaseTest):class TestDueList(ClickhouseTestMixin, BaseTest):+ def setUp(self) -> None:+ super().setUp()+ _enable_analytics_source(self.team)+def _config(self, *team_ids: int) -> AnomalyScoringConfig:return AnomalyScoringConfig(enabled=True,@@ -1271,6 +1290,7 @@ class TestDueList(ClickhouseTestMixin, BaseTest):@time_machine.travel(NOW, tick=False)def test_the_refresh_removes_inactive_insights_and_resumes_with_the_teams_that_waited(self) -> None:other_team = Team.objects.create(organization=self.organization, name="Other")+ _enable_analytics_source(other_team)active = {team.id: Insight.objects.create(team=team, name=team.name, query=_trends(interval="day"))for team in (self.team, other_team)@@ -1336,6 +1356,10 @@ class TestReadSpend(ClickhouseTestMixin, BaseTest):class TestScoredBuckets(ClickhouseTestMixin, BaseTest):+ def setUp(self) -> None:+ super().setUp()+ _enable_analytics_source(self.team)+def test_reads_the_newest_scored_bucket_of_each_series(self) -> None:def score(insight_id: int, series_key: str, bucket: datetime, source: str = "insight") -> None:_create_event(@@ -1423,6 +1447,7 @@ class TestScoredBuckets(ClickhouseTestMixin, BaseTest):@time_machine.travel(NOW, tick=False)def test_select_insights_lets_each_project_pick_before_any_project_picks_twice(self) -> None:small_team = Team.objects.create(organization=self.organization, name="Small")+ _enable_analytics_source(small_team)viewers = [User.objects.create_and_join(self.organization, f"viewer{index}@example.com", "password")for index in range(5)@@ -1466,6 +1491,7 @@ class TestScoredBuckets(ClickhouseTestMixin, BaseTest):self, _name: str, error: type[Exception]) -> None:slow_team = Team.objects.create(organization=self.organization, name="Slow")+ _enable_analytics_source(slow_team)dashboards = {team.id: Dashboard.objects.create(team=team, name="Main") for team in (self.team, slow_team)}insights = {}for team in (self.team, slow_team):@@ -1499,6 +1525,7 @@ class TestScoredBuckets(ClickhouseTestMixin, BaseTest):@time_machine.travel(NOW, tick=False)def test_select_insights_skips_a_project_over_its_cpu_limit(self) -> None:heavy_team = Team.objects.create(organization=self.organization, name="Heavy")+ _enable_analytics_source(heavy_team)insights = {}for team in (self.team, heavy_team):insight = Insight.objects.create(team=team, name=team.name, query=_trends(interval="day"))@@ -1540,6 +1567,7 @@ class TestScoredBuckets(ClickhouseTestMixin, BaseTest):@time_machine.travel(NOW, tick=False)def test_a_plan_past_its_deadline_loads_one_team_and_the_next_plan_starts_from_another(self) -> None:other_team = Team.objects.create(organization=self.organization, name="Other")+ _enable_analytics_source(other_team)insights = {}for team in (self.team, other_team):insight = Insight.objects.create(team=team, name=team.name, query=_trends(interval="day"))diff --git a/products/signals/backend/test/test_anomaly_search.py b/products/signals/backend/test/test_anomaly_search.pyindex 305a80fae0e9..93f42860aa81 100644--- a/products/signals/backend/test/test_anomaly_search.py+++ b/products/signals/backend/test/test_anomaly_search.py@@ -19,9 +19,11 @@ from products.signals.backend.anomaly_scores.read import SeriesSummary, prior_rafrom products.signals.backend.anomaly_scores.search import (MAX_INSIGHT_SERIES,SCORING_DISABLED_MESSAGE,+ SCORING_SOURCE_OFF_MESSAGE,SCORING_TURNED_OFF_MESSAGE,)-from products.signals.backend.models import SignalTeamConfig+from products.signals.backend.contracts import ALERT_SCOPE_SOURCE+from products.signals.backend.models import SignalSourceConfig, SignalTeamConfigNOW = datetime.datetime(2026, 10, 23, 12, tzinfo=datetime.UTC)@@ -99,6 +101,9 @@ class TestAnomalySearchAPI(ClickhouseTestMixin, APIBaseTest):def setUp(self) -> None:super().setUp()self.insight = Insight.objects.create(team=self.team, name="Signups", saved=True)+ self.source = SignalSourceConfig.objects.create(+ team=self.team, source_product=ALERT_SCOPE_SOURCE[0], source_type=ALERT_SCOPE_SOURCE[1], enabled=True+ )flag = patch("products.signals.backend.presentation.anomalies.feature_enabled_or_false", return_value=True)self.flag = flag.start()self.addCleanup(flag.stop)@@ -181,19 +186,24 @@ class TestAnomalySearchAPI(ClickhouseTestMixin, APIBaseTest):@parameterized.expand([- ("search_outside_the_payload", "search", False, SCORING_DISABLED_MESSAGE),- ("insight_outside_the_payload", "insight", False, SCORING_DISABLED_MESSAGE),- ("search_turned_off_in_settings", "search", True, SCORING_TURNED_OFF_MESSAGE),- ("insight_turned_off_in_settings", "insight", True, SCORING_TURNED_OFF_MESSAGE),+ ("search_outside_the_payload", "search", "payload", SCORING_DISABLED_MESSAGE),+ ("insight_outside_the_payload", "insight", "payload", SCORING_DISABLED_MESSAGE),+ ("search_with_the_source_off", "search", "source", SCORING_SOURCE_OFF_MESSAGE),+ ("insight_with_the_source_off", "insight", "source", SCORING_SOURCE_OFF_MESSAGE),+ ("search_turned_off_in_settings", "search", "settings", SCORING_TURNED_OFF_MESSAGE),+ ("insight_turned_off_in_settings", "insight", "settings", SCORING_TURNED_OFF_MESSAGE),])def test_explains_an_empty_result_for_a_team_that_is_not_scored(- self, _name: str, endpoint: str, turned_off: bool, message: str+ self, _name: str, endpoint: str, off_by: str, message: str) -> None:- if turned_off:- SignalTeamConfig.objects.create(team=self.team, anomaly_scoring_enabled=False)- else:+ if off_by == "payload":self.payload.return_value = {"enabled": True, "organization_ids": []}+ elif off_by == "source":+ self.source.enabled = False+ self.source.save()+ else:+ SignalTeamConfig.objects.create(team=self.team, anomaly_scoring_enabled=False)body = self._get(endpoint, insight_id=self.insight.id).json()diff --git a/products/signals/frontend/generated/api.schemas.ts b/products/signals/frontend/generated/api.schemas.tsindex 7a51f29b59e9..bd1f26bea6c3 100644--- a/products/signals/frontend/generated/api.schemas.ts+++ b/products/signals/frontend/generated/api.schemas.ts@@ -833,9 +833,9 @@ export interface SignalTeamConfigApi {* @items.maxLength 255*/implementation_repositories?: string[]- /** Whether anomaly scoring scores this project's active trends insights every hour and writes the results as $anomaly_score events, which are not billed. True by default. Set false to stop new scores; events written before stay. Turning it on does not enroll a project that anomaly_scoring_available reports as not covered. */+ /** Legacy off switch for anomaly scoring. The Product analytics source (analytics / anomaly_investigation) now controls scoring: when that source is on, anomaly scoring scores this project's active trends insights and writes the results as $anomaly_score events, which are not billed. True by default. False still stops new scores; events written before stay. Turning it on does not enroll a project that anomaly_scoring_available reports as not covered. */anomaly_scoring_enabled?: boolean- /** Whether anomaly scoring covers this project, so anomaly_scoring_enabled has an effect. PostHog decides which projects anomaly scoring covers. */+ /** Whether the anomaly scoring rollout covers this project. PostHog decides which projects it covers. A covered project is scored only while its Product analytics source is on. */readonly anomaly_scoring_available: boolean/*** How many reports first became visible in the inbox during the current project-timezone day. This is the count the daily report limit compares against.diff --git a/products/signals/frontend/generated/api.zod.ts b/products/signals/frontend/generated/api.zod.tsindex 801965587384..991981165215 100644--- a/products/signals/frontend/generated/api.zod.ts+++ b/products/signals/frontend/generated/api.zod.ts@@ -140,7 +140,7 @@ export const SignalsConfigCreateBody = /* @__PURE__ */ zod.object({.boolean().optional().describe(- "Whether anomaly scoring scores this project's active trends insights every hour and writes the results as $anomaly_score events, which are not billed. True by default. Set false to stop new scores; events written before stay. Turning it on does not enroll a project that anomaly_scoring_available reports as not covered."+ "Legacy off switch for anomaly scoring. The Product analytics source (analytics \/ anomaly_investigation) now controls scoring: when that source is on, anomaly scoring scores this project's active trends insights and writes the results as $anomaly_score events, which are not billed. True by default. False still stops new scores; events written before stay. Turning it on does not enroll a project that anomaly_scoring_available reports as not covered."),})diff --git a/products/signals/frontend/inbox/components/config/AgentsRoster.tsx b/products/signals/frontend/inbox/components/config/AgentsRoster.tsxindex 8a23d3b0b2f3..3310f8325b4b 100644--- a/products/signals/frontend/inbox/components/config/AgentsRoster.tsx+++ b/products/signals/frontend/inbox/components/config/AgentsRoster.tsx@@ -21,6 +21,7 @@ import { LemonTagType } from 'lib/lemon-ui/LemonTag/LemonTag'import type { CISignalsSyncStatusEnumApi } from 'products/engineering_analytics/frontend/generated/api.schemas'import { isExternalSignalSource } from '../../externalSignalSources'+import { signalTeamConfigLogic } from '../../logics/signalTeamConfigLogic'import { sourceSteeringIsSet } from '../../logics/sourceSteeringModalLogic'import { signalSourcesLogic } from '../../signalSourcesLogic'import type { SourceProductDataStatus, SourceProductStatus } from '../../signalSourcesLogic'@@ -245,6 +246,8 @@ function EntityRow({interface ExpansionProps {agent: AgentRosterDefinition+ /** A second line under the detail, for a setting that only some projects have. */+ note?: stringstate: AgentSourceStateproduct?: SourceProductStatusenablingProduct: boolean@@ -315,6 +318,7 @@ function ProductDataStatus({function Expansion({agent,+ note,state,product,enablingProduct,@@ -363,6 +367,7 @@ function Expansion({<span>{alertScope ? ALERT_SCOPE_SOURCE_DETAIL : agent.detail}</span>{!hasMetaLine && docsLink ? <span> {docsLink}</span> : null}</p>+ {note && <p className="mb-0 text-xs text-secondary">{note}</p>}{hasMetaLine && (<div className="flex flex-wrap items-center justify-between gap-2">@@ -522,6 +527,7 @@ function Expansion({interface AgentRowProps {agent: AgentRosterDefinition+ note?: stringstate: AgentSourceStateproduct?: SourceProductStatusexpanded: boolean@@ -538,6 +544,7 @@ interface AgentRowProps {const AgentRow = memo(function AgentRow({agent,+ note,state,product,expanded,@@ -665,6 +672,7 @@ const AgentRow = memo(function AgentRow({{expanded && (<Expansionagent={agent}+ note={note}state={state}product={product}enablingProduct={enablingProduct}@@ -688,7 +696,11 @@ function AgentRosterGroupHeader({ group }: { group: AgentRosterGroup }): JSX.Elereturn <h4 className="m-0 text-sm font-semibold text-default">{group.label}</h4>}+const ANOMALY_SCORING_NOTE =+ 'This source also checks your active trends insights for anomalies and saves the results as $anomaly_score events, which are free.'+export function AgentsRoster(): JSX.Element {+ const { anomalyScoringAvailable } = useValues(signalTeamConfigLogic)const {externalSourceStates,rosterGroups,@@ -1014,6 +1026,7 @@ export function AgentsRoster(): JSX.Element {<AgentRowkey={agent.source}agent={agent}+ note={agent.source === 'analytics' && anomalyScoringAvailable ? ANOMALY_SCORING_NOTE : undefined}state={state}product={productStatusBySource[agent.source]}expanded={expandedSource === agent.source}@@ -1038,6 +1051,7 @@ export function AgentsRoster(): JSX.Element {[stateFor,linearIssuesConfig,+ anomalyScoringAvailable,openLinearTeamsPicker,isLinearIssuesToggling,sourceConfigsLoading,diff --git a/products/signals/frontend/inbox/components/config/SelfDrivingSection.tsx b/products/signals/frontend/inbox/components/config/SelfDrivingSection.tsxindex a5222354109d..a9a25425e55d 100644--- a/products/signals/frontend/inbox/components/config/SelfDrivingSection.tsx+++ b/products/signals/frontend/inbox/components/config/SelfDrivingSection.tsx@@ -734,8 +734,8 @@ function PullRequestLabelRow(): JSX.Element {}/**- * Team-wide opt-out of anomaly scoring. PostHog decides which projects scoring covers, so the row- * only renders for a covered project, and the switch can stop scoring but cannot start it.+ * The Product analytics source controls anomaly scoring now. This row only renders for a covered project+ * that turned scoring off with the older setting, so it can turn scoring back on.*/function AnomalyScoringRow(): JSX.Element {const { anomalyScoringEnabled, teamConfigUpdating } = useValues(signalTeamConfigLogic)@@ -744,7 +744,7 @@ function AnomalyScoringRow(): JSX.Element {return (<AutonomySettingRowtitle="Anomaly scoring"- description="Check your active trends insights for anomalies every hour. Results are saved as $anomaly_score events, which are free. Turn this off to stop new events. Events already saved stay."+ description="Scoring is off for this project from an earlier setting. Turn it on to check your active trends insights for anomalies again. After that, the Product analytics source turns scoring on and off."control={<LemonSwitchchecked={anomalyScoringEnabled}@@ -942,7 +942,8 @@ function PullRequestGenerationRow(): JSX.Element {* applies to, and every row shares one shape (`AutonomySettingRow`).*/export function SelfDrivingSection(): JSX.Element {- const { teamConfig, teamConfigLoading, anomalyScoringAvailable } = useValues(signalTeamConfigLogic)+ const { teamConfig, teamConfigLoading, anomalyScoringAvailable, anomalyScoringEnabled } =+ useValues(signalTeamConfigLogic)if (teamConfigLoading && teamConfig === null) {return <LemonSkeleton className="h-20 w-full rounded" />@@ -969,7 +970,7 @@ export function SelfDrivingSection(): JSX.Element {</AutonomySettingGroup><AutonomySettingGroup title="Reports" description="Applies to everyone in this project."><DailyReportLimitRow />- {anomalyScoringAvailable && <AnomalyScoringRow />}+ {anomalyScoringAvailable && !anomalyScoringEnabled && <AnomalyScoringRow />}</AutonomySettingGroup></div>)diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex df8618b0b797..46ef0cd0109a 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -107120,9 +107120,9 @@ export namespace Schemas {* @items.maxLength 255*/implementation_repositories?: string[];- /** Whether anomaly scoring scores this project's active trends insights every hour and writes the results as $anomaly_score events, which are not billed. True by default. Set false to stop new scores; events written before stay. Turning it on does not enroll a project that anomaly_scoring_available reports as not covered. */+ /** Legacy off switch for anomaly scoring. The Product analytics source (analytics / anomaly_investigation) now controls scoring: when that source is on, anomaly scoring scores this project's active trends insights and writes the results as $anomaly_score events, which are not billed. True by default. False still stops new scores; events written before stay. Turning it on does not enroll a project that anomaly_scoring_available reports as not covered. */anomaly_scoring_enabled?: boolean;- /** Whether anomaly scoring covers this project, so anomaly_scoring_enabled has an effect. PostHog decides which projects anomaly scoring covers. */+ /** Whether the anomaly scoring rollout covers this project. PostHog decides which projects it covers. A covered project is scored only while its Product analytics source is on. */readonly anomaly_scoring_available: boolean;/*** How many reports first became visible in the inbox during the current project-timezone day. This is the count the daily report limit compares against.diff --git a/services/mcp/src/generated/signals/api.ts b/services/mcp/src/generated/signals/api.tsindex 1076833b2b27..7ec151340cd0 100644--- a/services/mcp/src/generated/signals/api.ts+++ b/services/mcp/src/generated/signals/api.ts@@ -389,7 +389,7 @@ export const SignalsConfigCreateBody = () => zod.object({.boolean().optional().describe(- "Whether anomaly scoring scores this project's active trends insights every hour and writes the results as $anomaly_score events, which are not billed. True by default. Set false to stop new scores; events written before stay. Turning it on does not enroll a project that anomaly_scoring_available reports as not covered."+ "Legacy off switch for anomaly scoring. The Product analytics source (analytics \/ anomaly_investigation) now controls scoring: when that source is on, anomaly scoring scores this project's active trends insights and writes the results as $anomaly_score events, which are not billed. True by default. False still stops new scores; events written before stay. Turning it on does not enroll a project that anomaly_scoring_available reports as not covered."),})