: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
feat(signals): add replay vision to the inbox signal sources (#79946)
coryslater594a88e6e4b7
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex 1b4e9812442e..9d604e66cafd 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -6371,33 +6371,33 @@ snapshots:scenes-app-inbox-scene--self-driving-paused--light:hash: v1.k794b7964.54f6835c7d4a343bd6c9efef4189805b8dc5ea3347380b5d772ce55abaad79be.P7Ramt_0TgHAl4YgBsBumQ1QVxkb2ds9GsTaxbNAKRQscenes-app-inbox-signalsourcespanel--armed-but-tools-off--dark:- hash: v1.k794b7964.20050af8c990675d228756e418733c5a84800ab0e73268b3e84fcfaa77326033.UNceOt064IkgNJpcw8G21aEsRt_YUVxuwQcQVKE9rLc+ hash: v1.k794b7964.4eccbb229cc622764d4ff5d455f089a98fdebe9f5d9cbbcc5280c44fd8bd7f3c.HlgmZbqLubOWZoCcRljJWPEDRVRx-fH9V0D0gZqc-_kscenes-app-inbox-signalsourcespanel--armed-but-tools-off--light:- hash: v1.k794b7964.f4db053221794d14ccfc7fc4b2db58561926e8926d1f86e14e5ddb0e7c33af8c.bzlhH-Oz8GQ-NWZbIVYFM5uNtShPRP8boC7zUw17Pak+ hash: v1.k794b7964.0af0f536b4cbfcbca4960d73826c8908a66d04b781dc2ea8ae93216b8303b962.IF1bvyMLbRnQod9tcQKT6aEk3e_mkJ2BqysGOdG_N88scenes-app-inbox-signalsourcespanel--arming-blocked--dark:- hash: v1.k794b7964.f0f8e6ee75faff8a85951d2064af260f1c632dec27f6f8bf985ae27a337d7921.eaoCUH22jbc6iiRsFISLR2MRtMFenX2NSOrs_qC3y1Y+ hash: v1.k794b7964.6508408c7d1d2a73f0d7d9a6640ecc86ddd8a55070cb5ccec58d5eaecc9a1ee1.QvsqSw3NH6kNbyF_9gEBXt-VA0GGqozrosTOb4wrQ0sscenes-app-inbox-signalsourcespanel--arming-blocked--light:- hash: v1.k794b7964.d9c20994fe99d71927a5fa272cd42da606fc7478a728560aff6e92f21729d367.kmiO-_9bvOGcx7Phf2q7dhuKyjQP8AxtaTA4t1ORYc0+ hash: v1.k794b7964.43495af5b8515cb48f1e0ef36924486a8eafcfd97d4218f74e231d45626abc4f.jEPdlDtnpC0S5-nC-oi8N0OrmYMKCC9VGArdKLu9akgscenes-app-inbox-signalsourcespanel--event-definitions-unavailable--dark:- hash: v1.k794b7964.c93df4a3587e8d72869fecea9a42afbb1b6ddda8cc4973c57614c413c3833987.bDB_pp6afKjWhk2R36qPRGrcxKqn86ic1gt93zYkA14+ hash: v1.k794b7964.273fd40f524dd36cbda622419dcae64b55b44a023bf4706e2da203be2c0555cc.sLPD2nOQxiI87UsGVzIb_q_3-qk8shvdQVr3reIjQUwscenes-app-inbox-signalsourcespanel--event-definitions-unavailable--light:- hash: v1.k794b7964.a2c50f3003aed34c440e362882b3b8deecfa37c25b3c2b8d97bd2fb6151c421a.QxzAw2wSH-SgFTBYv2ZjTUOtI5k2sn3m_tiUJExYkVI+ hash: v1.k794b7964.b3f2a475f205947742faa972ba7cafabb5e0097cfcbc3dcc13ee13419956cc78.SXa3oHb4NDlQPBQFUzNf9cV-WtEC3UMcm7kD5PSDkIgscenes-app-inbox-signalsourcespanel--everything-healthy--dark:- hash: v1.k794b7964.e87417e8e548e011de059e4502a22f8d08acc9c18c49e17d1675535d79439049.pF_JHdGWr8AWgR0UpDIdZbFCjdM3G08-1IofaVJ9U3c+ hash: v1.k794b7964.2277dfee7316498948f33c529c863a6de38821c4e202927888716020ab02d2d1.TzO2XhJZyyGDR6t2oDkEp0AfZPtOuoE4ID05kMTCwHkscenes-app-inbox-signalsourcespanel--everything-healthy--light:- hash: v1.k794b7964.ff0aa89f58531c110b4575d72dd3fe170c9cd61e6723846301325eb84e740eb8.zKKNFUy6y8j1iIVNM0tPiOnXoZgO3f9pYO5xxZYlVAI+ hash: v1.k794b7964.479e04067918069ad9a1e3c733f545e8d4f5ba1eb217c09d991e0cc8001c1d14.xPY2-HMT2hiI8NUPr4WXaMwTF4cVVlj3wuPbw1IM2nwscenes-app-inbox-signalsourcespanel--playground--dark:- hash: v1.k794b7964.e8e4e30e2747b995e7cd20b9d1e073d8c92158362f32e288f40f44b781628bf4.PJIcVexkRlxvzyFWUTMS4_BqQl7Q2T1x2ufMs591KAk+ hash: v1.k794b7964.f0f6092743d729168f52bd716c5a323ba982d46f4abecd29f299304b7a51e5f2.zrl0G5G7_AkS2ffD80fFMBE8i6_YkgJdn2xp8b4r3Tcscenes-app-inbox-signalsourcespanel--playground--light:- hash: v1.k794b7964.1aa4b81b48bdb5820636df2b4eaf9aef3e65b79775c5f29d18132cceac6828c3.2Pv05tzAtuUky1gWdAjqabTlVCchf24mjEYvWm1TK44+ hash: v1.k794b7964.0d6f8094989e0a016829dccf76a3a67c94404e3cb3ebe97e941d2a8ce9ca429f.MzaG8BDySWv8lNlZHXxJsStnoAYa5eqAgnLQXHkqOxEscenes-app-inbox-signalsourcespanel--server-side-exceptions-only--dark:- hash: v1.k794b7964.e8e4e30e2747b995e7cd20b9d1e073d8c92158362f32e288f40f44b781628bf4.isFB5fHez5FGxRmGxUyALxw1He2MuOYMZ_A3DeU9NFc+ hash: v1.k794b7964.f0f6092743d729168f52bd716c5a323ba982d46f4abecd29f299304b7a51e5f2.AnaXXNhTZ9-hx3gYz2B9VemxUGlj4APgvZu24CSFfTEscenes-app-inbox-signalsourcespanel--server-side-exceptions-only--light:- hash: v1.k794b7964.1aa4b81b48bdb5820636df2b4eaf9aef3e65b79775c5f29d18132cceac6828c3.-Lzah6U8iQ65oCGO5K-t8yWZq_RvN7BtOIKuyhC2K98+ hash: v1.k794b7964.0d6f8094989e0a016829dccf76a3a67c94404e3cb3ebe97e941d2a8ce9ca429f.HyqGUiaBGi1C-o9srATw1iMGCL7zPrFui7zJcI8BYaIscenes-app-inbox-signalsourcespanel--tools-on-no-recent-data--dark:- hash: v1.k794b7964.1fbe059d2093a6683e1cbfe30b569913c56e3e594d9f92092aec13343a681292.uql5SNStGflZ2au-7Kgw1X_5TS3oP_XDBTUHb-P3AH0+ hash: v1.k794b7964.8bfaaa7e49580db377cbc5469e193d84f23d37a1f980e13b3d2c9a2f7284fcb6.c2O4XkGT1XxL4SqcSChHmkJjDKdt9S0EV64LCzulm78scenes-app-inbox-signalsourcespanel--tools-on-no-recent-data--light:- hash: v1.k794b7964.147252b7bbb68397e1e5625809ec372f1dc084add4ffd6e440d298ad83092cdf.sI9t_SA51MQuBfFQWlr7j6khN_HVZffGe2___bnG5ow+ hash: v1.k794b7964.6c18d86eff41c1e43f5e038edd785adf1c116023934a294b28b034b01d23e0c3.vnFGIkh9kZ_zdHi_D36WNlDQPocyjk_HjBqJ3PM6XlMscenes-app-inbox-tabs--pull-requests--dark:hash: v1.k794b7964.474d8e744637e08afd4bb7540f0f5dafd6a79342c2f547188cb436b55f9ef8e7.PiyD1Zkhkot-_DKLU3W0T5uA7rvpTUTn5bKChCa3AV4scenes-app-inbox-tabs--pull-requests--light:@@ -7207,7 +7207,7 @@ snapshots:scenes-app-settings-authentication-domains--no-domains--light:hash: v1.k794b7964.37755257eeeb09bcb190a4623e6554e356ffcc6b4e61086b8d2427a3796af34b.eJhnmp6Mqw_TfNQhRHgzZylOtfr8VMwxaRjOdzUHuiIscenes-app-settings-authentication-domains--one-unverified-domain--dark:- hash: v1.k794b7964.ba64063f3c9c93c5f26f1ef7b83800afeb7a63aec7008d369e2cd7538c4d760b.w4icGggF4i9ltix044heGQLCxuyCXP0irKyWwkKl6Fs+ hash: v1.k794b7964.d2354aea8e40abfcfeb18691d15e48abc24724460dbc0118185c750d3f8ce6d1.Gcj1tCTTgepeyP-Ep4JIhieodM8RlFeAjTQGNkP2UeQscenes-app-settings-authentication-domains--one-unverified-domain--light:hash: v1.k794b7964.9f4f53aee807047bda1de6e3898a5c784bca50bb1f0cbf1d3333e3323e056b41.1g_1hgiCN3qaOaI0lA8Ajwhb8mZhXu95OkHJq1dGfv0scenes-app-settings-environment--settings-environment-access-control--dark:diff --git a/products/replay_vision/backend/facade/api.py b/products/replay_vision/backend/facade/api.pyindex bcfb60a358c7..25f4c81d2443 100644--- a/products/replay_vision/backend/facade/api.py+++ b/products/replay_vision/backend/facade/api.py@@ -5,7 +5,7 @@ from django.db.models import Case, Whenfrom posthog.rbac.user_access_control import UserAccessControlfrom products.replay_vision.backend.models.replay_observation import ObservationStatus, ReplayObservation-from products.replay_vision.backend.models.replay_scanner import ScannerType+from products.replay_vision.backend.models.replay_scanner import ReplayScanner, ScannerTypefrom products.replay_vision.backend.observation_formatting import format_line, read_outputfrom products.replay_vision.backend.scanner_access import scanners_for_reading_observations@@ -79,3 +79,13 @@ def fetch_page_session_observations(return Nonereturn as_untrusted_data("observations", lines)+++def has_signal_emitting_scanner(team_id: int) -> bool:+ """Whether any of the team's scanners feeds findings into the Signals inbox.++ Replay Vision authorizes signal emission per scanner (`emits_signals`) instead of writing a+ `SignalSourceConfig` row, so callers asking "is this source on?" can't answer it from the+ signals tables alone. See `SignalSourceConfig.is_source_enabled`.+ """+ return ReplayScanner.objects.filter(team_id=team_id, enabled=True, emits_signals=True).exists()diff --git a/products/replay_vision/backend/tests/test_signals_onboarding.py b/products/replay_vision/backend/tests/test_signals_onboarding.pynew file mode 100644index 000000000000..089a64d0dbfb--- /dev/null+++ b/products/replay_vision/backend/tests/test_signals_onboarding.py@@ -0,0 +1,50 @@+from posthog.test.base import BaseTest++from products.replay_vision.backend.models import ReplayScanner+from products.replay_vision.backend.models.replay_scanner import ScannerModel, ScannerType+from products.signals.backend.facade.api import has_enabled_source, onboarding_sources, set_sources+++class TestOnboardingSources(BaseTest):+ def _emitting_scanner(self, **overrides) -> ReplayScanner:+ defaults = {+ "team": self.team,+ "name": "my-scanner",+ "scanner_type": ScannerType.MONITOR,+ "scanner_config": {"prompt": "test"},+ "model": ScannerModel.GEMINI_3_6_FLASH,+ "enabled": True,+ "emits_signals": True,+ }+ defaults.update(overrides)+ return ReplayScanner.objects.create(**defaults)++ def _source(self, key: str):+ return next(source for source in onboarding_sources(self.team.id) if source.key == key)++ def test_emitting_scanner_alone_counts_as_an_enabled_source(self):+ # Replay Vision writes no SignalSourceConfig row, so a scanner-only team used to read as+ # having nothing on, leaving the Slack onboarding "Sources" step unchecked forever.+ assert has_enabled_source(self.team.id) is False+ self._emitting_scanner()+ assert has_enabled_source(self.team.id) is True++ def test_scanner_not_emitting_or_disabled_does_not_count(self):+ self._emitting_scanner(emits_signals=False)+ self._emitting_scanner(name="off-scanner", enabled=False)+ assert has_enabled_source(self.team.id) is False++ def test_replay_vision_is_reported_but_never_tickable(self):+ replay_vision = self._source("replay_vision")+ assert replay_vision.togglable is False+ assert replay_vision.enabled is False++ self._emitting_scanner()+ assert self._source("replay_vision").enabled is True++ def test_set_sources_leaves_replay_vision_alone(self):+ # It has no config row to write, and submitting the checkbox snapshot without it must not+ # read as "untick Replay Vision".+ self._emitting_scanner()+ assert set_sources(self.team.id, None, ["error_tracking"]) == []+ assert self._source("replay_vision").enabled is Truediff --git a/products/signals/backend/facade/api.py b/products/signals/backend/facade/api.pyindex 278cac610738..66e6135b999d 100644--- a/products/signals/backend/facade/api.py+++ b/products/signals/backend/facade/api.py@@ -1,5 +1,5 @@import dataclasses-from collections.abc import Sequence+from collections.abc import Callable, Sequencefrom datetime import timedeltafrom typing import TYPE_CHECKING@@ -200,12 +200,23 @@ _DEFAULT_SESSION_ANALYSIS_SAMPLE_RATE = 0.1@dataclasses.dataclass(frozen=True)class OnboardingSource:- """A signal source offered as a checkbox in the Slack onboarding flow, with current state."""+ """A signal source shown in the Slack onboarding flow, with current state."""key: strlabel: strdescription: strenabled: bool+ # False for a source that authorizes itself elsewhere: onboarding reports it instead of+ # offering a checkbox that would have nothing to write.+ togglable: bool = True+++def _has_emitting_replay_scanner(team_id: int) -> bool:+ from products.replay_vision.backend.facade.api import (+ has_signal_emitting_scanner, # noqa: PLC0415 — keeps the Replay Vision stack off this import path+ )++ return has_signal_emitting_scanner(team_id)@dataclasses.dataclass(frozen=True)@@ -214,8 +225,11 @@ class _SourceSpec:label: strdescription: str# The SignalSourceConfig (source_product, source_type) rows ticking this source enables.- pairs: tuple[tuple[str, str], ...]+ # Empty when the source authorizes itself elsewhere, which is also what makes it untickable.+ pairs: tuple[tuple[str, str], ...] = ()needs_ai_approval: bool = False+ # Reads the on/off state of a source that has no config row to read it from.+ enabled_check: Callable[[int], bool] | None = None_SOURCE_CATALOG: tuple[_SourceSpec, ...] = (@@ -229,10 +243,16 @@ _SOURCE_CATALOG: tuple[_SourceSpec, ...] = (("error_tracking", "issue_spiking"),),),+ _SourceSpec(+ "replay_vision",+ "Replay vision",+ "bugs and UX problems scanners find in recordings",+ enabled_check=_has_emitting_replay_scanner,+ ),_SourceSpec("session_replay",- "Session replay analysis",- "problems real users hit",+ "Session replay analysis (legacy)",+ "problems real users hit. Replay vision covers this now",(("session_replay", "session_analysis_cluster"),),needs_ai_approval=True,),@@ -247,8 +267,13 @@ def _ai_data_processing_approved(team_id: int) -> bool:def has_enabled_source(team_id: int) -> bool:- """True once the team has at least one enabled signal source — i.e. there's something to respond to."""- return SignalSourceConfig.objects.filter(team_id=team_id, enabled=True).exists()+ """True once the team has at least one enabled signal source — i.e. there's something to respond to.++ Replay Vision is checked separately because it has no config row to find: each scanner's own+ `emits_signals` flag authorizes it (see `SignalSourceConfig.is_source_enabled`)."""+ if SignalSourceConfig.objects.filter(team_id=team_id, enabled=True).exists():+ return True+ return _has_emitting_replay_scanner(team_id)def team_ids_with_source_product_enabled(source_product: str) -> list[int]:@@ -281,7 +306,10 @@ def onboarding_sources(team_id: int) -> list[OnboardingSource]:key=spec.key,label=spec.label,description=spec.description,- enabled=any(pair in enabled_pairs for pair in spec.pairs),+ enabled=(+ spec.enabled_check(team_id) if spec.enabled_check else any(pair in enabled_pairs for pair in spec.pairs)+ ),+ togglable=bool(spec.pairs),)for spec in _SOURCE_CATALOG]@@ -295,6 +323,10 @@ def set_sources(team_id: int, user_id: int | None, selected_keys: list[str]) ->ai_approved = _ai_data_processing_approved(team_id)blocked: list[str] = []for spec in _SOURCE_CATALOG:+ if not spec.pairs:+ # Authorized elsewhere (Replay Vision, per scanner), so onboarding never offered it as a+ # checkbox and has nothing to write here.+ continuewant_on = spec.key in selectedif want_on and spec.needs_ai_approval and not ai_approved:# Wanted but AI-gated: leave the source as-is. Disabling here would silently turn off adiff --git a/products/signals/frontend/inbox/SourcesList.tsx b/products/signals/frontend/inbox/SourcesList.tsxindex e95dac216d84..916217e8147c 100644--- a/products/signals/frontend/inbox/SourcesList.tsx+++ b/products/signals/frontend/inbox/SourcesList.tsx@@ -179,7 +179,7 @@ export function SourcesList(): JSX.Element {{iconForType('session_replay')}</div>}- title="PostHog Session Replay"+ title="PostHog Session replay"description="Session recordings + event data → Signals"variant="available"checked={!!sessionAnalysisConfig?.enabled}@@ -206,7 +206,7 @@ export function SourcesList(): JSX.Element {{iconForType('error_tracking')}</div>}- title="PostHog Error Tracking"+ title="PostHog Error tracking"description="New issues, reopenings, and volume spikes → Signals"variant="available"checked={errorTrackingIsFullyEnabled}@@ -226,7 +226,7 @@ export function SourcesList(): JSX.Element {<Sourceicon={<IconGraph className="size-5 text-accent" />}- title="PostHog Product Analytics"+ title="PostHog Product analytics"description="Anomalies in your tracked metrics, investigated automatically → Signals"variant="available"checked={!!anomalyInvestigationConfig?.enabled}@@ -258,7 +258,7 @@ export function SourcesList(): JSX.Element {<Sourceicon={<IconGithub className="size-5" />}- title="GitHub Issues"+ title="GitHub issues"description="New issues and updates → Signals"variant="available"checked={!!githubIssuesConfig?.enabled}diff --git a/products/signals/frontend/inbox/components/config/AgentsRoster.tsx b/products/signals/frontend/inbox/components/config/AgentsRoster.tsxindex 0cc5fa95e9fa..b270e01fbbf1 100644--- a/products/signals/frontend/inbox/components/config/AgentsRoster.tsx+++ b/products/signals/frontend/inbox/components/config/AgentsRoster.tsx@@ -1,8 +1,17 @@import { useActions, useValues } from 'kea'-import { memo, useCallback } from 'react'+import { memo, useCallback, useMemo, useState } from 'react'-import { IconArrowUpRight } from '@posthog/icons'-import { LemonButton, LemonSkeleton, LemonSwitch, LemonTag, Link, Spinner } from '@posthog/lemon-ui'+import { IconArrowUpRight, IconChevronRight, IconPlus } from '@posthog/icons'+import {+ LemonButton,+ LemonInput,+ LemonSkeleton,+ LemonSwitch,+ LemonTag,+ Link,+ Spinner,+ Tooltip,+} from '@posthog/lemon-ui'import { LemonTagType } from 'lib/lemon-ui/LemonTag/LemonTag'import { featureFlagLogic } from 'lib/logic/featureFlagLogic'@@ -11,35 +20,71 @@ import type { SyncStatusEnumApi } from 'products/engineering_analytics/frontend/import { signalSourcesLogic } from '../../signalSourcesLogic'import type { SourceToolDataStatus, SourceToolStatus } from '../../signalSourcesLogic'-import { SignalSourceConfig, SignalSourceConfigStatus } from '../../types'+import { SignalSourceConfig, SignalSourceConfigStatus, SignalSourceType } from '../../types'import { getSourceProductMeta } from '../badges/sourceProductIcons'import { AGENT_ROSTER_GROUPS, AgentRosterDefinition, AgentRosterSource } from './agentRosterMeta'type AgentRosterStatus = 'standby' | 'watching' | 'syncing' | 'sync_failed'-const STATUS_TAG: Record<AgentRosterStatus, { label: string; type: LemonTagType }> = {- standby: { label: 'Standby', type: 'muted' },- watching: { label: 'Watching', type: 'success' },- syncing: { label: 'Syncing', type: 'primary' },- sync_failed: { label: 'Sync failed', type: 'danger' },+/** Copy for the three error tracking signal types, which are enum values rather than named records. */+const ERROR_TRACKING_TYPE_LABELS: Partial<Record<string, { name: string; detail: string }>> = {+ [SignalSourceType.IssueCreated]: {+ name: 'New issue',+ detail: 'An error that has not been seen before.',+ },+ [SignalSourceType.IssueReopened]: {+ name: 'Reopened issue',+ detail: 'A resolved issue that came back.',+ },+ [SignalSourceType.IssueSpiking]: {+ name: 'Spiking issue',+ detail: 'A known issue whose rate jumped above its baseline.',+ },}+/** Entity kinds arrive as raw enum values, so they need display copy before they reach a tag. */+const ENTITY_KIND_LABELS: Record<string, string> = {+ monitor: 'Monitor',+ classifier: 'Classifier',+ scorer: 'Scorer',+ summarizer: 'Summarizer',+ llm_judge: 'LLM judge',+ hog: 'Hog',+ sentiment: 'Sentiment',+}++function entityKindLabel(kind: string): string {+ return ENTITY_KIND_LABELS[kind] ?? kind+}++/** Above this many entities the list gets a filter box rather than only a scroll bar. */+const ENTITY_FILTER_THRESHOLD = 8+function resolveAgentStatus(armed: boolean,syncStatus: SignalSourceConfigStatus | SyncStatusEnumApi | null | undefined): AgentRosterStatus {+ if (syncStatus === SignalSourceConfigStatus.FAILED) {+ return 'sync_failed'+ }if (!armed) {return 'standby'}if (syncStatus === SignalSourceConfigStatus.RUNNING) {return 'syncing'}- if (syncStatus === SignalSourceConfigStatus.FAILED) {- return 'sync_failed'- }return 'watching'}+/** One individually switchable thing inside a source: a scanner, an evaluation, a signal type. */+interface RosterEntity {+ id: string+ name: string+ detail?: string+ kind?: string+ enabled: boolean+}+/** Per-source derived state assembled by `AgentsRoster` from `signalSourcesLogic`. */interface AgentSourceState {armed: boolean@@ -47,26 +92,125 @@ interface AgentSourceState {/** True for data-warehouse sources that haven't been connected yet – shows a Connect button. */requiresSetup: booleansyncStatus: SignalSourceConfigStatus | SyncStatusEnumApi | null | undefined+ entities: RosterEntity[]+ /** The entity list is still loading, so the count would read as a wrong zero. */+ entitiesLoading: boolean}-function AgentIcon({ source }: { source: AgentRosterDefinition }): JSX.Element {+function AgentIcon({ source }: { source: AgentRosterDefinition }): JSX.Element | null {const meta = getSourceProductMeta(source.sourceProduct)- const Icon = meta?.Icon+ if (!meta?.Icon) {+ return null+ }+ const Icon = meta.Icon+ return <Icon className={`shrink-0 text-base ${meta.colorClass}`} />+}++function StatusDot({+ status,+ tool,+ toolOff,+}: {+ status: AgentRosterStatus+ tool?: SourceToolStatus+ toolOff: boolean+}): JSX.Element {+ let className = 'bg-border-bold'+ let title = 'Standby'+ if (toolOff) {+ title = `${tool?.toolName} is off, so this source has nothing to read`+ } else if (status === 'sync_failed') {+ className = 'bg-danger'+ title = 'Sync failed'+ } else if (status === 'syncing') {+ className = 'bg-accent'+ title = 'Syncing'+ } else if (status === 'watching') {+ // A hollow dot means watching but nothing has arrived, so the two read apart at a glance.+ className = tool?.dataStatus === 'none' ? 'border border-success' : 'bg-success'+ title =+ tool?.dataStatus === 'none'+ ? 'Watching, no data in the last 30 days'+ : tool?.dataStatus === 'recent'+ ? 'Watching, receiving data'+ : 'Watching'+ }+ return (+ <Tooltip title={title}>+ <span className={`size-2 shrink-0 rounded-full ${className}`} />+ </Tooltip>+ )+}++/** Only the states worth interrupting a scan for. Everything healthy shows no tag at all. */+function notableTag(+ status: AgentRosterStatus,+ armed: boolean,+ toolOff: boolean,+ tool?: SourceToolStatus+): { label: string; type: LemonTagType } | null {+ if (toolOff) {+ return { label: 'Tool off', type: 'warning' }+ }+ if (status === 'sync_failed') {+ return { label: 'Sync failed', type: 'danger' }+ }+ if (status === 'syncing') {+ return { label: 'Syncing', type: 'primary' }+ }+ if (armed && tool?.dataStatus === 'none') {+ return { label: 'No recent data', type: 'muted' }+ }+ return null+}++function EntityRow({+ entity,+ onToggle,+ disabledReason,+}: {+ entity: RosterEntity+ onToggle: () => void+ disabledReason?: string+}): JSX.Element {return (- <div className="flex size-8 shrink-0 items-center justify-center rounded bg-surface-secondary ring-1 ring-inset ring-primary">- {Icon ? <Icon className={`text-lg ${meta.colorClass}`} /> : null}+ <div className="flex items-center gap-2 px-2 py-1 hover:bg-surface-secondary">+ <LemonSwitch+ size="small"+ checked={entity.enabled}+ onChange={onToggle}+ disabledReason={disabledReason}+ aria-label={entity.name}+ />+ <span+ className={`max-w-60 shrink-0 truncate text-xs font-medium ${+ entity.enabled ? 'text-default' : 'text-muted'+ }`}+ >+ {entity.name}+ </span>+ {entity.kind && (+ <LemonTag size="small" type="muted">+ {entityKindLabel(entity.kind)}+ </LemonTag>+ )}+ <span className="min-w-0 flex-1 truncate text-xs text-muted">{entity.detail}</span></div>)}-interface AgentCardProps {+interface ExpansionProps {agent: AgentRosterDefinitionstate: AgentSourceStatetool?: SourceToolStatusenablingTool: boolean- onToggle: (source: AgentRosterSource) => voidonEnableTool: (tool: SourceToolStatus) => void+ onToggleEntity: (entityId: string) => void+ onConfigureFilters?: () => voidonRetryData: () => void+ /** AI observability only: the periodic digest, which is its own signal stream, not a master. */+ onToggleReports?: () => void+ reportsEnabled?: boolean}function ToolDataStatus({@@ -84,7 +228,7 @@ function ToolDataStatus({if (status === 'loading') {return (- <div className="flex items-center gap-1.5 mt-2 ml-11 text-xs text-muted">+ <div className="flex items-center gap-1.5 text-xs text-muted"><Spinner className="text-xs" />Checking for recent data</div>@@ -93,16 +237,9 @@ function ToolDataStatus({if (status === 'error') {return (- <div className="flex items-center gap-2 mt-2 ml-11 text-xs text-muted">+ <div className="flex items-center gap-2 text-xs text-muted"><span>Couldn't check recent data.</span>- <LemonButton- type="tertiary"- size="xsmall"- onClick={(event) => {- event.stopPropagation()- onRetry()- }}- >+ <LemonButton type="tertiary" size="xsmall" onClick={onRetry}>Try again</LemonButton></div>@@ -111,7 +248,7 @@ function ToolDataStatus({if (status === 'recent') {return (- <div className="flex items-center gap-1.5 mt-2 ml-11 text-xs text-muted">+ <div className="flex items-center gap-1.5 text-xs text-muted"><span className="size-1.5 rounded-full bg-success" />Data received in the last 30 days</div>@@ -119,16 +256,11 @@ function ToolDataStatus({}return (- <div className="flex items-center gap-2 mt-2 ml-11 text-xs text-muted">+ <div className="flex items-center gap-2 text-xs text-muted"><span className="size-1.5 rounded-full bg-border-bold" /><span>No data received in the last 30 days.</span>{agent.docsUrl && (- <Link- to={agent.docsUrl}- target="_blank"- className="inline-flex items-center gap-1"- onClick={(event) => event.stopPropagation()}- >+ <Link to={agent.docsUrl} target="_blank" className="inline-flex items-center gap-1">Check setup<IconArrowUpRight /></Link>@@ -137,84 +269,250 @@ function ToolDataStatus({)}-const AgentCard = memo(function AgentCard({+function Expansion({agent,state,tool,enablingTool,+ onEnableTool,+ onToggleEntity,+ onConfigureFilters,+ onRetryData,+ onToggleReports,+ reportsEnabled,+}: ExpansionProps): JSX.Element {+ const [filter, setFilter] = useState('')+ const { entities } = state+ const noun = agent.entityNoun ?? 'items'+ const query = filter.trim().toLowerCase()+ const visible = query ? entities.filter((entity) => entity.name.toLowerCase().includes(query)) : entities+ const enabledCount = entities.filter((entity) => entity.enabled).length+ const toolOff = tool?.enabled === false++ return (+ <div className="flex flex-col gap-2 border-t border-primary bg-surface-secondary px-3 py-2.5">+ {/* Never the tagline again: this line says what triggers a signal, not what is watched. */}+ <p className="mb-0 text-xs text-secondary">+ {agent.detail}{' '}+ {agent.docsUrl && (+ <Link to={agent.docsUrl} target="_blank" className="whitespace-nowrap text-xs">+ Learn about {agent.docsLabel ?? agent.label}+ <IconArrowUpRight />+ </Link>+ )}+ </p>++ {toolOff && tool ? (+ <div className="flex items-center gap-2">+ <span className="text-xs text-warning">+ {tool.toolName} is off, so this source has nothing to read.+ </span>+ {tool.enablement && (+ <LemonButton+ type="secondary"+ size="xsmall"+ loading={enablingTool}+ onClick={() => onEnableTool(tool)}+ >+ Turn it on+ </LemonButton>+ )}+ </div>+ ) : tool ? (+ <ToolDataStatus agent={agent} status={tool.dataStatus} onRetry={onRetryData} />+ ) : null}++ {onToggleReports && (+ <div className="flex items-start gap-2">+ <LemonSwitch+ size="small"+ className="mt-0.5"+ checked={!!reportsEnabled}+ onChange={onToggleReports}+ aria-label="Summary reports"+ />+ <div className="min-w-0">+ <div className="text-xs font-medium text-default">Summary reports</div>+ <p className="mb-0 text-xs text-secondary">+ File one report for each evaluation, on a schedule or after a set number of new results.+ This is separate from the individual results below.+ </p>+ </div>+ </div>+ )}++ {onConfigureFilters && (+ <div className="flex items-center gap-2">+ <span className="text-xs text-secondary">Limit which recordings this source analyzes.</span>+ <LemonButton type="secondary" size="xsmall" onClick={onConfigureFilters}>+ Configure filters+ </LemonButton>+ </div>+ )}++ {state.entitiesLoading ? (+ <LemonSkeleton className="h-16 w-full" />+ ) : entities.length > 0 ? (+ <div className="flex flex-col gap-1.5">+ <div className="flex items-center gap-2">+ <span className="text-xs font-medium text-default">+ {enabledCount} of {entities.length} {noun} on+ </span>+ {entities.length > ENTITY_FILTER_THRESHOLD && (+ <LemonInput+ type="search"+ size="xsmall"+ className="w-52"+ placeholder={`Filter ${noun}`}+ value={filter}+ onChange={setFilter}+ />+ )}+ <div className="flex-1" />+ {agent.manageUrl && (+ <LemonButton+ size="xsmall"+ type="secondary"+ to={agent.manageUrl}+ icon={<IconPlus />}+ targetBlank+ >+ New {agent.entityNounSingular}+ </LemonButton>+ )}+ </div>+ <div className="max-h-46 overflow-y-auto rounded border border-primary bg-surface-primary">+ {visible.length === 0 ? (+ <p className="mb-0 px-2 py-3 text-center text-xs text-muted">+ No {noun} match that filter.+ </p>+ ) : (+ visible.map((entity) => (+ <EntityRow+ key={entity.id}+ entity={entity}+ onToggle={() => onToggleEntity(entity.id)}+ disabledReason={+ state.loading+ ? 'Saving'+ : toolOff && !entity.enabled+ ? `Turn on ${tool?.toolName} first. This source reads its data.`+ : undefined+ }+ />+ ))+ )}+ </div>+ </div>+ ) : agent.entityNoun ? (+ <div className="flex items-center gap-2">+ <span className="text-xs text-secondary">No {noun} yet.</span>+ {agent.manageUrl && (+ <LemonButton+ size="xsmall"+ type="secondary"+ to={agent.manageUrl}+ icon={<IconPlus />}+ targetBlank+ >+ New {agent.entityNounSingular}+ </LemonButton>+ )}+ </div>+ ) : null}+ </div>+ )+}++interface AgentRowProps {+ agent: AgentRosterDefinition+ state: AgentSourceState+ tool?: SourceToolStatus+ expanded: boolean+ enablingTool: boolean+ onExpand: () => void+ onToggle: (source: AgentRosterSource) => void+ onToggleEntity: (source: AgentRosterSource, entityId: string) => void+ onEnableTool: (tool: SourceToolStatus) => void+ onConfigureFilters?: () => void+ onRetryData: () => void+ onToggleReports?: () => void+ reportsEnabled?: boolean+}++const AgentRow = memo(function AgentRow({+ agent,+ state,+ tool,+ expanded,+ enablingTool,+ onExpand,onToggle,+ onToggleEntity,onEnableTool,+ onConfigureFilters,onRetryData,-}: AgentCardProps): JSX.Element {- const { armed, loading, requiresSetup, syncStatus } = state+ onToggleReports,+ reportsEnabled,+}: AgentRowProps): JSX.Element {+ const { armed, loading, requiresSetup, syncStatus, entities } = stateconst status = resolveAgentStatus(armed, syncStatus)- const statusTag = STATUS_TAG[status]const toolOff = tool?.enabled === false// An off tool blocks arming (the source would watch nothing), never disarming.const armingBlocked = toolOff && !armed- const isInteractive = !loading && !armingBlocked-- const handleCardClick = useCallback(() => {- if (!isInteractive) {- return- }- onToggle(agent.source)- }, [agent.source, isInteractive, onToggle])-+ const tag = notableTag(status, armed, toolOff, tool)+ // A source whose entities the user creates gets no master switch. Arming it would write to+ // every entity at once, and turning it off and on again would not restore the earlier subset.+ const hasMasterSwitch = !agent.entitiesAreUserCreated+ const enabledCount = entities.filter((entity) => entity.enabled).lengthreturn (- <div- onClick={isInteractive ? handleCardClick : undefined}- className={[- 'rounded border p-3 transition-colors',- armed ? 'border-accent bg-accent-highlight-secondary' : 'border-primary bg-surface-primary',- isInteractive ? 'cursor-pointer hover:border-secondary' : 'cursor-default',- ].join(' ')}- >- <div className="flex items-start justify-between gap-3">- <div className="flex items-start gap-3 min-w-0 flex-1">- <AgentIcon source={agent} />- <div className="flex flex-col gap-1 min-w-0">- <div className="flex items-center gap-2 flex-wrap">- <span className="font-medium text-sm text-default">{agent.label}</span>- {agent.alpha && (- <LemonTag type="completion" size="small">- Alpha- </LemonTag>- )}- </div>- <p className="text-sm text-secondary leading-snug mb-0">{agent.description}</p>- {agent.docsUrl && (- <Link- to={agent.docsUrl}- target="_blank"- className="inline-flex items-center gap-1 text-sm w-fit"- onClick={(e) => e.stopPropagation()}- >- Learn about {agent.docsLabel ?? agent.label}- <IconArrowUpRight />- </Link>+ <div>+ {/* A legacy row stays dimmed even while in use, so it reads as the older option. */}+ <div+ onClick={onExpand}+ className={`group flex h-13 cursor-pointer items-center gap-2 px-2 transition-colors ${+ expanded ? 'bg-surface-secondary' : 'hover:bg-surface-secondary'+ } ${agent.legacy ? 'opacity-60 hover:opacity-100' : ''}`}+ >+ <StatusDot status={status} tool={tool} toolOff={toolOff} />+ <AgentIcon source={agent} />+ <div className="flex min-w-0 flex-1 flex-col">+ <div className="flex items-center gap-2">+ <span+ className={`truncate text-sm leading-5 ${armed ? 'font-medium text-default' : 'text-secondary'}`}+ >+ {agent.label}+ </span>+ {agent.alpha && (+ <LemonTag type="completion" size="small">+ Alpha+ </LemonTag>+ )}+ {agent.legacy && (+ <LemonTag type="caution" size="small">+ Legacy+ </LemonTag>)}</div>+ <span className="truncate text-xs leading-4 text-muted">{agent.watches}</span></div>-+ {tag && (+ <LemonTag type={tag.type} size="small">+ {tag.label}+ </LemonTag>+ )}+ <span className="w-38 shrink-0 truncate text-right text-xs text-muted">+ {entities.length > 0 && `${enabledCount} of ${entities.length} ${agent.entityNoun} on`}+ </span>{/* eslint-disable-next-line react/no-unknown-property */}- <div className="flex flex-col items-end gap-2 shrink-0" onClick={(e) => e.stopPropagation()}>- {toolOff ? (- <LemonTag type="warning" size="small">- Tool off- </LemonTag>- ) : (- <LemonTag type={statusTag.type} size="small">- {statusTag.label}- </LemonTag>- )}+ <div className="flex w-13 shrink-0 justify-end" onClick={(e) => e.stopPropagation()}>{loading ? (- <Spinner className="text-lg" />+ <Spinner className="text-base" />) : requiresSetup ? (- <LemonButton type="primary" size="small" onClick={() => onToggle(agent.source)}>+ <LemonButton type="secondary" size="xsmall" onClick={() => onToggle(agent.source)}>Connect</LemonButton>- ) : (+ ) : hasMasterSwitch ? (<LemonSwitchchecked={armed}onChange={() => onToggle(agent.source)}@@ -225,36 +523,25 @@ const AgentCard = memo(function AgentCard({}aria-label={`Arm ${agent.label}`}/>- )}+ ) : null}</div>+ <IconChevronRight+ className={`shrink-0 text-muted transition-transform ${expanded ? 'rotate-90' : ''}`}+ /></div>-- {toolOff && tool ? (- // eslint-disable-next-line react/no-unknown-property- <div className="flex items-center gap-2 mt-2 ml-11" onClick={(e) => e.stopPropagation()}>- <span className="text-sm text-warning">- {tool.toolName} is off, so this source has nothing to read.- </span>- {tool.enablement && (- <LemonButton- type="secondary"- size="xsmall"- loading={enablingTool}- onClick={() => onEnableTool(tool)}- >- Turn it on- </LemonButton>- )}- </div>- ) : tool ? (- <ToolDataStatus agent={agent} status={tool.dataStatus} onRetry={onRetryData} />- ) : null}-- {armed && agent.source === 'session_replay' && status === 'syncing' && (- <div className="flex items-center gap-2 mt-2 ml-11">- <Spinner className="text-sm text-accent" />- <span className="text-sm text-accent">Session analysis run in progress…</span>- </div>+ {expanded && (+ <Expansion+ agent={agent}+ state={state}+ tool={tool}+ enablingTool={enablingTool}+ onEnableTool={onEnableTool}+ onToggleEntity={(entityId) => onToggleEntity(agent.source, entityId)}+ onConfigureFilters={onConfigureFilters}+ onRetryData={onRetryData}+ onToggleReports={onToggleReports}+ reportsEnabled={reportsEnabled}+ />)}</div>)@@ -274,7 +561,12 @@ export function AgentsRoster(): JSX.Element {ciSignalsConfig,ciSignalsConfigLoading,ciSignalsIsFullyEnabled,- errorTrackingIsFullyEnabled,+ errorTrackingTypeStates,+ visionScanners,+ visionScannersLoading,+ evaluations,+ evaluationsLoading,+ signalEmittingEvaluationIds,isSessionAnalysisToggling,isConversationsToggling,isEvalReportsToggling,@@ -293,19 +585,63 @@ export function AgentsRoster(): JSX.Element {toggleSessionAnalysis,toggleConversations,toggleErrorTracking,+ toggleErrorTrackingType,toggleEvalReports,+ toggleEvaluationSignals,toggleCiSignals,toggleAnomalyInvestigation,toggleHealthChecks,+ toggleScannerSignals,+ setAllScannerSignals,+ setEvaluationSignals,initiateDataWarehouseSourceToggle,enableSourceTool,+ openSessionAnalysisSetup,loadToolDataEvents,} = useActions(signalSourcesLogic)const { featureFlags } = useValues(featureFlagLogic)+ const [expandedSource, setExpandedSource] = useState<AgentRosterSource | null>(null)++ const scannerEntities = useMemo(+ (): RosterEntity[] =>+ (visionScanners ?? []).map((scanner) => ({+ id: scanner.id,+ name: scanner.name,+ detail: scanner.description || undefined,+ kind: scanner.scanner_type,+ enabled: scanner.emits_signals ?? false,+ })),+ [visionScanners]+ )++ const evaluationEntities = useMemo(+ (): RosterEntity[] =>+ (evaluations ?? []).map((evaluation) => ({+ id: evaluation.id,+ name: evaluation.name,+ detail: evaluation.description || undefined,+ kind: evaluation.evaluation_type,+ enabled: signalEmittingEvaluationIds.includes(evaluation.id),+ })),+ [evaluations, signalEmittingEvaluationIds]+ )++ const errorTrackingEntities = useMemo(+ (): RosterEntity[] =>+ errorTrackingTypeStates.map(({ sourceType, enabled }) => ({+ id: sourceType,+ name: ERROR_TRACKING_TYPE_LABELS[sourceType]?.name ?? sourceType,+ detail: ERROR_TRACKING_TYPE_LABELS[sourceType]?.detail,+ enabled,+ })),+ [errorTrackingTypeStates]+ )const stateFor = useCallback((source: AgentRosterSource): AgentSourceState => {+ const base = { entities: [] as RosterEntity[], entitiesLoading: false }const dwState = (config: SignalSourceConfig | null, loading: boolean): AgentSourceState => ({+ ...base,armed: !!config?.enabled,loading,// No config row yet → the source has never been connected; surface a Connect button.@@ -315,20 +651,36 @@ export function AgentsRoster(): JSX.Element {switch (source) {case 'error_tracking':return {- armed: errorTrackingIsFullyEnabled,+ ...base,+ // Any type on means it is emitting, so the row reads Watching rather than+ // Standby while two of the three are armed.+ armed: errorTrackingTypeStates.some(({ enabled }) => enabled),loading: isErrorTrackingToggling,requiresSetup: false,syncStatus: null,+ entities: errorTrackingEntities,}case 'conversations':return {+ ...base,armed: !!conversationsConfig?.enabled,loading: isConversationsToggling,requiresSetup: false,syncStatus: conversationsConfig?.status,}+ case 'replay_vision':+ return {+ ...base,+ armed: scannerEntities.some((entity) => entity.enabled),+ loading: visionScannersLoading,+ requiresSetup: false,+ syncStatus: null,+ entities: scannerEntities,+ entitiesLoading: visionScanners === null && visionScannersLoading,+ }case 'session_replay':return {+ ...base,armed: !!sessionAnalysisConfig?.enabled,loading: isSessionAnalysisToggling,requiresSetup: false,@@ -336,13 +688,19 @@ export function AgentsRoster(): JSX.Element {}case 'llm_analytics':return {- armed: !!evalReportsConfig?.enabled,+ ...base,+ // No master switch here, so the row is on when anything under it is: an+ // allowlisted evaluation, or the periodic digest.+ armed: !!evalReportsConfig?.enabled || evaluationEntities.some((e) => e.enabled),loading: isEvalReportsToggling,requiresSetup: false,syncStatus: null,+ entities: evaluationEntities,+ entitiesLoading: evaluations === null && evaluationsLoading,}case 'analytics':return {+ ...base,armed: !!anomalyInvestigationConfig?.enabled,loading: isAnomalyInvestigationToggling,requiresSetup: false,@@ -350,6 +708,7 @@ export function AgentsRoster(): JSX.Element {}case 'health_checks':return {+ ...base,armed: !!healthChecksConfig?.enabled,loading: isHealthChecksToggling,requiresSetup: false,@@ -365,6 +724,7 @@ export function AgentsRoster(): JSX.Element {return dwState(pgAnalyzeIssuesConfig, isPgAnalyzeIssuesToggling)case 'engineering_analytics':return {+ ...base,armed: ciSignalsIsFullyEnabled,// Config load counts as loading: rendering Connect before it resolves misleads.loading: isCiSignalsToggling || ciSignalsConfigLoading,@@ -374,13 +734,20 @@ export function AgentsRoster(): JSX.Element {}},[- errorTrackingIsFullyEnabled,+ errorTrackingEntities,+ errorTrackingTypeStates,isErrorTrackingToggling,conversationsConfig,isConversationsToggling,+ scannerEntities,+ visionScanners,+ visionScannersLoading,sessionAnalysisConfig,isSessionAnalysisToggling,evalReportsConfig,+ evaluationEntities,+ evaluations,+ evaluationsLoading,isEvalReportsToggling,anomalyInvestigationConfig,isAnomalyInvestigationToggling,@@ -404,6 +771,9 @@ export function AgentsRoster(): JSX.Element {const handleToggle = useCallback((source: AgentRosterSource) => {switch (source) {+ case 'replay_vision':+ // Switched per scanner, in the expanded list. No row-level control to fire.+ returncase 'error_tracking':toggleErrorTracking()return@@ -414,7 +784,7 @@ export function AgentsRoster(): JSX.Element {toggleSessionAnalysis()returncase 'llm_analytics':- toggleEvalReports()+ // Switched per evaluation, plus the digest, both in the expanded list.returncase 'analytics':toggleAnomalyInvestigation()@@ -434,6 +804,11 @@ export function AgentsRoster(): JSX.Element {}},[+ scannerEntities,+ setAllScannerSignals,+ evaluationEntities,+ evalReportsConfig,+ setEvaluationSignals,toggleErrorTracking,toggleConversations,toggleSessionAnalysis,@@ -445,28 +820,63 @@ export function AgentsRoster(): JSX.Element {])+ const handleToggleEntity = useCallback(+ (source: AgentRosterSource, entityId: string) => {+ if (source === 'replay_vision') {+ toggleScannerSignals(entityId)+ } else if (source === 'llm_analytics') {+ toggleEvaluationSignals(entityId)+ } else if (source === 'error_tracking') {+ toggleErrorTrackingType(entityId as SignalSourceType)+ }+ },+ [toggleScannerSignals, toggleEvaluationSignals, toggleErrorTrackingType]+ )++ const visibleGroups = AGENT_ROSTER_GROUPS.map((group) => ({+ ...group,+ agents: group.agents.filter((agent) => !agent.flag || featureFlags[agent.flag]),+ }))+ const allAgents = visibleGroups.flatMap((group) => group.agents)+ const armedCount = allAgents.filter((agent) => stateFor(agent.source).armed).length+return (- <div className="flex flex-col gap-5">- {AGENT_ROSTER_GROUPS.map((group) => (- <div key={group.label} className="flex flex-col gap-2">- <span className="text-[13px] font-medium text-muted">{group.label}</span>- <div className="grid grid-cols-1 sm:grid-cols-2 gap-3">- {group.agents- .filter((agent) => !agent.flag || featureFlags[agent.flag])- .map((agent) => (- <AgentCard- key={agent.source}- agent={agent}- state={stateFor(agent.source)}- tool={toolStatusBySource[agent.source]}- enablingTool={- !!enablingTool && enablingTool === toolStatusBySource[agent.source]?.enablement- }- onToggle={handleToggle}- onEnableTool={(tool) => tool.enablement && enableSourceTool(tool.enablement)}- onRetryData={loadToolDataEvents}- />- ))}+ <div className="flex flex-col gap-3">+ <div className="flex items-center gap-1.5 text-xs text-muted">+ <span className={`size-2 rounded-full ${armedCount ? 'bg-success' : 'bg-border-bold'}`} />+ <span>+ {armedCount} of {allAgents.length} sources on+ </span>+ </div>++ {visibleGroups.map((group) => (+ <div key={group.label} className="flex flex-col gap-1">+ <span className="text-xs font-medium text-muted">{group.label}</span>+ <div className="divide-y divide-primary overflow-hidden rounded border border-primary">+ {group.agents.map((agent) => (+ <AgentRow+ key={agent.source}+ agent={agent}+ state={stateFor(agent.source)}+ tool={toolStatusBySource[agent.source]}+ expanded={expandedSource === agent.source}+ enablingTool={+ !!enablingTool && enablingTool === toolStatusBySource[agent.source]?.enablement+ }+ onExpand={() =>+ setExpandedSource((current) => (current === agent.source ? null : agent.source))+ }+ onToggle={handleToggle}+ onToggleEntity={handleToggleEntity}+ onEnableTool={(tool) => tool.enablement && enableSourceTool(tool.enablement)}+ onConfigureFilters={+ agent.source === 'session_replay' ? openSessionAnalysisSetup : undefined+ }+ onRetryData={loadToolDataEvents}+ onToggleReports={agent.source === 'llm_analytics' ? toggleEvalReports : undefined}+ reportsEnabled={!!evalReportsConfig?.enabled}+ />+ ))}</div></div>))}@@ -474,33 +884,30 @@ export function AgentsRoster(): JSX.Element {)}-function AgentCardSkeleton(): JSX.Element {+function AgentRowSkeleton(): JSX.Element {return (- <div className="rounded border border-primary bg-surface-primary p-3">- <div className="flex items-start justify-between gap-3">- <div className="flex items-start gap-3 min-w-0 flex-1">- <LemonSkeleton className="size-8 shrink-0 rounded" />- <div className="flex flex-col gap-2 min-w-0 flex-1">- <LemonSkeleton className="h-3 w-1/2" />- <LemonSkeleton className="h-3 w-1/3" />- <LemonSkeleton className="h-3 w-4/5" />- </div>- </div>- <LemonSkeleton className="h-5 w-16 shrink-0" />+ <div className="flex h-13 items-center gap-2 px-2">+ <LemonSkeleton className="size-2 shrink-0 rounded-full" />+ <LemonSkeleton className="size-4 shrink-0 rounded" />+ <div className="flex min-w-0 flex-1 flex-col gap-1">+ <LemonSkeleton className="h-3 w-32" />+ <LemonSkeleton className="h-2.5 w-56" /></div>+ <LemonSkeleton className="h-4 w-8 shrink-0 rounded-full" /></div>)}export function AgentsRosterSkeleton(): JSX.Element {return (- <div className="flex flex-col gap-5">+ <div className="flex flex-col gap-3">+ <LemonSkeleton className="h-3 w-48" />{AGENT_ROSTER_GROUPS.map((group) => (- <div key={group.label} className="flex flex-col gap-2">+ <div key={group.label} className="flex flex-col gap-1"><LemonSkeleton className="h-3 w-24" />- <div className="grid grid-cols-1 sm:grid-cols-2 gap-3">+ <div className="divide-y divide-primary overflow-hidden rounded border border-primary">{group.agents.map((agent) => (- <AgentCardSkeleton key={agent.source} />+ <AgentRowSkeleton key={agent.source} />))}</div></div>diff --git a/products/signals/frontend/inbox/components/config/AgentsTab.tsx b/products/signals/frontend/inbox/components/config/AgentsTab.tsxindex 15a545e266ca..6c66cf047af3 100644--- a/products/signals/frontend/inbox/components/config/AgentsTab.tsx+++ b/products/signals/frontend/inbox/components/config/AgentsTab.tsx@@ -108,7 +108,7 @@ export function AgentsTab(): JSX.Element {<Subsectiontitle="Signal sources"- description="Each source watches for signals and spins up work when something matters."+ description="Each source watches for signals, and spins up an agent to look into them.">{agentsBody}</Subsection>diff --git a/products/signals/frontend/inbox/components/config/SignalSourcesPanel.stories.tsx b/products/signals/frontend/inbox/components/config/SignalSourcesPanel.stories.tsxindex a6bcbc621c42..68dd4dc9dcc3 100644--- a/products/signals/frontend/inbox/components/config/SignalSourcesPanel.stories.tsx+++ b/products/signals/frontend/inbox/components/config/SignalSourcesPanel.stories.tsx@@ -17,6 +17,8 @@ import { SignalSourcesPanel } from './SignalSourcesPanel'interface PanelState {// Armed sourceserrorTrackingArmed: boolean+ /** Replay Vision arms per scanner, so this stands in for "the first scanner emits signals". */+ replayVisionArmed: booleansessionReplayArmed: booleansupportArmed: booleanaiObservabilityArmed: boolean@@ -62,11 +64,56 @@ function sourceConfigsFor(state: PanelState): SignalSourceConfig[] {),sourceConfig(SignalSourceProduct.Conversations, SignalSourceType.Ticket, state.supportArmed),sourceConfig(SignalSourceProduct.LlmAnalytics, SignalSourceType.EvaluationReport, state.aiObservabilityArmed),+ {+ ...sourceConfig(SignalSourceProduct.LlmAnalytics, SignalSourceType.Evaluation, state.aiObservabilityArmed),+ config: { evaluation_ids: state.aiObservabilityArmed ? ['eval-grounded'] : [] },+ },sourceConfig(SignalSourceProduct.Analytics, SignalSourceType.AnomalyInvestigation, state.productAnalyticsArmed),sourceConfig(SignalSourceProduct.HealthChecks, SignalSourceType.HealthIssue, state.healthChecksArmed),]}+/** Two scanners so the roster's per-scanner list has both an on and an off row to render. */+function scannersFor(state: PanelState): Record<string, unknown>[] {+ return [+ {+ id: 'scanner-checkout',+ name: 'Checkout confusion',+ description: 'Watches for hesitation and repeated attempts on the checkout step.',+ scanner_type: 'monitor',+ enabled: true,+ emits_signals: state.replayVisionArmed,+ },+ {+ id: 'scanner-onboarding',+ name: 'Onboarding drop-off',+ description: 'Sorts abandoned onboarding sessions into reasons.',+ scanner_type: 'classifier',+ enabled: true,+ emits_signals: false,+ },+ ]+}++function evaluationsFor(): Record<string, unknown>[] {+ return [+ {+ id: 'eval-grounded',+ name: 'Answer grounded in context',+ description: 'Fails when the reply states something the retrieved context does not support.',+ evaluation_type: 'llm_judge',+ enabled: true,+ },+ {+ id: 'eval-refusal',+ name: 'Refusal rate',+ description: 'Counts replies that decline a question the product should answer.',+ evaluation_type: 'hog',+ enabled: true,+ },+ ]+}+function eventDefinitionsFor(state: PanelState): { name: string; last_seen_at: string }[] {const names = [...(state.hasExceptionEvents ? ['$exception'] : []),@@ -89,6 +136,14 @@ function PanelHarness(state: PanelState): JSX.Element {},],'/api/projects/:team_id/signals/source_configs/': () => [200, { results: sourceConfigsFor(state) }],+ '/api/projects/:team_id/vision/scanners/': () => {+ const results = scannersFor(state)+ return [200, { count: results.length, next: null, previous: null, results }]+ },+ '/api/projects/:team_id/evaluations/': () => {+ const results = evaluationsFor()+ return [200, { count: results.length, next: null, previous: null, results }]+ },'/api/projects/:team_id/event_definitions/': () =>state.eventDefinitionsUnavailable? [500, { detail: "Couldn't check recent data." }]@@ -133,6 +188,7 @@ const meta: Meta<typeof PanelHarness> = {},args: {errorTrackingArmed: true,+ replayVisionArmed: true,sessionReplayArmed: true,supportArmed: false,aiObservabilityArmed: false,@@ -158,6 +214,7 @@ export const Playground: Story = {}export const ArmedButToolsOff: Story = {args: {errorTrackingArmed: true,+ replayVisionArmed: true,sessionReplayArmed: true,supportArmed: true,exceptionAutocaptureOn: false,@@ -173,6 +230,7 @@ export const ArmedButToolsOff: Story = {export const ArmingBlocked: Story = {args: {errorTrackingArmed: false,+ replayVisionArmed: false,sessionReplayArmed: false,supportArmed: false,aiObservabilityArmed: false,@@ -191,6 +249,7 @@ export const ArmingBlocked: Story = {export const EverythingHealthy: Story = {args: {errorTrackingArmed: true,+ replayVisionArmed: true,sessionReplayArmed: true,supportArmed: true,aiObservabilityArmed: true,@@ -209,6 +268,7 @@ export const EverythingHealthy: Story = {export const ToolsOnNoRecentData: Story = {args: {errorTrackingArmed: true,+ replayVisionArmed: true,sessionReplayArmed: true,supportArmed: true,aiObservabilityArmed: true,diff --git a/products/signals/frontend/inbox/components/config/SignalSourcesPanel.tsx b/products/signals/frontend/inbox/components/config/SignalSourcesPanel.tsxindex e891f6988bbd..8c490de27b58 100644--- a/products/signals/frontend/inbox/components/config/SignalSourcesPanel.tsx+++ b/products/signals/frontend/inbox/components/config/SignalSourcesPanel.tsx@@ -19,7 +19,7 @@ function BackLink({ onClick }: { onClick: () => void }): JSX.Element {/*** Signal sources management: the per-source roster (each source watches for signals and- * spins up work when something matters), plus the session-analysis and data-source setup+ * spins up an agent to look into them), plus the session-analysis and data-source setup* sub-flows that render inline (replacing the roster) when their flow is open. Hosted in* the Signal sources setup modal.*/@@ -28,6 +28,8 @@ export function SignalSourcesPanel(): JSX.Element {const {loadSources,loadSourceConfigs,+ loadVisionScanners,+ loadEvaluations,loadToolDataEvents,closeSessionAnalysisSetup,closeDataSourceSetup,@@ -37,6 +39,8 @@ export function SignalSourcesPanel(): JSX.Element {useEffect(() => {loadSources()loadSourceConfigs()+ loadVisionScanners()+ loadEvaluations()loadToolDataEvents()}, []) // eslint-disable-line react-hooks/exhaustive-depsdiff --git a/products/signals/frontend/inbox/components/config/agentRosterMeta.ts b/products/signals/frontend/inbox/components/config/agentRosterMeta.tsindex 6770fe6b1299..2d30548c4635 100644--- a/products/signals/frontend/inbox/components/config/agentRosterMeta.ts+++ b/products/signals/frontend/inbox/components/config/agentRosterMeta.ts@@ -1,4 +1,5 @@import { FEATURE_FLAGS, FeatureFlagKey } from 'lib/constants'+import { urls } from 'scenes/urls'import { SignalSourceProduct } from '../../types'@@ -10,6 +11,7 @@ import { SignalSourceProduct } from '../../types'export type AgentRosterSource =| 'error_tracking'| 'conversations'+ | 'replay_vision'| 'session_replay'| 'llm_analytics'| 'analytics'@@ -25,10 +27,33 @@ export interface AgentRosterDefinition {/** Key into `SOURCE_PRODUCT_META` for the icon tile. */sourceProduct: SignalSourceProductlabel: string- description: string+ /** The tagline: one truncated line under the source name, saying what this source watches. */+ watches: string+ /**+ * The line the expansion opens with. It must add something the tagline does not say, usually+ * what triggers a signal or what the source needs, never a restatement of what it watches.+ */+ detail?: string+ /** Plural noun for the things listed inside this source, e.g. "scanners". */+ entityNoun?: string+ /**+ * The entities are created by the user, so the list has no fixed length. Such a source gets no+ * row-level switch: a master over an unbounded list is a bulk mutation of things we did not+ * define. A fixed, product-defined list (error tracking's three signal types) keeps its master.+ */+ entitiesAreUserCreated?: boolean+ /** Singular of `entityNoun`, for the "New scanner" button. */+ entityNounSingular?: stringdocsUrl?: stringdocsLabel?: stringalpha?: boolean+ /** Superseded by another source. Tagged and dimmed so it reads as the older option. */+ legacy?: boolean+ /**+ * Scene that owns this source's on/off state, for sources with no `SignalSourceConfig` row to+ * toggle. The card links there instead of showing a switch.+ */+ manageUrl?: string/** Show this entry only while the given feature flag is enabled (alpha rollouts). */flag?: FeatureFlagKey}@@ -46,7 +71,10 @@ export const AGENT_ROSTER_GROUPS: AgentRosterGroup[] = [source: 'error_tracking',sourceProduct: SignalSourceProduct.ErrorTracking,label: 'Error tracking',- description: 'Bugs surfaced as new errors, regressions, and spikes.',+ watches: 'New errors, regressions, and spikes in your app',+ detail: 'Each type below is a separate trigger, so turning one off leaves the others watching.',+ entityNoun: 'signal types',+ entityNounSingular: 'signal type',docsUrl: 'https://posthog.com/docs/error-tracking',docsLabel: 'Error tracking',},@@ -54,24 +82,34 @@ export const AGENT_ROSTER_GROUPS: AgentRosterGroup[] = [source: 'conversations',sourceProduct: SignalSourceProduct.Conversations,label: 'Support',- description: 'Problems customers raise in support.',+ watches: 'Problems customers raise in support',+ detail: 'Only open tickets are read.',docsUrl: 'https://posthog.com/docs/support',docsLabel: 'Support',},{- source: 'session_replay',- sourceProduct: SignalSourceProduct.SessionReplay,- label: 'Session replay',- description: 'UX problems found in session recordings.',- docsUrl: 'https://posthog.com/docs/session-replay',- docsLabel: 'Session replay',- alpha: true,+ source: 'replay_vision',+ sourceProduct: SignalSourceProduct.ReplayVision,+ label: 'Replay vision',+ watches: 'UX problems your scanners find while watching recordings',+ detail: 'Switching a scanner on here lets its findings start agent research. Scouts read observations from any scanner either way.',+ entityNoun: 'scanners',+ entityNounSingular: 'scanner',+ entitiesAreUserCreated: true,+ docsUrl: 'https://posthog.com/docs/replay-vision',+ docsLabel: 'Replay vision',+ manageUrl: urls.replayVision(),},{source: 'llm_analytics',sourceProduct: SignalSourceProduct.LlmAnalytics,label: 'AI observability',- description: 'Quality problems in your AI features. Set up evaluations to start getting signals.',+ watches: 'AI quality problems your evaluations catch',+ detail: 'An evaluation reaches your inbox only when it is switched on here.',+ entityNoun: 'evaluations',+ entityNounSingular: 'evaluation',+ entitiesAreUserCreated: true,+ manageUrl: urls.aiObservabilityEvaluations(),docsUrl: 'https://posthog.com/docs/ai-evals',docsLabel: 'evaluations',},@@ -79,7 +117,8 @@ export const AGENT_ROSTER_GROUPS: AgentRosterGroup[] = [source: 'analytics',sourceProduct: SignalSourceProduct.Analytics,label: 'Product analytics',- description: 'Anomalies and unexpected shifts detected in your product metrics.',+ watches: 'Unexpected shifts in your product metrics',+ detail: 'Fires when an anomaly alert goes off, and only for the alerts where you turned the investigation agent on.',docsUrl: 'https://posthog.com/docs/product-analytics',docsLabel: 'Product analytics',alpha: true,@@ -88,7 +127,20 @@ export const AGENT_ROSTER_GROUPS: AgentRosterGroup[] = [source: 'health_checks',sourceProduct: SignalSourceProduct.HealthChecks,label: 'Health checks',- description: 'Instrumentation issues - missing events, proxy gaps, and outdated SDKs.',+ watches: 'Missing events, proxy gaps, and outdated SDKs',+ detail: 'Checks your setup for missing events, an outdated SDK, proxy problems, failed warehouse syncs, and missing source maps.',+ docsUrl: urls.health(),+ docsLabel: 'Health checks',+ },+ {+ source: 'session_replay',+ sourceProduct: SignalSourceProduct.SessionReplay,+ label: 'Session replay',+ watches: 'UX problems in recordings, now covered by Replay Vision',+ detail: 'Runs on a sample of the recordings that match your filters.',+ docsUrl: 'https://posthog.com/docs/session-replay',+ docsLabel: 'Session replay',+ legacy: true,},],},@@ -98,14 +150,16 @@ export const AGENT_ROSTER_GROUPS: AgentRosterGroup[] = [{source: 'github',sourceProduct: SignalSourceProduct.Github,- label: 'GitHub Issues',- description: 'Issues filed in GitHub.',+ label: 'GitHub issues',+ watches: 'Issues filed in GitHub',+ detail: 'Reads the issues from the GitHub repositories you sync to the warehouse.',},{source: 'engineering_analytics',sourceProduct: SignalSourceProduct.EngineeringAnalytics,label: 'GitHub CI',- description: 'Flaky checks, broken default branch, and slowing workflows in GitHub Actions.',+ watches: 'Flaky checks and slowing GitHub Actions workflows',+ detail: 'Reads workflow runs and pull requests from the GitHub repositories you sync.',alpha: true,flag: FEATURE_FLAGS.ENGINEERING_ANALYTICS,},@@ -113,19 +167,22 @@ export const AGENT_ROSTER_GROUPS: AgentRosterGroup[] = [source: 'linear',sourceProduct: SignalSourceProduct.Linear,label: 'Linear',- description: 'Issues tracked in Linear.',+ watches: 'Issues tracked in Linear',+ detail: 'Reads the issues from the Linear workspace you sync to the warehouse.',},{source: 'zendesk',sourceProduct: SignalSourceProduct.Zendesk,label: 'Zendesk',- description: 'Incoming Zendesk tickets.',+ watches: 'Incoming Zendesk tickets',+ detail: 'Reads the tickets from the Zendesk account you sync to the warehouse.',},{source: 'pganalyze',sourceProduct: SignalSourceProduct.Pganalyze,label: 'pganalyze',- description: 'Postgres performance problems, including slow queries and bad indexes.',+ watches: 'Slow Postgres queries and bad indexes',+ detail: 'Reads the issues from the pganalyze account you sync to the warehouse.',},],},diff --git a/products/signals/frontend/inbox/components/shell/AgentSetupColumn.tsx b/products/signals/frontend/inbox/components/shell/AgentSetupColumn.tsxindex f08ed781c46f..446fafab78eb 100644--- a/products/signals/frontend/inbox/components/shell/AgentSetupColumn.tsx+++ b/products/signals/frontend/inbox/components/shell/AgentSetupColumn.tsx@@ -179,7 +179,7 @@ function SignalSourcesWidget(): JSX.Element {tone={hasAny ? 'done' : 'todo'}loading={sourceConfigs === null}status={hasAny ? `${enabledSourcesCount} watching` : 'None active yet'}- description="Each source watches a product and spins up work when something matters."+ description="Each source watches for signals, and spins up an agent to look into them."onClick={() => openSetupModal('signal-sources')}/>)@@ -311,7 +311,7 @@ const SETUP_MODALS: Record<> = {'signal-sources': {title: 'Signal sources',- description: 'Each source watches for signals and spins up work when something matters.',+ description: 'Each source watches for signals, and spins up an agent to look into them.',width: 760,body: <SignalSourcesPanel />,},diff --git a/products/signals/frontend/inbox/logics/inboxOnboardingLogic.test.ts b/products/signals/frontend/inbox/logics/inboxOnboardingLogic.test.tsindex a30e125c0f2d..76ee67ae534e 100644--- a/products/signals/frontend/inbox/logics/inboxOnboardingLogic.test.ts+++ b/products/signals/frontend/inbox/logics/inboxOnboardingLogic.test.ts@@ -36,7 +36,7 @@ describe('inboxOnboardingLogic', () => {{ areCountsResolved: false },{ mode: 'none', reason: 'counts_loading' },],- // Set up (a source or scout is watching) → no onboarding at all, and no wait on counts.+ // Set up (a source, scout, or scanner is watching) → no onboarding at all, and no wait on counts.['set up, empty inbox', { isSelfDrivingSetUp: true }, { mode: 'none', reason: 'already_set_up' }],['set up, with work',diff --git a/products/signals/frontend/inbox/logics/inboxOnboardingLogic.ts b/products/signals/frontend/inbox/logics/inboxOnboardingLogic.tsindex 08dad1cdbc6e..b366d282755c 100644--- a/products/signals/frontend/inbox/logics/inboxOnboardingLogic.ts+++ b/products/signals/frontend/inbox/logics/inboxOnboardingLogic.ts@@ -86,9 +86,9 @@ export function resolveWizardState({}export interface OnboardingModeInputs {- /** Both source + scout config loaders have settled, so the set-up verdict is trustworthy. */+ /** Every watcher loader has settled, so the set-up verdict is trustworthy. */isSetupLoaded: boolean- /** At least one signal source or scout is watching. */+ /** At least one signal source, scout, or signal-emitting Replay Vision scanner is watching. */isSelfDrivingSetUp: boolean/** Both tab count loaders have settled (returned, or failed) – the work verdict is trustworthy. */areCountsResolved: boolean@@ -161,6 +161,7 @@ export interface inboxOnboardingLogicValues {enabledScoutsCount: number // scoutFleetLogicscoutConfigs: SignalScoutConfig[] | null // scoutFleetLogicenabledSourcesCount: number // signalSourcesLogic+ hasEmittingScanner: boolean | null // signalSourcesLogicsourceConfigs: SignalSourceConfig[] | null // signalSourcesLogicactiveWorkflowId: string | null // wizardActiveSessionDetectorLogichasResolvedSessionState: boolean // wizardActiveSessionDetectorLogic@@ -194,7 +195,11 @@ export interface inboxOnboardingLogicActions {export interface inboxOnboardingLogicMeta {__keaTypeGenInternalSelectorTypes: {isSelfDrivingSetUp: (enabledSourcesCount: number, enabledScoutsCount: number) => boolean- isSetupLoaded: (sourceConfigs: SignalSourceConfig[] | null, scoutConfigs: SignalScoutConfig[] | null) => boolean+ isSetupLoaded: (+ sourceConfigs: SignalSourceConfig[] | null,+ scoutConfigs: SignalScoutConfig[] | null,+ hasEmittingScanner: boolean | null+ ) => booleanareCountsResolved: (pullsCount: number | null,reportsCount: number | null,@@ -230,9 +235,10 @@ export type inboxOnboardingLogicType = MakeLogicType<>/**- * Decides how the single-command self-driving onboarding presents itself. There are no in-app- * setup steps – the user runs one wizard command in their repo – so "set up" is read straight- * from what the wizard turns on: at least one signal source or scout watching.+ * Decides how the single-command self-driving onboarding presents itself. The wizard is the main+ * way in – one command in the user's repo, no in-app steps – so "set up" is read from what ends up+ * watching: at least one signal source or scout. `enabledSourcesCount` counts Replay Vision too,+ * which reaches the inbox on its own, without the wizard ever being run.** When self-driving is NOT set up, the presentation depends on whether there's anything to show:* - nothing landed yet (no reports or PRs) → the inbox becomes a locked "Welcome" tab whose body is@@ -249,7 +255,7 @@ export const inboxOnboardingLogic = kea<inboxOnboardingLogicType>([connect(() => ({values: [signalSourcesLogic,- ['sourceConfigs', 'enabledSourcesCount'],+ ['sourceConfigs', 'enabledSourcesCount', 'hasEmittingScanner'],scoutFleetLogic,['scoutConfigs', 'enabledCount as enabledScoutsCount'],// Mount the pulls + reports count loaders directly (cheap limit=1 each) so we know@@ -294,13 +300,14 @@ export const inboxOnboardingLogic = kea<inboxOnboardingLogicType>([(enabledSourcesCount: number, enabledScoutsCount: number): boolean =>enabledSourcesCount + enabledScoutsCount > 0,],- // Both source + scout config loaders have settled, so the set-up verdict is trustworthy.+ // Every watcher loader has settled, so the set-up verdict is trustworthy.isSetupLoaded: [- (s) => [s.sourceConfigs, s.scoutConfigs],+ (s) => [s.sourceConfigs, s.scoutConfigs, s.hasEmittingScanner],(sourceConfigs: import('../types').SignalSourceConfig[] | null,- scoutConfigs: SignalScoutConfig[] | null- ): boolean => sourceConfigs !== null && scoutConfigs !== null,+ scoutConfigs: SignalScoutConfig[] | null,+ hasEmittingScanner: boolean | null+ ): boolean => sourceConfigs !== null && scoutConfigs !== null && hasEmittingScanner !== null,],// Counts are "resolved" once both limit=1 requests have returned, OR once neither is still// loading (so a failed count request can't strand the onboarding on the loading state – thisdiff --git a/products/signals/frontend/inbox/signalSourcesLogic.ts b/products/signals/frontend/inbox/signalSourcesLogic.tsindex 272647d1a49d..4af852729743 100644--- a/products/signals/frontend/inbox/signalSourcesLogic.ts+++ b/products/signals/frontend/inbox/signalSourcesLogic.ts@@ -4,6 +4,7 @@ import { loaders } from 'kea-loaders'import { lemonToast } from '@posthog/lemon-ui'import api from 'lib/api'+import { ApiConfig } from 'lib/api'import type { PaginatedResponse } from 'lib/api'import { FEATURE_FLAGS } from 'lib/constants'import { featureFlagLogic } from 'lib/logic/featureFlagLogic'@@ -20,6 +21,8 @@ import {TeamType,} from '~/types'+import { evaluationsList } from 'products/ai_observability/frontend/generated/api'+import type { EvaluationApi } from 'products/ai_observability/frontend/generated/api.schemas'import { sourcesDataLogic } from 'products/data_warehouse/frontend/shared/logics/sourcesDataLogic'import {engineeringAnalyticsCiSignalsConfigRetrieve,@@ -27,8 +30,11 @@ import {} from 'products/engineering_analytics/frontend/generated/api'import type { CISignalsConfigApi } from 'products/engineering_analytics/frontend/generated/api.schemas'import { eventDefinitionsList } from 'products/event_definitions/frontend/generated/api'+import { visionScannersList, visionScannersPartialUpdate } from 'products/replay_vision/frontend/generated/api'+import type { ReplayScannerApi } from 'products/replay_vision/frontend/generated/api.schemas'import { SignalSourceProduct, SignalSourceType } from 'products/signals/frontend/inbox/types'+import type { SignalSourceTypeApi } from '../generated/api.schemas'import type { AgentRosterSource } from './components/config/agentRosterMeta'import { captureSignalSourceConnected, captureSignalSourceDisabled } from './inboxAnalytics'import { SignalSourceConfig, SignalSourceConfigStatus, ToggleSignalSourceParams } from './types'@@ -48,6 +54,12 @@ export interface SourceToolStatus {/** Event definitions probed to detect recent data for each source's tool. */const TOOL_USAGE_EVENTS = ['$exception', '$ai_generation', '$ai_trace', '$pageview', '$autocapture']+/**+ * Cap on the per-source entity lists the roster inlines. Well past the tail: the busiest projects+ * run a few dozen scanners or evaluations, and the median runs one.+ */+const ENTITY_PAGE_SIZE = 100+/** Matches Cymbal `EmitSignalRequest.source_type` + `products.signals.backend.api.emit_signal` checks. */export const ERROR_TRACKING_SIGNAL_SOURCE_TYPES: SignalSourceType[] = [SignalSourceType.IssueCreated,@@ -209,8 +221,15 @@ export interface signalSourcesLogicValues {enabledSourcesCount: numberenablingTool: SourceToolEnablement | nullerrorTrackingIsFullyEnabled: boolean+ errorTrackingTypeStates: {+ enabled: boolean+ sourceType: SignalSourceType+ }[]evalReportsConfig: SignalSourceConfig | null+ evaluations: EvaluationApi[] | null+ evaluationsLoading: booleangithubIssuesConfig: SignalSourceConfig | null+ hasEmittingScanner: boolean | nullhasNoSources: booleanhealthChecksConfig: SignalSourceConfig | nullisAnomalyInvestigationToggling: boolean@@ -229,6 +248,7 @@ export interface signalSourcesLogicValues {pgAnalyzeIssuesConfig: SignalSourceConfig | nullsessionAnalysisConfig: SignalSourceConfig | nullsessionAnalysisSetupOpen: boolean+ signalEmittingEvaluationIds: string[]sourceConfigs: SignalSourceConfig[] | nullsourceConfigsLoading: booleansourcesModalOpen: boolean@@ -237,6 +257,8 @@ export interface signalSourcesLogicValues {toolDataEventsFailed: booleantoolDataEventsLoading: booleantoolStatusBySource: Partial<Record<AgentRosterSource, SourceToolStatus>>+ visionScanners: ReplayScannerApi[] | null+ visionScannersLoading: booleanzendeskTicketsConfig: SignalSourceConfig | null}@@ -284,6 +306,21 @@ export interface signalSourcesLogicActions {ciSignalsConfig: CISignalsConfigApipayload?: any}+ loadEvaluations: () => any+ loadEvaluationsFailure: (+ error: string,+ errorObject?: any+ ) => {+ error: string+ errorObject?: any+ }+ loadEvaluationsSuccess: (+ evaluations: EvaluationApi[],+ payload?: any+ ) => {+ evaluations: EvaluationApi[]+ payload?: any+ }loadSourceConfigs: () => anyloadSourceConfigsFailure: (error: string,@@ -314,6 +351,21 @@ export interface signalSourcesLogicActions {toolDataEvents: Set<string>payload?: any}+ loadVisionScanners: () => any+ loadVisionScannersFailure: (+ error: string,+ errorObject?: any+ ) => {+ error: string+ errorObject?: any+ }+ loadVisionScannersSuccess: (+ visionScanners: ReplayScannerApi[],+ payload?: any+ ) => {+ visionScanners: ReplayScannerApi[]+ payload?: any+ }onDataSourceSetupComplete: () => {value: true}@@ -329,6 +381,27 @@ export interface signalSourcesLogicActions {saveSessionAnalysisFilters: (filters: RecordingUniversalFilters) => {filters: RecordingUniversalFilters}+ setAllScannerSignals: (enabled: boolean) => {+ enabled: boolean+ }+ setAllScannerSignalsFailure: (+ error: string,+ errorObject?: any+ ) => {+ error: string+ errorObject?: any+ }+ setAllScannerSignalsSuccess: (+ visionScanners: ReplayScannerApi[],+ payload?: {+ enabled: boolean+ }+ ) => {+ visionScanners: ReplayScannerApi[]+ payload?: {+ enabled: boolean+ }+ }setDataWarehouseSourceEnabled: (source: WarehouseBackedSource,enabled: boolean@@ -336,6 +409,9 @@ export interface signalSourcesLogicActions {enabled: booleansource: WarehouseBackedSource}+ setEvaluationSignals: (evaluationIds: string[]) => {+ evaluationIds: string[]+ }startDataWarehouseSourceToggle: (source: WarehouseBackedSource) => {source: WarehouseBackedSource}@@ -357,12 +433,33 @@ export interface signalSourcesLogicActions {toggleErrorTrackingComplete: () => {value: true}+ toggleErrorTrackingType: (sourceType: SignalSourceType) => {+ sourceType: SignalSourceTypeApi+ }toggleEvalReports: () => {value: true}+ toggleEvaluationSignals: (evaluationId: string) => {+ evaluationId: string+ }toggleHealthChecks: () => {value: true}+ toggleScannerSignals: ({ scannerId }: any) => any+ toggleScannerSignalsFailure: (+ error: string,+ errorObject?: any+ ) => {+ error: string+ errorObject?: any+ }+ toggleScannerSignalsSuccess: (+ visionScanners: ReplayScannerApi[],+ payload?: any+ ) => {+ visionScanners: ReplayScannerApi[]+ payload?: any+ }toggleSessionAnalysis: () => {value: true}@@ -413,7 +510,13 @@ export interface signalSourcesLogicMeta {ciSignalsIsFullyEnabled: (ciSignalsConfig: CISignalsConfigApi | null) => booleanisCiSignalsToggling: (togglingSourceKeys: Set<string>) => booleanisSessionAnalysisRunning: (sessionAnalysisConfig: SignalSourceConfig | null) => boolean- enabledSourcesCount: (sourceConfigs: SignalSourceConfig[] | null) => number+ hasEmittingScanner: (visionScanners: ReplayScannerApi[] | null) => boolean | null+ errorTrackingTypeStates: (sourceConfigs: SignalSourceConfig[] | null) => {+ enabled: boolean+ sourceType: SignalSourceType+ }[]+ signalEmittingEvaluationIds: (sourceConfigs: SignalSourceConfig[] | null) => string[]+ enabledSourcesCount: (sourceConfigs: SignalSourceConfig[] | null, hasEmittingScanner: boolean | null) => numberhasNoSources: (sourceConfigs: SignalSourceConfig[] | null, enabledSourcesCount: number) => boolean}}@@ -458,6 +561,10 @@ export const signalSourcesLogic = kea<signalSourcesLogicType>([toggleSignalSourceFailure: (params: ToggleSignalSourceParams, error: string) => ({ params, error }),toggleErrorTracking: true,toggleErrorTrackingComplete: true,+ toggleErrorTrackingType: (sourceType: SignalSourceType) => ({ sourceType }),+ toggleEvaluationSignals: (evaluationId: string) => ({ evaluationId }),+ setEvaluationSignals: (evaluationIds: string[]) => ({ evaluationIds }),+ setAllScannerSignals: (enabled: boolean) => ({ enabled }),toggleCiSignals: (viaSetupWizard?: boolean) => ({ viaSetupWizard: viaSetupWizard ?? false }),toggleCiSignalsComplete: true,toggleHealthChecks: true,@@ -470,7 +577,7 @@ export const signalSourcesLogic = kea<signalSourcesLogicType>([clearSessionAnalysisFilters: true,}),- loaders({+ loaders(({ values }) => ({sourceConfigs: [null as SignalSourceConfig[] | null,{@@ -502,7 +609,78 @@ export const signalSourcesLogic = kea<signalSourcesLogicType>([},},],- }),+ // Replay Vision never writes a `SignalSourceConfig` row: each scanner's own `emits_signals`+ // flag is the per-source authorization, so its roster row reads the scanners API instead.+ // `null` until the answer is in, so callers can tell "nothing there" from "not asked yet".+ visionScanners: [+ null as ReplayScannerApi[] | null,+ {+ loadVisionScanners: async (): Promise<ReplayScannerApi[]> => {+ try {+ // `ApiConfig` over `teamLogic.values.currentTeamId`: the team loads async, so+ // on a cold mount the kea value is still null and the source reads as off.+ const response = await visionScannersList(String(ApiConfig.getCurrentProjectId()), {+ enabled: 'enabled',+ limit: ENTITY_PAGE_SIZE,+ })+ return response.results+ } catch {+ // Replay Vision 404s when its flag is off, and this source only ever adds to+ // the count, so a failure reads as "no scanners" rather than stranding every+ // consumer of the count on a loading state.+ return []+ }+ },+ toggleScannerSignals: async ({ scannerId }): Promise<ReplayScannerApi[]> => {+ const scanners = values.visionScanners ?? []+ const scanner = scanners.find((existing: ReplayScannerApi) => existing.id === scannerId)+ if (!scanner) {+ return scanners+ }+ const updated = await visionScannersPartialUpdate(+ String(ApiConfig.getCurrentProjectId()),+ scannerId,+ { emits_signals: !scanner.emits_signals }+ )+ return scanners.map((existing: ReplayScannerApi) =>+ existing.id === scannerId ? updated : existing+ )+ },+ // One action rather than N single toggles: each of those reads the same starting+ // list and returns a whole new one, so the last to land would drop the others.+ setAllScannerSignals: async ({ enabled }): Promise<ReplayScannerApi[]> => {+ const scanners = values.visionScanners ?? []+ const changing = scanners.filter(+ (scanner: ReplayScannerApi) => (scanner.emits_signals ?? false) !== enabled+ )+ const updated = await Promise.all(+ changing.map((scanner: ReplayScannerApi) =>+ visionScannersPartialUpdate(String(ApiConfig.getCurrentProjectId()), scanner.id, {+ emits_signals: enabled,+ })+ )+ )+ const byId = new Map(updated.map((scanner) => [scanner.id, scanner]))+ return scanners.map((existing: ReplayScannerApi) => byId.get(existing.id) ?? existing)+ },+ },+ ],+ evaluations: [+ null as EvaluationApi[] | null,+ {+ loadEvaluations: async (): Promise<EvaluationApi[]> => {+ try {+ const response = await evaluationsList(String(ApiConfig.getCurrentProjectId()), {+ limit: ENTITY_PAGE_SIZE,+ })+ return response.results+ } catch {+ return []+ }+ },+ },+ ],+ })),reducers({sourcesModalOpen: [@@ -770,22 +948,25 @@ export const signalSourcesLogic = kea<signalSourcesLogicType>([: team && errorTrackingDataStatus === 'none'? false: null+ // Both replay sources read recordings, so they stand or fall on the same opt-in.+ const sessionReplayTool: SourceToolStatus = {+ toolName: 'Session Replay',+ enabled: team ? !!team.session_recording_opt_in : null,+ enablement: 'session_replay',+ // Recordings never produce event definitions, so there is no cheap signal.+ dataStatus: 'unavailable',+ }return {error_tracking: {- toolName: 'Error tracking',+ toolName: 'Error Tracking',// Server SDKs capture exceptions without the autocapture opt-in, so recent// exception data counts as on.enabled: errorTrackingEnabled,enablement: 'error_tracking',dataStatus: errorTrackingDataStatus,},- session_replay: {- toolName: 'Session replay',- enabled: team ? !!team.session_recording_opt_in : null,- enablement: 'session_replay',- // Recordings never produce event definitions, so there is no cheap signal.- dataStatus: 'unavailable',- },+ replay_vision: sessionReplayTool,+ session_replay: sessionReplayTool,conversations: {toolName: 'Support',enabled: team ? !!team.conversations_enabled : null,@@ -793,13 +974,13 @@ export const signalSourcesLogic = kea<signalSourcesLogicType>([dataStatus: 'unavailable',},llm_analytics: {- toolName: 'AI observability',+ toolName: 'AI Observability',enabled: true,enablement: null,dataStatus: dataStatus('$ai_generation', '$ai_trace'),},analytics: {- toolName: 'Product analytics',+ toolName: 'Product Analytics',enabled: true,enablement: null,dataStatus: dataStatus('$pageview', '$autocapture'),@@ -834,20 +1015,61 @@ export const signalSourcesLogic = kea<signalSourcesLogicType>([(s) => [s.sessionAnalysisConfig],(config: SignalSourceConfig | null): boolean => config?.status === SignalSourceConfigStatus.RUNNING,],- enabledSourcesCount: [+ // `null` until the scanners load, so callers can tell "no scanner emits" from "not asked yet".+ hasEmittingScanner: [+ (s) => [s.visionScanners],+ (visionScanners: ReplayScannerApi[] | null): boolean | null =>+ visionScanners === null ? null : visionScanners.some((scanner) => scanner.emits_signals),+ ],+ // Each error tracking signal type is its own config row, so each can be armed on its own.+ errorTrackingTypeStates: [(s) => [s.sourceConfigs],+ (sourceConfigs: SignalSourceConfig[] | null): { sourceType: SignalSourceType; enabled: boolean }[] =>+ ERROR_TRACKING_SIGNAL_SOURCE_TYPES.map((sourceType) => ({+ sourceType,+ enabled:+ sourceConfigs?.find(+ (row) =>+ row.source_product === SignalSourceProduct.ErrorTracking &&+ row.source_type === sourceType+ )?.enabled === true,+ })),+ ],+ // Per-evaluation emission is an allowlist on the `evaluation` row's config, not a flag on the+ // evaluation itself, so an evaluation can keep running while its findings stay out of the inbox.+ signalEmittingEvaluationIds: [+ (s) => [s.sourceConfigs],+ (sourceConfigs: SignalSourceConfig[] | null): string[] => {+ const row = sourceConfigs?.find(+ (c) =>+ c.source_product === SignalSourceProduct.LlmAnalytics &&+ c.source_type === SignalSourceType.Evaluation+ )+ if (!row?.enabled) {+ return []+ }+ const ids = (row.config as { evaluation_ids?: unknown })?.evaluation_ids+ return Array.isArray(ids) ? ids.filter((id): id is string => typeof id === 'string') : []+ },+ ],+ enabledSourcesCount: [+ (s) => [s.sourceConfigs, s.hasEmittingScanner],// The scout gate is a meta-toggle surfaced in the Scout troop section, not a generic// signal source — exclude it so a scout-only project doesn't show the "Signal sources"- // setup card as done with a phantom "1 watching".- (sourceConfigs: SignalSourceConfig[] | null): number =>- sourceConfigs?.filter(- (c) =>- c.enabled &&- !(- c.source_product === SignalSourceProduct.SignalsScout &&- c.source_type === SignalSourceType.CrossSourceIssue- )- ).length ?? 0,+ // setup card as done with a phantom "1 watching". Replay Vision has no config row at+ // all, so it is counted separately, once, however many of its scanners emit.+ (sourceConfigs: SignalSourceConfig[] | null, hasEmittingScanner: boolean | null): number => {+ const configured =+ sourceConfigs?.filter(+ (c) =>+ c.enabled &&+ !(+ c.source_product === SignalSourceProduct.SignalsScout &&+ c.source_type === SignalSourceType.CrossSourceIssue+ )+ ).length ?? 0+ return configured + (hasEmittingScanner ? 1 : 0)+ },],hasNoSources: [(s) => [s.sourceConfigs, s.enabledSourcesCount],@@ -1005,7 +1227,9 @@ export const signalSourcesLogic = kea<signalSourcesLogicType>([}},toggleErrorTracking: async (_, breakpoint) => {- const desiredEnabled = !values.errorTrackingIsFullyEnabled+ // The row switch reads "on" as soon as one type is armed, so turning it off has to+ // stand every type down rather than arm the remaining ones.+ const desiredEnabled = !values.errorTrackingTypeStates.some(({ enabled }) => enabled)const configs = values.sourceConfigs ?? []// First connection when no persisted error-tracking config existed before this enable.const wasConnected = configs.some(@@ -1052,6 +1276,66 @@ export const signalSourcesLogic = kea<signalSourcesLogicType>([actions.loadSourceConfigs()}},+ toggleErrorTrackingType: async ({ sourceType }, breakpoint) => {+ const configs = values.sourceConfigs ?? []+ const existing = configs.find(+ (c) => c.source_product === SignalSourceProduct.ErrorTracking && c.source_type === sourceType+ )+ const desiredEnabled = !(existing?.enabled ?? false)+ try {+ if (existing && !existing.id.startsWith('new_')) {+ await api.signalSourceConfigs.update(existing.id, { enabled: desiredEnabled })+ } else if (desiredEnabled) {+ await api.signalSourceConfigs.create({+ source_product: SignalSourceProduct.ErrorTracking,+ source_type: sourceType,+ enabled: true,+ config: {},+ })+ }+ breakpoint()+ } catch (error: any) {+ breakpoint()+ lemonToast.error(error?.detail || error?.message || 'Failed to toggle this signal type')+ }+ actions.loadSourceConfigs()+ },+ toggleEvaluationSignals: async ({ evaluationId }) => {+ const current = values.signalEmittingEvaluationIds+ actions.setEvaluationSignals(+ current.includes(evaluationId)+ ? current.filter((id) => id !== evaluationId)+ : [...current, evaluationId]+ )+ },+ setEvaluationSignals: async ({ evaluationIds: nextIds }, breakpoint) => {+ const existing = (values.sourceConfigs ?? []).find(+ (c) =>+ c.source_product === SignalSourceProduct.LlmAnalytics &&+ c.source_type === SignalSourceType.Evaluation+ )+ try {+ if (existing && !existing.id.startsWith('new_')) {+ await api.signalSourceConfigs.update(existing.id, {+ // The row gates the whole allowlist, so an empty list means nothing to send.+ enabled: nextIds.length > 0,+ config: { ...existing.config, evaluation_ids: nextIds },+ })+ } else {+ await api.signalSourceConfigs.create({+ source_product: SignalSourceProduct.LlmAnalytics,+ source_type: SignalSourceType.Evaluation,+ enabled: nextIds.length > 0,+ config: { evaluation_ids: nextIds },+ })+ }+ breakpoint()+ } catch (error: any) {+ breakpoint()+ lemonToast.error(error?.detail || error?.message || 'Failed to toggle this evaluation')+ }+ actions.loadSourceConfigs()+ },toggleCiSignals: async ({ viaSetupWizard }, breakpoint) => {const desiredEnabled = !values.ciSignalsIsFullyEnabledconst wasConnected = values.ciSignalsConfig?.configured ?? false@@ -1234,6 +1518,8 @@ export const signalSourcesLogic = kea<signalSourcesLogicType>([// The condition allows us to safely mount this logic for user without the product autonomy feature flag// without needlessly loading the source configsactions.loadSourceConfigs()+ actions.loadVisionScanners()+ actions.loadEvaluations()if (values.featureFlags[FEATURE_FLAGS.ENGINEERING_ANALYTICS]) {actions.loadCiSignalsConfig()}diff --git a/products/slack_app/backend/onboarding.py b/products/slack_app/backend/onboarding.pyindex 15072d431f4e..4acc8f1376c9 100644--- a/products/slack_app/backend/onboarding.py+++ b/products/slack_app/backend/onboarding.py@@ -129,21 +129,30 @@ def _sources_blocks(integration: Integration) -> list[dict]:)sources = onboarding_sources(integration.team_id)+ tickable = [source for source in sources if source.togglable]options = [{"text": {"type": "mrkdwn", "text": f"*{source.label}*: {source.description}"},"value": source.key,}- for source in sources+ for source in tickable]checkboxes: dict = {"type": "checkboxes", "action_id": INBOX_SOURCES_CHECKBOXES_ACTION, "options": options}- initial = [option for option, source in zip(options, sources) if source.enabled]+ initial = [option for option, source in zip(options, tickable) if source.enabled]if initial:checkboxes["initial_options"] = initial- return [+ blocks = [_section("*2. Choose what I watch* :eyes:\nTick the signals I should monitor and investigate."),{"type": "actions", "block_id": f"{INBOX_SOURCES_BLOCK_PREFIX}:{integration.id}", "elements": [checkboxes]},]+ # Sources set up elsewhere have no checkbox, so say what's already watching. Without this the+ # step reads as done with nothing ticked.+ elsewhere = [source.label for source in sources if not source.togglable and source.enabled]+ if elsewhere:+ blocks.append(+ {"type": "context", "elements": [{"type": "mrkdwn", "text": f"Already watching: {', '.join(elsewhere)}"}]}+ )+ return blocksdef _channel_blocks(integration: Integration, slack: SlackIntegration, *, done: bool) -> list[dict]:diff --git a/products/slack_app/backend/tests/test_onboarding.py b/products/slack_app/backend/tests/test_onboarding.pyindex 5774c5056f48..7cb6eaa0e04f 100644--- a/products/slack_app/backend/tests/test_onboarding.py+++ b/products/slack_app/backend/tests/test_onboarding.py@@ -318,7 +318,7 @@ class TestOnboarding:blocked = onboarding.apply_sources_selection(self.integration, "U1", ["session_replay"])- assert blocked == ["Session replay analysis"] # surfaced so the handler can nudge the user+ assert blocked == ["Session replay analysis (legacy)"] # surfaced so the handler can nudge the userassert has_enabled_source(self.team.id) is False@patch("products.slack_app.backend.services.inbox_interactivity._post_ephemeral_via_response_url")@@ -362,7 +362,7 @@ class TestOnboarding:self.organization.is_ai_data_processing_approved = Falseself.organization.save(update_fields=["is_ai_data_processing_approved"])- assert set_sources(self.team.id, None, ["session_replay"]) == ["Session replay analysis"]+ assert set_sources(self.team.id, None, ["session_replay"]) == ["Session replay analysis (legacy)"]assert has_enabled_source(self.team.id) is Falsedef test_set_sources_keeps_enabled_source_when_ai_later_revoked(self):@@ -376,7 +376,7 @@ class TestOnboarding:# AI revoked: re-submitting the still-ticked selection must leave it enabled, not disable it.self.organization.is_ai_data_processing_approved = Falseself.organization.save(update_fields=["is_ai_data_processing_approved"])- assert set_sources(self.team.id, None, ["session_replay"]) == ["Session replay analysis"]+ assert set_sources(self.team.id, None, ["session_replay"]) == ["Session replay analysis (legacy)"]assert has_enabled_source(self.team.id) is True@patch("posthog.models.integration.WebClient")diff --git a/tach.toml b/tach.tomlindex f89259ecbd14..eec03a13a902 100644--- a/tach.toml+++ b/tach.toml@@ -704,6 +704,9 @@ depends_on = ["products.feature_flags","products.notebooks","products.product_analytics",+ # Facade-only: Replay Vision authorizes signal emission per scanner rather than through a+ # SignalSourceConfig row, so onboarding has to ask it whether any scanner is emitting.+ "products.replay_vision","products.skills","products.surveys","products.tasks",