Skip to content

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

feat(aio): add anomaly alert investigations to self-driving (#82175)

Radu Raicea156fec7b55ff
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index bd3f17f6d652..7e760b6eca12 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -6431,33 +6431,33 @@ snapshots:
scenes-app-inbox-scene--self-driving-verdict-pending--light:
hash: v1.k794b7964.1d230f03b5a074e0816ee4c5dd1b4591cfdf86bb602971a6233019985f1c2677.h7Zlyp6gh4AnCQRve-W4zeSDnhAhhqVM1FIqiYN1gNA
scenes-app-inbox-signalsourcespanel--armed-but-tools-off--dark:
- hash: v1.k794b7964.4eccbb229cc622764d4ff5d455f089a98fdebe9f5d9cbbcc5280c44fd8bd7f3c.HlgmZbqLubOWZoCcRljJWPEDRVRx-fH9V0D0gZqc-_k
+ hash: v1.k794b7964.dad07e3272e433a69b81e55d5fac37d75d3f743154490c1ff3c5ef57d657be16.4cTh_S35TMTgXe_HQWzOP8HRN-aUWN9DNUKLTgmMoj4
scenes-app-inbox-signalsourcespanel--armed-but-tools-off--light:
- hash: v1.k794b7964.0af0f536b4cbfcbca4960d73826c8908a66d04b781dc2ea8ae93216b8303b962.IF1bvyMLbRnQod9tcQKT6aEk3e_mkJ2BqysGOdG_N88
+ hash: v1.k794b7964.1dc995875cf262796b527a1e889516ac2b7a8514eb19d4f1b4137fb8eabca975.i_K2jMotSMF-ykCtoZTBzMyA08PV9wDLJEX094kIBD0
scenes-app-inbox-signalsourcespanel--arming-blocked--dark:
- hash: v1.k794b7964.6508408c7d1d2a73f0d7d9a6640ecc86ddd8a55070cb5ccec58d5eaecc9a1ee1.QvsqSw3NH6kNbyF_9gEBXt-VA0GGqozrosTOb4wrQ0s
+ hash: v1.k794b7964.71ac42fd1e7056933699992aef59540c49eedbce96c3c3ca368e5e538826b960.tWa3l92wgH6yKpa_aYVatJxPnr2wbjTmD89LtEb4K80
scenes-app-inbox-signalsourcespanel--arming-blocked--light:
- hash: v1.k794b7964.43495af5b8515cb48f1e0ef36924486a8eafcfd97d4218f74e231d45626abc4f.jEPdlDtnpC0S5-nC-oi8N0OrmYMKCC9VGArdKLu9akg
+ hash: v1.k794b7964.9ad76d414d11155032f260e4c4b69ba1986e3b4163c1f2e469c32592d6ac0443.aLsMiwnupJOQHp3IwrdT9Qq7pAkg2vPWZ-Bh7p7d0rA
scenes-app-inbox-signalsourcespanel--event-definitions-unavailable--dark:
- hash: v1.k794b7964.273fd40f524dd36cbda622419dcae64b55b44a023bf4706e2da203be2c0555cc.sLPD2nOQxiI87UsGVzIb_q_3-qk8shvdQVr3reIjQUw
+ hash: v1.k794b7964.beeb4d600d3133a633bee704a0c3d791aac5439ad4f946155106890e0a4405f6.u9204AKTy8nWE2WDB2FU61BrNvuRTVlLpJCvT3BaC-Y
scenes-app-inbox-signalsourcespanel--event-definitions-unavailable--light:
- hash: v1.k794b7964.b3f2a475f205947742faa972ba7cafabb5e0097cfcbc3dcc13ee13419956cc78.SXa3oHb4NDlQPBQFUzNf9cV-WtEC3UMcm7kD5PSDkIg
+ hash: v1.k794b7964.081a1fad69c387c67c550c79755130e9dfaa61d7fad58175369f614bf27d7728.CbM3vQfjDPLXTNpGz15hJ77Jyi_dIM5Dd3vT5B-bGL4
scenes-app-inbox-signalsourcespanel--everything-healthy--dark:
- hash: v1.k794b7964.2277dfee7316498948f33c529c863a6de38821c4e202927888716020ab02d2d1.TzO2XhJZyyGDR6t2oDkEp0AfZPtOuoE4ID05kMTCwHk
+ hash: v1.k794b7964.b2e233f272369c041fef33328ee9683c2a30adfb34879ed984f9991169cf4b37.oZfVzcukSDS6iHVPB-r5SP1SA6159eg7eTyloqIZiUs
scenes-app-inbox-signalsourcespanel--everything-healthy--light:
- hash: v1.k794b7964.479e04067918069ad9a1e3c733f545e8d4f5ba1eb217c09d991e0cc8001c1d14.xPY2-HMT2hiI8NUPr4WXaMwTF4cVVlj3wuPbw1IM2nw
+ hash: v1.k794b7964.4a7d5460e801fb9c14851b428f597f53b69ac1506477ab425435acc0f35f586b.-WgldiC8BrGdolvo-S2sZtbqEwZDI6RKV5erZt1OG9w
scenes-app-inbox-signalsourcespanel--playground--dark:
- hash: v1.k794b7964.f0f6092743d729168f52bd716c5a323ba982d46f4abecd29f299304b7a51e5f2.zrl0G5G7_AkS2ffD80fFMBE8i6_YkgJdn2xp8b4r3Tc
+ hash: v1.k794b7964.732341765db75db485563342ff39953106c2809ade1b19af0b15916f0646c861.JqgudGUmBZ8yStkJGvGciMbhZUa19nVI4Xw8tuUFJSw
scenes-app-inbox-signalsourcespanel--playground--light:
- hash: v1.k794b7964.0d6f8094989e0a016829dccf76a3a67c94404e3cb3ebe97e941d2a8ce9ca429f.MzaG8BDySWv8lNlZHXxJsStnoAYa5eqAgnLQXHkqOxE
+ hash: v1.k794b7964.5f876c8877cf09dd4599907541d5ab1a39cb18c60dd310bbd058f0a374fedbf7.GdDUQqucO1cCIO9HAn_RtLEDpLrsX-42lqsR7jweyGY
scenes-app-inbox-signalsourcespanel--server-side-exceptions-only--dark:
- hash: v1.k794b7964.f0f6092743d729168f52bd716c5a323ba982d46f4abecd29f299304b7a51e5f2.AnaXXNhTZ9-hx3gYz2B9VemxUGlj4APgvZu24CSFfTE
+ hash: v1.k794b7964.732341765db75db485563342ff39953106c2809ade1b19af0b15916f0646c861.EthjU6-rAzHWPSErj2I4YXi8idPhAtwQHiFjb1g6K4k
scenes-app-inbox-signalsourcespanel--server-side-exceptions-only--light:
- hash: v1.k794b7964.0d6f8094989e0a016829dccf76a3a67c94404e3cb3ebe97e941d2a8ce9ca429f.HyqGUiaBGi1C-o9srATw1iMGCL7zPrFui7zJcI8BYaI
+ hash: v1.k794b7964.5f876c8877cf09dd4599907541d5ab1a39cb18c60dd310bbd058f0a374fedbf7.pItXtECs25b0CNhjmEOvmQwTwhP6maPVMzODmQaewPE
scenes-app-inbox-signalsourcespanel--tools-on-no-recent-data--dark:
- hash: v1.k794b7964.8bfaaa7e49580db377cbc5469e193d84f23d37a1f980e13b3d2c9a2f7284fcb6.c2O4XkGT1XxL4SqcSChHmkJjDKdt9S0EV64LCzulm78
+ hash: v1.k794b7964.ede380c1b6b227061209acd70a462e7742b56a16dd71f57c3f9cc7fb776432c2.Vizn91fzHqZGfZShQPQtrGi2mpaSScoYuuEUxjJ3sdw
scenes-app-inbox-signalsourcespanel--tools-on-no-recent-data--light:
- hash: v1.k794b7964.6c18d86eff41c1e43f5e038edd785adf1c116023934a294b28b034b01d23e0c3.vnFGIkh9kZ_zdHi_D36WNlDQPocyjk_HjBqJ3PM6XlM
+ hash: v1.k794b7964.0912985d46e913d5e8760dbd1c2e66c60ac291e4445527acd2442a28319582b9.-SPPzUlkJMTWDPCpGJNtVE-T22zWyDhEhxjesNCcx98
scenes-app-inbox-tabs--pull-requests--dark:
hash: v1.k794b7964.474d8e744637e08afd4bb7540f0f5dafd6a79342c2f547188cb436b55f9ef8e7.PiyD1Zkhkot-_DKLU3W0T5uA7rvpTUTn5bKChCa3AV4
scenes-app-inbox-tabs--pull-requests--light:
diff --git a/frontend/src/lib/lemon-ui/LemonCollapse/LemonCollapse.tsx b/frontend/src/lib/lemon-ui/LemonCollapse/LemonCollapse.tsx
index f48e1d47da3a..994fd107009d 100644
--- a/frontend/src/lib/lemon-ui/LemonCollapse/LemonCollapse.tsx
+++ b/frontend/src/lib/lemon-ui/LemonCollapse/LemonCollapse.tsx
@@ -16,6 +16,7 @@ export interface LemonCollapsePanel<K extends React.Key> {
content: ReactNode
dataAttr?: string
className?: string
+ bodyClassName?: string
}
interface LemonCollapsePropsBase<K extends React.Key> {
@@ -110,6 +111,7 @@ interface LemonCollapsePanelProps {
size: LemonButtonProps['size']
onChange: (isExpanded: boolean) => void
className?: string
+ bodyClassName?: string
dataAttr?: string
onHeaderClick?: () => void
}
@@ -125,6 +127,7 @@ function LemonCollapsePanel({
isExpanded,
size,
className,
+ bodyClassName,
dataAttr,
indexUnexpanableHeader,
onChange,
@@ -176,7 +179,7 @@ function LemonCollapsePanel({
{rendered && (
<div
ref={bodyRef}
- className="LemonCollapsePanel__body"
+ className={clsx('LemonCollapsePanel__body', bodyClassName)}
// eslint-disable-next-line react/forbid-dom-props
style={{ height: shown ? contentHeight : 0 }}
aria-busy={rendered !== shown}
diff --git a/posthog/api/test/dashboards/test_dashboard.py b/posthog/api/test/dashboards/test_dashboard.py
index 0997588ea467..ec19f85fef92 100644
--- a/posthog/api/test/dashboards/test_dashboard.py
+++ b/posthog/api/test/dashboards/test_dashboard.py
@@ -3786,6 +3786,14 @@ class TestDashboard(APIBaseTest, QueryMatchingTest):
tags = list(dashboard.tagged_items.values_list("tag__name", flat=True))
self.assertEqual(tags, ["llm-analytics"])
+ insights = Insight.objects.filter(dashboard_tiles__dashboard=dashboard)
+ self.assertGreater(insights.count(), 0)
+ for insight in insights:
+ self.assertEqual(
+ list(insight.tagged_items.values_list("tag__name", flat=True)),
+ ["ai-observability"],
+ )
+
def test_create_unlisted_dashboard_enforces_uniqueness(self):
"""Test that creating duplicate unlisted dashboards returns 409"""
# Create first dashboard
diff --git a/posthog/helpers/dashboard_templates.py b/posthog/helpers/dashboard_templates.py
index c5c16923f722..d6c34f783df9 100644
--- a/posthog/helpers/dashboard_templates.py
+++ b/posthog/helpers/dashboard_templates.py
@@ -523,6 +523,7 @@ def create_from_template(
description=template_tile.get("description"),
color=template_tile.get("color"),
layouts=template_tile.get("layouts"),
+ tags=template_tile.get("tags"),
user=user,
)
elif tile_type == "TEXT":
@@ -655,6 +656,7 @@ def _create_tile_for_insight(
layouts: dict,
color: Optional[str],
query: Optional[dict] = None,
+ tags: Optional[list[str]] = None,
user=None,
) -> None:
insight = Insight.objects.create(
@@ -666,6 +668,14 @@ def _create_tile_for_insight(
created_by=user,
last_modified_by=user,
)
+ for tag_name in tags or []:
+ tag, _ = Tag.objects.get_or_create(
+ name=tag_name,
+ team_id=dashboard.team_id,
+ defaults={"team_id": dashboard.team_id},
+ )
+ insight.tagged_items.create(tag_id=tag.id)
+
DashboardTile.objects.create(
insight=insight,
dashboard=dashboard,
diff --git a/posthog/temporal/ai_observability/run_evaluation.py b/posthog/temporal/ai_observability/run_evaluation.py
index 94062b782eb5..93efc35033d5 100644
--- a/posthog/temporal/ai_observability/run_evaluation.py
+++ b/posthog/temporal/ai_observability/run_evaluation.py
@@ -327,6 +327,8 @@ class RunEvaluationWorkflow(PostHogWorkflow):
schedule_to_close_timeout=timedelta(seconds=30),
)
+ # Legacy per-result signal path. The frontend no longer exposes its enablement;
+ # evaluation reports are the supported AI observability signal source.
if evaluation_type == "llm_judge" and result.get("verdict") is True and result.get("reasoning"):
event_uuid = inputs.event_data.get("uuid", "")
properties = inputs.event_data.get("properties", {})
diff --git a/products/ai_observability/backend/dashboard_templates.py b/products/ai_observability/backend/dashboard_templates.py
index 617a86581e29..2bf734fb30a4 100644
--- a/products/ai_observability/backend/dashboard_templates.py
+++ b/products/ai_observability/backend/dashboard_templates.py
@@ -3,7 +3,7 @@ from products.dashboards.backend.models.dashboard_templates import DashboardTemp
def get_ai_observability_default_template() -> DashboardTemplate:
"""Default dashboard template for AI observability."""
- return DashboardTemplate(
+ template = DashboardTemplate(
template_name="AI observability default",
dashboard_description="Overview of your AI usage, costs, and performance",
dashboard_filters={"date_from": "-7d"},
@@ -315,3 +315,9 @@ def get_ai_observability_default_template() -> DashboardTemplate:
scope=DashboardTemplate.Scope.GLOBAL,
availability_contexts=["llm-analytics"],
)
+
+ for tile in template.tiles or []:
+ if tile.get("type") == "INSIGHT":
+ tile["tags"] = ["ai-observability"]
+
+ return template
diff --git a/products/ai_observability/frontend/AIObservabilityScene.tsx b/products/ai_observability/frontend/AIObservabilityScene.tsx
index cca83ab3b80f..36e63903e0a5 100644
--- a/products/ai_observability/frontend/AIObservabilityScene.tsx
+++ b/products/ai_observability/frontend/AIObservabilityScene.tsx
@@ -417,7 +417,7 @@ const DOCS_URLS_BY_TAB: Record<string, string> = {
const TAB_DESCRIPTIONS: Record<string, string> = {
dashboard: 'Overview of your AI usage, costs, and performance metrics.',
- 'self-driving': 'Create and manage scouts that monitor your AI observability data.',
+ 'self-driving': 'Manage scouts, eval reports, and anomaly alert investigations for your AI observability data.',
traces: 'Explore end-to-end traces of your LLM interactions.',
reviews: 'Browse reviews, organize queues, and manage the scoring setup.',
generations: 'View individual AI generations and their details.',
diff --git a/products/ai_observability/frontend/evaluations/evaluationsApi.ts b/products/ai_observability/frontend/evaluations/evaluationsApi.ts
index e57d898ad301..9077f0f43336 100644
--- a/products/ai_observability/frontend/evaluations/evaluationsApi.ts
+++ b/products/ai_observability/frontend/evaluations/evaluationsApi.ts
@@ -2,6 +2,7 @@ import type { AnyPropertyFilter } from '~/types'
import { evaluationsList, evaluationsPartialUpdate, llmAnalyticsEvaluationReportsList } from '../generated/api'
import type { EvaluationApi, EvaluationReportApi, PatchedEvaluationApi } from '../generated/api.schemas'
+import { listAllPages } from '../listAllPages'
import type { EvaluationConfig, ModelConfiguration } from './types'
const EVALUATIONS_PAGE_SIZE = 100
@@ -103,36 +104,19 @@ export function evaluationFromApi(evaluation: EvaluationApi): EvaluationConfig {
}
export async function listAllEvaluations(projectId: string): Promise<EvaluationConfig[]> {
- const evaluations: EvaluationConfig[] = []
- let offset = 0
-
- while (true) {
- const response = await evaluationsList(projectId, { limit: EVALUATIONS_PAGE_SIZE, offset })
- evaluations.push(...response.results.map(evaluationFromApi))
-
- if (!response.next || response.results.length === 0) {
- return evaluations
- }
- offset += response.results.length
- }
+ const evaluations = await listAllPages((offset) =>
+ evaluationsList(projectId, { limit: EVALUATIONS_PAGE_SIZE, offset })
+ )
+ return evaluations.map(evaluationFromApi)
}
export async function listAllEvaluationReports(projectId: string): Promise<EvaluationReportApi[]> {
- const reports: EvaluationReportApi[] = []
- let offset = 0
-
- while (true) {
- const response = await llmAnalyticsEvaluationReportsList(projectId, {
+ return listAllPages((offset) =>
+ llmAnalyticsEvaluationReportsList(projectId, {
limit: EVALUATION_REPORTS_PAGE_SIZE,
offset,
})
- reports.push(...response.results)
-
- if (!response.next || response.results.length === 0) {
- return reports
- }
- offset += response.results.length
- }
+ )
}
export async function patchEvaluation(
diff --git a/products/ai_observability/frontend/listAllPages.ts b/products/ai_observability/frontend/listAllPages.ts
new file mode 100644
index 000000000000..32f47fc191c9
--- /dev/null
+++ b/products/ai_observability/frontend/listAllPages.ts
@@ -0,0 +1,16 @@
+export async function listAllPages<T>(
+ requestPage: (offset: number) => Promise<{ results: T[]; next?: string | null }>
+): Promise<T[]> {
+ const results: T[] = []
+ let offset = 0
+
+ while (true) {
+ const response = await requestPage(offset)
+ results.push(...response.results)
+
+ if (!response.next || response.results.length === 0) {
+ return results
+ }
+ offset += response.results.length
+ }
+}
diff --git a/products/ai_observability/frontend/selfDriving/AIObservabilitySelfDriving.test.tsx b/products/ai_observability/frontend/selfDriving/AIObservabilitySelfDriving.test.tsx
index 4c201654ffbc..dafdbc2326ef 100644
--- a/products/ai_observability/frontend/selfDriving/AIObservabilitySelfDriving.test.tsx
+++ b/products/ai_observability/frontend/selfDriving/AIObservabilitySelfDriving.test.tsx
@@ -1,17 +1,19 @@
import '@testing-library/jest-dom'
-import { cleanup, render, screen } from '@testing-library/react'
+import { cleanup, render, screen, within } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import { Provider } from 'kea'
-import { router } from 'kea-router'
import type { ReactNode } from 'react'
import { FEATURE_FLAGS } from 'lib/constants'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
+import { newInternalTab } from 'lib/utils/newInternalTab'
import { useMocks } from '~/mocks/jest'
import { initKeaTests } from '~/test/init'
+import * as alertsApi from 'products/alerts/frontend/generated/api'
+
import * as aiObservabilityApi from '../generated/api'
import { AIObservabilitySelfDriving } from './AIObservabilitySelfDriving'
@@ -21,6 +23,12 @@ jest.mock('../generated/api', () => ({
llmAnalyticsEvaluationReportsList: jest.fn(),
}))
+jest.mock('products/alerts/frontend/generated/api', () => ({
+ alertsList: jest.fn(),
+}))
+
+jest.mock('lib/utils/newInternalTab')
+
jest.mock('products/signals/frontend/generated/api', () => ({
signalsScoutConfigList: jest.fn(() => new Promise(() => {})),
signalsScoutMetadataGet: jest.fn(() => new Promise(() => {})),
@@ -32,6 +40,7 @@ jest.mock('products/signals/frontend/inbox/components/config/scouts/ScoutCreateB
describe('AIObservabilitySelfDriving', () => {
beforeEach(() => {
+ localStorage.clear()
useMocks({
get: {
'/api/environments/:teamId/llm_analytics/provider_keys/': { results: [] },
@@ -47,6 +56,7 @@ describe('AIObservabilitySelfDriving', () => {
featureFlagLogic.actions.setFeatureFlags([FEATURE_FLAGS.LLM_ANALYTICS_EVALUATIONS_START_WITH_AI], {
[FEATURE_FLAGS.LLM_ANALYTICS_EVALUATIONS_START_WITH_AI]: true,
})
+ jest.mocked(newInternalTab).mockReset()
jest.mocked(aiObservabilityApi.evaluationDirectoriesList).mockResolvedValue([])
jest.mocked(aiObservabilityApi.evaluationsList).mockResolvedValue({
count: 2,
@@ -124,10 +134,78 @@ describe('AIObservabilitySelfDriving', () => {
},
],
})
+ jest.mocked(alertsApi.alertsList).mockResolvedValue({
+ count: 2,
+ next: null,
+ previous: null,
+ results: [
+ {
+ id: 'alert-investigated',
+ created_by: {
+ id: 1,
+ uuid: '00000000-0000-0000-0000-000000000001',
+ email: '[email protected]',
+ hedgehog_config: null,
+ },
+ created_at: '2024-01-01T00:00:00Z',
+ insight: 10,
+ insight_short_id: 'insight-cost',
+ insight_display_name: 'AI cost by model',
+ name: 'Unexpected AI cost',
+ subscribed_users: [],
+ threshold: {
+ id: 'threshold-investigated',
+ created_at: '2024-01-01T00:00:00Z',
+ configuration: { type: 'absolute', bounds: null },
+ },
+ state: 'Not firing',
+ enabled: true,
+ last_notified_at: null,
+ last_checked_at: '2024-01-04T00:00:00Z',
+ next_check_at: null,
+ checks: [],
+ checks_total: null,
+ last_value: null,
+ investigation_agent_enabled: true,
+ search_match_type: null,
+ },
+ {
+ id: 'alert-uninvestigated',
+ created_by: {
+ id: 1,
+ uuid: '00000000-0000-0000-0000-000000000001',
+ email: '[email protected]',
+ hedgehog_config: null,
+ },
+ created_at: '2024-01-02T00:00:00Z',
+ insight: 11,
+ insight_short_id: 'insight-errors',
+ insight_display_name: 'AI errors by model',
+ name: 'Unexpected error rate',
+ subscribed_users: [],
+ threshold: {
+ id: 'threshold-uninvestigated',
+ created_at: '2024-01-02T00:00:00Z',
+ configuration: { type: 'absolute', bounds: null },
+ },
+ state: 'Not firing',
+ enabled: true,
+ last_notified_at: null,
+ last_checked_at: null,
+ next_check_at: null,
+ checks: [],
+ checks_total: null,
+ last_value: null,
+ investigation_agent_enabled: false,
+ search_match_type: null,
+ },
+ ],
+ })
})
afterEach(() => {
cleanup()
+ localStorage.clear()
})
it('renders scout templates and evaluation report status', async () => {
@@ -147,23 +225,32 @@ describe('AIObservabilitySelfDriving', () => {
const docsLink = screen.getByText('Read the docs')
expect(docsLink).toHaveAttribute('href', 'https://posthog.com/docs/ai-observability/self-driving')
expect(docsLink).toHaveAttribute('target', '_blank')
- expect(screen.getByText('ai-observability').closest('p')).toHaveTextContent(
+ const introBanner = screen.getByText('Self-driving').closest('.LemonBanner')
+ const inboxLink = within(introBanner as HTMLElement)
+ .getByText('inbox')
+ .closest('a')
+ expect(inboxLink).toHaveAttribute('href', '/project/997/inbox')
+ expect(inboxLink).toHaveAttribute('target', '_blank')
+ expect(screen.getAllByText('ai-observability')[0].closest('p')).toHaveTextContent(
'Add the ai-observability label to a scout for it to appear here.'
)
expect(await screen.findByText('Correctness check')).toBeInTheDocument()
expect(screen.getByText('Tone check')).toBeInTheDocument()
- expect(screen.getByText('Enabled')).toBeInTheDocument()
- expect(screen.getByText('Disabled')).toBeInTheDocument()
+ expect(screen.getAllByText('Enabled')).toHaveLength(2)
+ expect(screen.getAllByText('Disabled')).toHaveLength(2)
expect(
screen.getByText(/Signals from evals are only generated if eval reports are enabled/)
).toBeInTheDocument()
expect(screen.getByText('Reports generated')).toBeInTheDocument()
expect(screen.getByText('Last generated')).toBeInTheDocument()
expect(screen.getByText('4')).toBeInTheDocument()
- expect(screen.getAllByText('Never')).toHaveLength(1)
+ expect(screen.getAllByText('Never')).toHaveLength(2)
- const evalReportsDocsLink = screen.getByText('Learn more').closest('a')
+ const evalReportsDescription = screen.getByText(
+ /Signals from evals are only generated if eval reports are enabled/
+ )
+ const evalReportsDocsLink = within(evalReportsDescription).getByText('Learn more').closest('a')
expect(evalReportsDocsLink).toHaveAttribute(
'href',
'https://posthog.com/docs/ai-observability/self-driving#eval-reports'
@@ -175,17 +262,64 @@ describe('AIObservabilitySelfDriving', () => {
'href',
'/project/997/ai-evals/evaluations/evaluation-enabled?evaluation_tab=configuration'
)
+ expect(editLinks[0]).toHaveAttribute('target', '_blank')
expect(editLinks[1]).toHaveAttribute(
'href',
'/project/997/ai-evals/evaluations/evaluation-disabled?evaluation_tab=configuration'
)
+ expect(editLinks[1]).toHaveAttribute('target', '_blank')
+
+ expect(screen.getByText('Anomaly alert investigations')).toBeInTheDocument()
+ const anomalyInvestigationsDescription = screen.getByText(
+ /Insights with anomaly detection alerts that have agent investigation enabled/
+ )
+ const anomalyInvestigationsDocsLink = within(anomalyInvestigationsDescription).getByText('Learn more')
+ expect(anomalyInvestigationsDocsLink).toHaveAttribute(
+ 'href',
+ 'https://posthog.com/docs/ai-observability/self-driving#anomaly-investigations'
+ )
+ expect(anomalyInvestigationsDocsLink).toHaveAttribute('target', '_blank')
+ expect(alertsApi.alertsList).toHaveBeenCalledWith('997', {
+ has_detector: true,
+ insight_tag: 'ai-observability',
+ limit: 100,
+ offset: 0,
+ })
+ const anomalyTable = document.querySelector('[data-attr="anomaly-alert-investigations-table"]')
+ expect(anomalyTable).toBeInTheDocument()
+ const anomalyTableQueries = within(anomalyTable as HTMLElement)
+ expect(anomalyTableQueries.getByText('Unexpected AI cost')).toBeInTheDocument()
+ expect(anomalyTableQueries.getByText('Unexpected error rate')).toBeInTheDocument()
+ expect(anomalyTableQueries.getByText('AI cost by model').closest('a')).toHaveAttribute(
+ 'href',
+ '/project/997/insights/insight-cost'
+ )
+ expect(anomalyTableQueries.getByText('AI errors by model').closest('a')).toHaveAttribute(
+ 'href',
+ '/project/997/insights/insight-errors'
+ )
+ const anomalyEditLinks = anomalyTableQueries.getAllByText('Edit').map((button) => button.closest('a'))
+ expect(anomalyEditLinks[0]).toHaveAttribute(
+ 'href',
+ '/project/997/alerts?alert_type=insights&alert_id=alert-investigated'
+ )
+ expect(anomalyEditLinks[0]).toHaveAttribute('target', '_blank')
+ expect(anomalyEditLinks[1]).toHaveAttribute(
+ 'href',
+ '/project/997/alerts?alert_type=insights&alert_id=alert-uninvestigated'
+ )
+ expect(anomalyEditLinks[1]).toHaveAttribute('target', '_blank')
await userEvent.click(screen.getByText('Correctness check'))
- expect(router.values.location.pathname).toBe('/project/997/ai-evals/evaluations/evaluation-enabled')
- expect(router.values.searchParams).toEqual(expect.objectContaining({ evaluation_tab: 'configuration' }))
+ expect(newInternalTab).toHaveBeenLastCalledWith(
+ '/ai-evals/evaluations/evaluation-enabled?evaluation_tab=configuration'
+ )
+
+ await userEvent.click(anomalyTableQueries.getByText('Unexpected AI cost'))
+ expect(newInternalTab).toHaveBeenLastCalledWith('/alerts?alert_type=insights&alert_id=alert-investigated')
})
- it('sorts evals by report columns', async () => {
+ it('sorts eval and anomaly alert columns', async () => {
render(
<Provider>
<AIObservabilitySelfDriving />
@@ -208,6 +342,18 @@ describe('AIObservabilitySelfDriving', () => {
await userEvent.click(screen.getByText('Reports generated'))
expect(evalNames()).toEqual(['Correctness check', 'Tone check'])
+
+ const anomalyAlertNames = (): string[] =>
+ Array.from(
+ document.querySelectorAll(
+ '[data-attr="anomaly-alert-investigations-table"] tbody tr td:first-child span:first-child'
+ )
+ ).map((nameSpan) => nameSpan.textContent ?? '')
+
+ expect(anomalyAlertNames()).toEqual(['Unexpected AI cost', 'Unexpected error rate'])
+
+ await userEvent.click(screen.getByText('Last checked'))
+ expect(anomalyAlertNames()).toEqual(['Unexpected AI cost', 'Unexpected error rate'])
})
it('guides users without evals to templates or their agent', async () => {
@@ -231,6 +377,58 @@ describe('AIObservabilitySelfDriving', () => {
expect(document.querySelector('[data-attr="ai-observability-evaluations-table"]')).not.toBeInTheDocument()
})
+ it('links the empty anomaly state guidance', async () => {
+ jest.mocked(alertsApi.alertsList).mockResolvedValueOnce({
+ count: 0,
+ next: null,
+ previous: null,
+ results: [],
+ })
+
+ render(
+ <Provider>
+ <AIObservabilitySelfDriving />
+ </Provider>
+ )
+
+ const emptyStateCopy = await screen.findByText(/No anomaly alerts match this view/)
+ const insightLink = within(emptyStateCopy).getByText('insight').closest('a')
+ expect(insightLink).toHaveAttribute('href', '/project/997/insights')
+ expect(insightLink).toHaveAttribute('target', '_blank')
+ expect(screen.getByText('AI observability dashboard').closest('a')).toHaveAttribute(
+ 'href',
+ '/project/997/ai-observability/dashboard'
+ )
+ expect(screen.getByText('AI observability dashboard').closest('a')).toHaveAttribute('target', '_blank')
+ })
+
+ it('remembers which sections are collapsed', async () => {
+ const firstRender = render(
+ <Provider>
+ <AIObservabilitySelfDriving />
+ </Provider>
+ )
+
+ expect(await screen.findByText('Correctness check')).toBeInTheDocument()
+ const evalReportsToggle = document.querySelector('[data-attr="ai-observability-eval-reports-collapse"]')
+ expect(evalReportsToggle?.closest('.LemonCollapsePanel')).toHaveAttribute('aria-expanded', 'true')
+
+ await userEvent.click(evalReportsToggle as HTMLElement)
+ expect(evalReportsToggle?.closest('.LemonCollapsePanel')).toHaveAttribute('aria-expanded', 'false')
+
+ firstRender.unmount()
+ initKeaTests()
+
+ render(
+ <Provider>
+ <AIObservabilitySelfDriving />
+ </Provider>
+ )
+
+ const restoredEvalReportsToggle = document.querySelector('[data-attr="ai-observability-eval-reports-collapse"]')
+ expect(restoredEvalReportsToggle?.closest('.LemonCollapsePanel')).toHaveAttribute('aria-expanded', 'false')
+ })
+
it('shows a retry instead of the empty state when evals fail to load', async () => {
const consoleError = jest.spyOn(console, 'error').mockImplementation()
jest.mocked(aiObservabilityApi.evaluationsList).mockRejectedValueOnce(new Error('Request failed'))
diff --git a/products/ai_observability/frontend/selfDriving/AIObservabilitySelfDriving.tsx b/products/ai_observability/frontend/selfDriving/AIObservabilitySelfDriving.tsx
index d566a73f7d4e..ee2aacafa466 100644
--- a/products/ai_observability/frontend/selfDriving/AIObservabilitySelfDriving.tsx
+++ b/products/ai_observability/frontend/selfDriving/AIObservabilitySelfDriving.tsx
@@ -1,18 +1,33 @@
import { useActions, useValues } from 'kea'
-import { combineUrl, router } from 'kea-router'
+import { combineUrl } from 'kea-router'
+import type { ReactNode } from 'react'
import { IconCalendar, IconQuestion, IconUser, IconWarning } from '@posthog/icons'
-import { LemonBanner, LemonButton, LemonCard, LemonSkeleton, LemonTable, LemonTag, Tooltip } from '@posthog/lemon-ui'
+import {
+ LemonBanner,
+ LemonButton,
+ LemonCard,
+ LemonCollapse,
+ LemonSkeleton,
+ LemonTable,
+ LemonTag,
+ Tooltip,
+} from '@posthog/lemon-ui'
import { MCPUseCaseCard } from 'lib/components/MCPHint/MCPUseCaseCard'
import { TZLabel } from 'lib/components/TZLabel'
import { FEATURE_FLAGS } from 'lib/constants'
import { dayjs } from 'lib/dayjs'
+import type { LemonCollapsePanel } from 'lib/lemon-ui/LemonCollapse'
import { LemonTableColumns } from 'lib/lemon-ui/LemonTable'
import { Link } from 'lib/lemon-ui/Link'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
+import { newInternalTab } from 'lib/utils/newInternalTab'
import { urls } from 'scenes/urls'
+import type { InsightShortId } from '~/types'
+
+import type { AlertApi } from 'products/alerts/frontend/generated/api.schemas'
import { ScoutCreateButton } from 'products/signals/frontend/inbox/components/config/scouts/ScoutCreateButton'
import { ScoutRowCard } from 'products/signals/frontend/inbox/components/config/scouts/ScoutRowCard'
import { scoutFleetLogic } from 'products/signals/frontend/inbox/logics/scoutFleetLogic'
@@ -25,10 +40,17 @@ import {
AIObservabilityScoutTemplate,
isAIObservabilityScout,
} from './aiObservabilityScoutTemplates'
-import { aiObservabilitySelfDrivingLogic } from './aiObservabilitySelfDrivingLogic'
+import {
+ AI_OBSERVABILITY_SELF_DRIVING_SECTIONS,
+ type AIObservabilitySelfDrivingSection,
+ aiObservabilitySelfDrivingLogic,
+} from './aiObservabilitySelfDrivingLogic'
const SCOUTS_DOCS_URL = 'https://posthog.com/docs/ai-observability/self-driving'
+const SELF_DRIVING_DOCS_URL = 'https://posthog.com/docs/self-driving'
+const SIGNALS_DOCS_URL = `${SELF_DRIVING_DOCS_URL}/signals`
const EVAL_REPORTS_DOCS_URL = `${SCOUTS_DOCS_URL}#eval-reports`
+const ANOMALY_INVESTIGATIONS_DOCS_URL = `${SCOUTS_DOCS_URL}#anomaly-investigations`
function evaluationEditUrl(evaluationId: string): string {
return combineUrl(urls.aiObservabilityEvaluation(evaluationId), {
@@ -36,6 +58,98 @@ function evaluationEditUrl(evaluationId: string): string {
}).url
}
+function sectionPanel({
+ key,
+ dataAttr,
+ title,
+ count,
+ content,
+}: {
+ key: AIObservabilitySelfDrivingSection
+ dataAttr: string
+ title: string
+ count: number | null
+ content: ReactNode
+}): LemonCollapsePanel<AIObservabilitySelfDrivingSection> {
+ return {
+ key,
+ dataAttr,
+ bodyClassName: '!border-t-0',
+ header: {
+ className: '!bg-transparent hover:!bg-surface-secondary',
+ children: (
+ <div className="flex w-full items-center gap-2">
+ <span className="text-base font-semibold">{title}</span>
+ {count !== null ? (
+ <LemonTag type="muted" size="small">
+ {count}
+ </LemonTag>
+ ) : null}
+ </div>
+ ),
+ },
+ content,
+ }
+}
+
+const anomalyAlertColumns: LemonTableColumns<AlertApi> = [
+ {
+ title: 'Alert',
+ key: 'name',
+ width: '30%',
+ render: (_, alert) => <span className="font-semibold">{alert.name || 'Untitled alert'}</span>,
+ sorter: (left, right) => (left.name || '').localeCompare(right.name || ''),
+ },
+ {
+ title: 'Insight',
+ key: 'insight',
+ width: '30%',
+ render: (_, alert) => (
+ <Link to={urls.insightView(alert.insight_short_id as InsightShortId)}>{alert.insight_display_name}</Link>
+ ),
+ sorter: (left, right) => left.insight_display_name.localeCompare(right.insight_display_name),
+ },
+ {
+ title: 'Agent investigation',
+ key: 'agent-investigation',
+ render: (_, alert) =>
+ alert.investigation_agent_enabled ? (
+ <LemonTag type="success">Enabled</LemonTag>
+ ) : (
+ <LemonTag type="muted">Disabled</LemonTag>
+ ),
+ sorter: (left, right) =>
+ Number(Boolean(left.investigation_agent_enabled)) - Number(Boolean(right.investigation_agent_enabled)),
+ },
+ {
+ title: 'Last checked',
+ key: 'last-checked',
+ render: (_, alert) => (alert.last_checked_at ? <TZLabel time={alert.last_checked_at} /> : 'Never'),
+ sorter: (left, right) => {
+ const leftTime = left.last_checked_at ? dayjs(left.last_checked_at).valueOf() : Infinity
+ const rightTime = right.last_checked_at ? dayjs(right.last_checked_at).valueOf() : Infinity
+ return leftTime - rightTime
+ },
+ },
+ {
+ key: 'actions',
+ width: 72,
+ align: 'right',
+ render: (_, alert) => (
+ <LemonButton
+ type="secondary"
+ size="small"
+ to={urls.alert(alert.id)}
+ targetBlank
+ hideExternalLinkIcon
+ data-attr="edit-anomaly-alert"
+ >
+ Edit
+ </LemonButton>
+ ),
+ },
+]
+
const TEMPLATE_ICONS: Record<AIObservabilityScoutTemplate['key'], JSX.Element> = {
'daily-digest': <IconCalendar />,
'costly-users': <IconUser />,
@@ -76,8 +190,16 @@ export function AIObservabilitySelfDriving(): JSX.Element {
const { deleteScout, loadScoutConfigs, updateScoutConfig } = useActions(scoutFleetLogic)
const { evaluations, evaluationsLoadFailed, evaluationsLoading } = useValues(llmEvaluationsLogic)
const { loadEvaluations } = useActions(llmEvaluationsLogic)
- const { evaluationReportsByEvaluationId, evaluationReportsLoading } = useValues(aiObservabilitySelfDrivingLogic)
- const { loadSelfDrivingEvaluationReports } = useActions(aiObservabilitySelfDrivingLogic)
+ const {
+ anomalyAlertInvestigations,
+ anomalyAlertInvestigationsLoading,
+ evaluationReportsByEvaluationId,
+ evaluationReportsLoading,
+ expandedSections,
+ } = useValues(aiObservabilitySelfDrivingLogic)
+ const { loadAnomalyAlertInvestigations, loadSelfDrivingEvaluationReports, setExpandedSections } = useActions(
+ aiObservabilitySelfDrivingLogic
+ )
const aiObservabilityScouts = scoutConfigs?.filter(isAIObservabilityScout) ?? []
const reportFor = (evaluation: EvaluationConfig): EvaluationReportApi | null =>
@@ -148,6 +270,8 @@ export function AIObservabilitySelfDriving(): JSX.Element {
type="secondary"
size="small"
to={evaluationEditUrl(evaluation.id)}
+ targetBlank
+ hideExternalLinkIcon
data-attr="edit-ai-observability-evaluation"
>
Edit
@@ -199,134 +323,251 @@ export function AIObservabilitySelfDriving(): JSX.Element {
}
return (
- <div className="flex flex-col gap-6">
- <section className="flex flex-col gap-2">
- <div>
- <div className="flex items-center gap-2">
- <h2 className="m-0 text-base font-semibold">Start with a template</h2>
- <Tooltip
- title="Each template is a pre-defined scout – a scheduled agent that explores your AI observability data and surfaces findings worth reviewing. Actionable scout reports land in your inbox."
- docLink={SCOUTS_DOCS_URL}
- >
- <span
- className="inline-flex items-center gap-1 text-xs text-muted hover:text-default cursor-pointer transition-colors"
- data-attr="ai-observability-scout-templates-what-is-this"
- >
- <IconQuestion className="text-sm" />
- What is this?
- </span>
- </Tooltip>
- </div>
- <p className="m-0 text-sm text-muted">
- Choose a starting point, then review and edit it before saving.
- </p>
- </div>
- <div className="grid gap-2 md:grid-cols-2 xl:grid-cols-3">
- {AI_OBSERVABILITY_SCOUT_TEMPLATES.map((template) => (
- <ScoutTemplateCard key={template.key} template={template} />
- ))}
- </div>
- </section>
-
- <section className="flex flex-col gap-2">
- <div>
- <div className="flex items-center gap-2">
- <h2 className="m-0 text-base font-semibold">Your AI observability scouts</h2>
- {scoutConfigs !== null ? (
- <LemonTag type="muted" size="small">
- {aiObservabilityScouts.length}
- </LemonTag>
- ) : null}
- </div>
- <p className="m-0 text-sm text-muted">
- Add the <code>ai-observability</code> label to a scout for it to appear here.
- </p>
- </div>
- {scoutsContent}
- </section>
+ <div className="flex flex-col gap-4">
+ <LemonBanner type="info" className="text-sm">
+ <p className="m-0">
+ To power{' '}
+ <Link to={SELF_DRIVING_DOCS_URL} target="_blank" targetBlankIcon>
+ Self-driving
+ </Link>
+ , AI Observability turns your LLM data into{' '}
+ <Link to={SIGNALS_DOCS_URL} target="_blank" targetBlankIcon>
+ signals
+ </Link>
+ : agents investigate what changed, and reports land in your{' '}
+ <Link to={urls.inbox()} target="_blank" targetBlankIcon>
+ inbox
+ </Link>
+ , where one click turns a finding into a pull request.{' '}
+ <Link to={SCOUTS_DOCS_URL} target="_blank" targetBlankIcon>
+ Learn more
+ </Link>
+ </p>
+ </LemonBanner>
+ <LemonCollapse
+ embedded
+ multiple
+ activeKeys={expandedSections}
+ onChange={setExpandedSections}
+ panels={[
+ sectionPanel({
+ key: AI_OBSERVABILITY_SELF_DRIVING_SECTIONS.SCOUTS,
+ dataAttr: 'ai-observability-scouts-collapse',
+ title: 'Scouts',
+ count: scoutConfigs !== null ? aiObservabilityScouts.length : null,
+ content: (
+ <div className="flex flex-col gap-6">
+ <section className="flex flex-col gap-2">
+ <div>
+ <div className="flex items-center gap-2">
+ <h2 className="m-0 text-base font-semibold">Start with a template</h2>
+ <Tooltip
+ title="Each template is a pre-defined scout: a scheduled agent that explores your AI observability data and surfaces findings worth reviewing. Actionable scout reports land in your inbox."
+ docLink={SCOUTS_DOCS_URL}
+ >
+ <span
+ className="inline-flex items-center gap-1 text-xs text-muted hover:text-default cursor-pointer transition-colors"
+ data-attr="ai-observability-scout-templates-what-is-this"
+ >
+ <IconQuestion className="text-sm" />
+ What is this?
+ </span>
+ </Tooltip>
+ </div>
+ <p className="m-0 text-sm text-muted">
+ Choose a starting point, then review and edit it before saving.
+ </p>
+ </div>
+ <div className="grid gap-2 md:grid-cols-2 xl:grid-cols-3">
+ {AI_OBSERVABILITY_SCOUT_TEMPLATES.map((template) => (
+ <ScoutTemplateCard key={template.key} template={template} />
+ ))}
+ </div>
+ </section>
- <section className="flex flex-col gap-2">
- <div>
- <div className="flex items-center gap-2">
- <h2 className="m-0 text-base font-semibold">Your evals</h2>
- {!evaluationsLoading && !evaluationsLoadFailed ? (
- <LemonTag type="muted" size="small">
- {evaluations.length}
- </LemonTag>
- ) : null}
- </div>
- <p className="m-0 text-sm text-muted">
- Signals from evals are only generated if eval reports are enabled.{' '}
- <Link to={EVAL_REPORTS_DOCS_URL} target="_blank" targetBlankIcon>
- Learn more
- </Link>
- </p>
- </div>
- {!evaluationsLoadFailed &&
- !evaluationsLoading &&
- evaluations.length > 0 &&
- evaluationReportsByEvaluationId === null &&
- !evaluationReportsLoading ? (
- <LemonBanner
- type="error"
- action={{ children: 'Try again', onClick: () => loadSelfDrivingEvaluationReports() }}
- data-attr="ai-observability-evaluation-reports-load-error"
- >
- We couldn't load evaluation report statuses. Try again in a moment.
- </LemonBanner>
- ) : null}
- {evaluationsLoadFailed ? (
- <LemonBanner
- type="error"
- action={{ children: 'Try again', onClick: loadEvaluations }}
- data-attr="ai-observability-evaluations-load-error"
- >
- We couldn't load your evals. Try again in a moment.
- </LemonBanner>
- ) : evaluationsLoading ? (
- <div className="flex flex-col gap-2">
- <LemonSkeleton className="h-10 w-full rounded" />
- <LemonSkeleton className="h-10 w-full rounded" />
- </div>
- ) : evaluations.length === 0 ? (
- <LemonCard hoverEffect={false} className="flex w-full flex-col items-start gap-3 p-4">
- <h3 className="m-0 text-sm font-semibold">You don't have any evals yet</h3>
- <LemonButton
- type="primary"
- to={urls.aiObservabilityEvaluations()}
- data-attr="create-ai-observability-eval"
- >
- Create an eval
- </LemonButton>
- {featureFlags[FEATURE_FLAGS.LLM_ANALYTICS_EVALUATIONS_START_WITH_AI] ? (
- <MCPUseCaseCard
- surfaceKey="ai_observability_evaluations.create"
- className="!mt-1 w-full max-w-2xl"
- />
- ) : null}
- </LemonCard>
- ) : (
- <LemonTable
- columns={evaluationColumns}
- dataSource={evaluations}
- loading={evaluationReportsLoading}
- loadingSkeletonRows={2}
- tableLayout="fixed"
- rowKey="id"
- nouns={['eval', 'evals']}
- data-attr="ai-observability-evaluations-table"
- onRow={(evaluation) => ({
- className: 'cursor-pointer hover:bg-surface-secondary',
- onClick: (event) => {
- if ((event.target as HTMLElement).closest('button, a, [role="button"]')) {
- return
- }
- router.actions.push(evaluationEditUrl(evaluation.id))
- },
- })}
- />
- )}
- </section>
+ <section className="flex flex-col gap-2">
+ <div>
+ <h2 className="m-0 text-base font-semibold">Your AI observability scouts</h2>
+ <p className="m-0 text-sm text-muted">
+ Add the <code>ai-observability</code> label to a scout for it to appear
+ here.
+ </p>
+ </div>
+ {scoutsContent}
+ </section>
+ </div>
+ ),
+ }),
+ sectionPanel({
+ key: AI_OBSERVABILITY_SELF_DRIVING_SECTIONS.EVAL_REPORTS,
+ dataAttr: 'ai-observability-eval-reports-collapse',
+ title: 'Eval reports',
+ count: !evaluationsLoading && !evaluationsLoadFailed ? evaluations.length : null,
+ content: (
+ <div className="flex flex-col gap-2">
+ <p className="m-0 text-sm text-muted">
+ Signals from evals are only generated if eval reports are enabled.{' '}
+ <Link to={EVAL_REPORTS_DOCS_URL} target="_blank" targetBlankIcon>
+ Learn more
+ </Link>
+ </p>
+ {!evaluationsLoadFailed &&
+ !evaluationsLoading &&
+ evaluations.length > 0 &&
+ evaluationReportsByEvaluationId === null &&
+ !evaluationReportsLoading ? (
+ <LemonBanner
+ type="error"
+ action={{
+ children: 'Try again',
+ onClick: () => loadSelfDrivingEvaluationReports(),
+ }}
+ data-attr="ai-observability-evaluation-reports-load-error"
+ >
+ We couldn't load evaluation report statuses. Try again in a moment.
+ </LemonBanner>
+ ) : null}
+ {evaluationsLoadFailed ? (
+ <LemonBanner
+ type="error"
+ action={{ children: 'Try again', onClick: loadEvaluations }}
+ data-attr="ai-observability-evaluations-load-error"
+ >
+ We couldn't load your evals. Try again in a moment.
+ </LemonBanner>
+ ) : evaluationsLoading ? (
+ <div className="flex flex-col gap-2">
+ <LemonSkeleton className="h-10 w-full rounded" />
+ <LemonSkeleton className="h-10 w-full rounded" />
+ </div>
+ ) : evaluations.length === 0 ? (
+ <LemonCard
+ hoverEffect={false}
+ className="flex w-full flex-col items-start gap-3 p-4"
+ >
+ <h3 className="m-0 text-sm font-semibold">You don't have any evals yet</h3>
+ <LemonButton
+ type="primary"
+ to={urls.aiObservabilityEvaluations()}
+ data-attr="create-ai-observability-eval"
+ >
+ Create an eval
+ </LemonButton>
+ {featureFlags[FEATURE_FLAGS.LLM_ANALYTICS_EVALUATIONS_START_WITH_AI] ? (
+ <MCPUseCaseCard
+ surfaceKey="ai_observability_evaluations.create"
+ className="!mt-1 w-full max-w-2xl"
+ />
+ ) : null}
+ </LemonCard>
+ ) : (
+ <LemonTable
+ columns={evaluationColumns}
+ dataSource={evaluations}
+ loading={evaluationReportsLoading}
+ loadingSkeletonRows={2}
+ tableLayout="fixed"
+ rowKey="id"
+ nouns={['eval', 'evals']}
+ data-attr="ai-observability-evaluations-table"
+ onRow={(evaluation) => ({
+ className: 'cursor-pointer hover:bg-surface-secondary',
+ onClick: (event) => {
+ if (
+ (event.target as HTMLElement).closest('button, a, [role="button"]')
+ ) {
+ return
+ }
+ newInternalTab(evaluationEditUrl(evaluation.id))
+ },
+ })}
+ />
+ )}
+ </div>
+ ),
+ }),
+ sectionPanel({
+ key: AI_OBSERVABILITY_SELF_DRIVING_SECTIONS.ANOMALY_ALERT_INVESTIGATIONS,
+ dataAttr: 'ai-observability-anomaly-investigations-collapse',
+ title: 'Anomaly alert investigations',
+ count: anomalyAlertInvestigations !== null ? anomalyAlertInvestigations.length : null,
+ content: (
+ <div className="flex flex-col gap-2">
+ <p className="m-0 text-sm text-muted">
+ Insights with anomaly detection alerts that have agent investigation enabled can
+ emit signals. Add the <code>ai-observability</code> tag to an{' '}
+ <Link to={urls.savedInsights()} target="_blank" targetBlankIcon>
+ insight
+ </Link>{' '}
+ to show its anomaly alerts here.{' '}
+ <Link to={ANOMALY_INVESTIGATIONS_DOCS_URL} target="_blank" targetBlankIcon>
+ Learn more
+ </Link>
+ </p>
+ {anomalyAlertInvestigationsLoading && anomalyAlertInvestigations === null ? (
+ <div className="flex flex-col gap-2">
+ <LemonSkeleton className="h-10 w-full rounded" />
+ <LemonSkeleton className="h-10 w-full rounded" />
+ </div>
+ ) : anomalyAlertInvestigations === null ? (
+ <LemonBanner
+ type="error"
+ action={{
+ children: 'Try again',
+ onClick: () => loadAnomalyAlertInvestigations(),
+ }}
+ data-attr="anomaly-alert-investigations-load-error"
+ >
+ We couldn't load anomaly alert investigations. Try again in a moment.
+ </LemonBanner>
+ ) : anomalyAlertInvestigations.length === 0 ? (
+ <LemonCard
+ hoverEffect={false}
+ className="flex flex-col gap-1 p-4 text-sm text-muted"
+ >
+ <p className="m-0">
+ No anomaly alerts match this view. Add the <code>ai-observability</code> tag
+ to an{' '}
+ <Link to={urls.savedInsights()} target="_blank" targetBlankIcon>
+ insight
+ </Link>{' '}
+ with an anomaly alert for it to appear here.
+ </p>
+ <p className="m-0">
+ A good place to start is your{' '}
+ <Link to={urls.aiObservabilityDashboard()} target="_blank" targetBlankIcon>
+ AI observability dashboard
+ </Link>
+ .
+ </p>
+ </LemonCard>
+ ) : (
+ <LemonTable
+ columns={anomalyAlertColumns}
+ dataSource={anomalyAlertInvestigations}
+ tableLayout="fixed"
+ rowKey="id"
+ rowClassName="[&>td]:py-2 [&>td_.LemonButton]:my-0"
+ nouns={['anomaly alert', 'anomaly alerts']}
+ data-attr="anomaly-alert-investigations-table"
+ onRow={(alert) => ({
+ className: 'cursor-pointer hover:bg-surface-secondary',
+ onClick: (event) => {
+ if (
+ (event.target as HTMLElement).closest('button, a, [role="button"]')
+ ) {
+ return
+ }
+ newInternalTab(urls.alert(alert.id))
+ },
+ })}
+ />
+ )}
+ </div>
+ ),
+ }),
+ ]}
+ />
</div>
)
}
diff --git a/products/ai_observability/frontend/selfDriving/aiObservabilitySelfDrivingLogic.ts b/products/ai_observability/frontend/selfDriving/aiObservabilitySelfDrivingLogic.ts
index 71a888a61fc6..c9dccff1e638 100644
--- a/products/ai_observability/frontend/selfDriving/aiObservabilitySelfDrivingLogic.ts
+++ b/products/ai_observability/frontend/selfDriving/aiObservabilitySelfDrivingLogic.ts
@@ -1,20 +1,71 @@
-import { MakeLogicType, afterMount, kea, path, selectors } from 'kea'
+import { MakeLogicType, actions, afterMount, kea, path, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import { teamLogic } from 'scenes/teamLogic'
+import * as alertsApi from 'products/alerts/frontend/generated/api'
+import type { AlertApi } from 'products/alerts/frontend/generated/api.schemas'
+
import { listAllEvaluationReports } from '../evaluations/evaluationsApi'
import type { EvaluationReportApi } from '../generated/api.schemas'
+import { listAllPages } from '../listAllPages'
+import { AI_OBSERVABILITY_SCOUT_TAG } from './aiObservabilityScoutTemplates'
+
+const ANOMALY_ALERTS_PAGE_SIZE = 100
+
+export const AI_OBSERVABILITY_SELF_DRIVING_SECTIONS = {
+ SCOUTS: 'scouts',
+ EVAL_REPORTS: 'eval-reports',
+ ANOMALY_ALERT_INVESTIGATIONS: 'anomaly-alert-investigations',
+} as const
+
+export type AIObservabilitySelfDrivingSection =
+ (typeof AI_OBSERVABILITY_SELF_DRIVING_SECTIONS)[keyof typeof AI_OBSERVABILITY_SELF_DRIVING_SECTIONS]
+
+const DEFAULT_EXPANDED_SECTIONS: AIObservabilitySelfDrivingSection[] = [
+ AI_OBSERVABILITY_SELF_DRIVING_SECTIONS.SCOUTS,
+ AI_OBSERVABILITY_SELF_DRIVING_SECTIONS.EVAL_REPORTS,
+ AI_OBSERVABILITY_SELF_DRIVING_SECTIONS.ANOMALY_ALERT_INVESTIGATIONS,
+]
+
+async function listAllAnomalyAlertInvestigations(projectId: string): Promise<AlertApi[]> {
+ return listAllPages((offset) =>
+ alertsApi.alertsList(projectId, {
+ has_detector: true,
+ insight_tag: AI_OBSERVABILITY_SCOUT_TAG,
+ limit: ANOMALY_ALERTS_PAGE_SIZE,
+ offset,
+ })
+ )
+}
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface aiObservabilitySelfDrivingLogicValues {
+ anomalyAlertInvestigations: AlertApi[] | null
+ anomalyAlertInvestigationsLoading: boolean
evaluationReports: EvaluationReportApi[] | null
evaluationReportsByEvaluationId: Record<string, EvaluationReportApi> | null
evaluationReportsLoading: boolean
+ expandedSections: AIObservabilitySelfDrivingSection[]
}
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface aiObservabilitySelfDrivingLogicActions {
+ loadAnomalyAlertInvestigations: () => any
+ loadAnomalyAlertInvestigationsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadAnomalyAlertInvestigationsSuccess: (
+ anomalyAlertInvestigations: AlertApi[],
+ payload?: any
+ ) => {
+ anomalyAlertInvestigations: AlertApi[]
+ payload?: any
+ }
loadSelfDrivingEvaluationReports: () => any
loadSelfDrivingEvaluationReportsFailure: (
error: string,
@@ -30,6 +81,9 @@ export interface aiObservabilitySelfDrivingLogicActions {
evaluationReports: EvaluationReportApi[]
payload?: any
}
+ setExpandedSections: (expandedSections: AIObservabilitySelfDrivingSection[]) => {
+ expandedSections: AIObservabilitySelfDrivingSection[]
+ }
}
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
@@ -51,7 +105,20 @@ export type aiObservabilitySelfDrivingLogicType = MakeLogicType<
export const aiObservabilitySelfDrivingLogic = kea<aiObservabilitySelfDrivingLogicType>([
path(['products', 'ai_observability', 'selfDriving', 'aiObservabilitySelfDrivingLogic']),
+ actions({
+ setExpandedSections: (expandedSections: AIObservabilitySelfDrivingSection[]) => ({ expandedSections }),
+ }),
+
loaders({
+ anomalyAlertInvestigations: [
+ null as AlertApi[] | null,
+ {
+ loadAnomalyAlertInvestigations: async () => {
+ const teamId = teamLogic.values.currentTeamId
+ return teamId ? await listAllAnomalyAlertInvestigations(teamId.toString()) : []
+ },
+ },
+ ],
evaluationReports: [
null as EvaluationReportApi[] | null,
{
@@ -63,6 +130,16 @@ export const aiObservabilitySelfDrivingLogic = kea<aiObservabilitySelfDrivingLog
],
}),
+ reducers({
+ expandedSections: [
+ DEFAULT_EXPANDED_SECTIONS,
+ { persist: true },
+ {
+ setExpandedSections: (_, { expandedSections }) => expandedSections,
+ },
+ ],
+ }),
+
selectors({
evaluationReportsByEvaluationId: [
(selectors) => [selectors.evaluationReports],
@@ -76,6 +153,7 @@ export const aiObservabilitySelfDrivingLogic = kea<aiObservabilitySelfDrivingLog
}),
afterMount(({ actions }) => {
+ actions.loadAnomalyAlertInvestigations()
actions.loadSelfDrivingEvaluationReports()
}),
])
diff --git a/products/alerts/backend/api/alert.py b/products/alerts/backend/api/alert.py
index 80af275b41d0..45939247e0d4 100644
--- a/products/alerts/backend/api/alert.py
+++ b/products/alerts/backend/api/alert.py
@@ -3,7 +3,7 @@ from typing import Annotated, Any, cast
from zoneinfo import ZoneInfo
from django.db import transaction
-from django.db.models import OuterRef, Q, QuerySet, Subquery
+from django.db.models import OuterRef, Prefetch, Q, QuerySet, Subquery
import posthoganalytics
from drf_spectacular.utils import OpenApiParameter, OpenApiTypes, extend_schema, extend_schema_view
@@ -29,6 +29,7 @@ from posthog.schema import (
)
from posthog.api.documentation import extend_schema_field
+from posthog.api.fields import OptionalBooleanField
from posthog.api.routing import TeamAndOrgViewSetMixin
from posthog.api.scoped_related_fields import TeamScopedPrimaryKeyRelatedField
from posthog.api.shared import SearchMatchTypeSerializerMixin, UserBasicSerializer
@@ -41,6 +42,8 @@ from posthog.helpers.trigram_search import (
drop_similar_when_exact_exists,
)
from posthog.models import User
+from posthog.models.tag import tagify
+from posthog.models.tagged_item import TaggedItem
from posthog.permissions import get_authenticator_scopes
from posthog.rate_limit import AlertTestDeliveryThrottle
from posthog.resource_limits import LimitKey, check_count_limit
@@ -322,6 +325,15 @@ class AlertSerializer(SearchMatchTypeSerializerMixin, serializers.ModelSerialize
queryset=Insight.objects.all(),
help_text="Insight ID monitored by this alert. Note: Response returns full InsightBasicSerializer object.",
)
+ insight_short_id = serializers.CharField(
+ source="insight.short_id",
+ read_only=True,
+ help_text="Short ID of the insight monitored by this alert.",
+ )
+ insight_display_name = serializers.SerializerMethodField(
+ read_only=True,
+ help_text="Display name of the insight monitored by this alert.",
+ )
name = serializers.CharField(
required=False,
allow_blank=True,
@@ -387,6 +399,9 @@ class AlertSerializer(SearchMatchTypeSerializerMixin, serializers.ModelSerialize
def get_checks_total(self, obj: AlertConfiguration) -> int | None:
return getattr(obj, "checks_total", None)
+ def get_insight_display_name(self, obj: AlertConfiguration) -> str:
+ return obj.insight.name or obj.insight.derived_name or "Untitled insight"
+
class Meta:
model = AlertConfiguration
fields = [
@@ -394,6 +409,8 @@ class AlertSerializer(SearchMatchTypeSerializerMixin, serializers.ModelSerialize
"created_by",
"created_at",
"insight",
+ "insight_short_id",
+ "insight_display_name",
"name",
"subscribed_users",
"threshold",
@@ -912,6 +929,11 @@ class AlertTestDeliveryResponseSerializer(serializers.Serializer):
)
+class AlertListFiltersSerializer(serializers.Serializer):
+ insight_tag = serializers.CharField(required=False, max_length=255)
+ has_detector = OptionalBooleanField(required=False)
+
+
@extend_schema_view(
list=extend_schema(
parameters=[
@@ -937,6 +959,18 @@ class AlertTestDeliveryResponseSerializer(serializers.Serializer):
location=OpenApiParameter.QUERY,
description="Optional. Restrict results to alerts on this insight ID.",
),
+ OpenApiParameter(
+ "insight_tag",
+ OpenApiTypes.STR,
+ location=OpenApiParameter.QUERY,
+ description="Optional. Restrict results to alerts whose insight has this tag.",
+ ),
+ OpenApiParameter(
+ "has_detector",
+ OpenApiTypes.BOOL,
+ location=OpenApiParameter.QUERY,
+ description="Optional. Restrict results by whether the alert uses anomaly detection.",
+ ),
],
),
)
@@ -944,13 +978,23 @@ class AlertViewSet(TeamAndOrgViewSetMixin, viewsets.ModelViewSet):
scope_object = "alert"
queryset = (
AlertConfiguration.objects.select_related("team", "insight", "threshold", "created_by")
- .prefetch_related("subscribed_users")
+ .prefetch_related(
+ "subscribed_users",
+ Prefetch(
+ "insight__tagged_items",
+ queryset=TaggedItem.objects.select_related("tag"),
+ to_attr="prefetched_tags",
+ ),
+ )
.order_by("-created_at")
)
serializer_class = AlertSerializer
def safely_get_queryset(self, queryset) -> QuerySet:
filters = self.request.query_params
+ list_filters = AlertListFiltersSerializer(data=filters)
+ list_filters.is_valid(raise_exception=True)
+
if "insight" in filters:
queryset = queryset.filter(insight_id=filters["insight"])
@@ -958,6 +1002,17 @@ class AlertViewSet(TeamAndOrgViewSetMixin, viewsets.ModelViewSet):
if insight_id is not None:
queryset = queryset.filter(insight_id=insight_id)
+ insight_tag = list_filters.validated_data.get("insight_tag")
+ if insight_tag:
+ queryset = queryset.filter(
+ insight__tagged_items__tag__name=tagify(insight_tag),
+ insight__tagged_items__tag__team_id=self.team_id,
+ )
+
+ has_detector = list_filters.validated_data.get("has_detector")
+ if has_detector is not None:
+ queryset = queryset.filter(detector_config__isnull=not has_detector)
+
created_by = filters.get("created_by")
if created_by:
try:
diff --git a/products/alerts/backend/api/test/test_alert.py b/products/alerts/backend/api/test/test_alert.py
index 08c02396ebd3..a6d574338699 100644
--- a/products/alerts/backend/api/test/test_alert.py
+++ b/products/alerts/backend/api/test/test_alert.py
@@ -13,6 +13,7 @@ from rest_framework import status
from posthog.schema import AlertCalculationInterval, AlertConditionType, AlertState, InsightThresholdType
+from posthog.api.tagged_item import set_tags_on_object
from posthog.constants import AvailableFeature
from posthog.models import User
from posthog.models.personal_api_key import PersonalAPIKey
@@ -21,6 +22,7 @@ from posthog.models.utils import generate_random_token_personal, hash_key_value
from products.alerts.backend.models.alert import AlertCheck, AlertConfiguration, AlertSubscription, Threshold
from products.cdp.backend.models.hog_functions.hog_function import HogFunction
+from products.product_analytics.backend.models.insight import Insight
class TestAlert(APIBaseTest, QueryMatchingTest):
@@ -62,6 +64,8 @@ class TestAlert(APIBaseTest, QueryMatchingTest):
"enabled": True,
"id": mock.ANY,
"insight": mock.ANY,
+ "insight_display_name": mock.ANY,
+ "insight_short_id": mock.ANY,
"last_notified_at": None,
"name": "alert name",
"subscribed_users": mock.ANY,
@@ -1786,14 +1790,58 @@ class TestAlertListFilters(APIBaseTest):
}
self.insight = self.client.post(f"/api/projects/{self.team.id}/insights", data=self.default_insight_data).json()
- def _create_alert(self, name: str, user=None) -> AlertConfiguration:
+ def _create_alert(
+ self,
+ name: str,
+ user: User | None = None,
+ *,
+ insight_id: int | None = None,
+ detector_config: dict[str, Any] | None = None,
+ ) -> AlertConfiguration:
return AlertConfiguration.objects.create(
team=self.team,
- insight_id=self.insight["id"],
+ insight_id=insight_id if insight_id is not None else self.insight["id"],
name=name,
created_by=user or self.user,
+ detector_config=detector_config,
+ )
+
+ def test_list_filter_by_insight_tag_and_detector_type(self) -> None:
+ tagged_insight = Insight.objects.get(id=self.insight["id"])
+ set_tags_on_object(["ai-observability"], tagged_insight)
+ untagged_insight = self.client.post(
+ f"/api/projects/{self.team.id}/insights", data=self.default_insight_data
+ ).json()
+
+ matching_alert = self._create_alert(
+ "Tagged anomaly alert",
+ detector_config={"type": "zscore", "threshold": 0.9, "window": 30},
+ )
+ threshold_alert = self._create_alert("Tagged threshold alert")
+ untagged_alert = self._create_alert(
+ "Untagged anomaly alert",
+ insight_id=untagged_insight["id"],
+ detector_config={"type": "zscore", "threshold": 0.9, "window": 30},
)
+ unfiltered_response = self.client.get(f"/api/projects/{self.team.id}/alerts")
+ assert {alert["id"] for alert in unfiltered_response.json()["results"]} == {
+ str(matching_alert.id),
+ str(threshold_alert.id),
+ str(untagged_alert.id),
+ }
+
+ response = self.client.get(
+ f"/api/projects/{self.team.id}/alerts",
+ {"insight_tag": "AI-Observability", "has_detector": "true"},
+ )
+
+ assert response.status_code == status.HTTP_200_OK
+ results = response.json()["results"]
+ assert [alert["id"] for alert in results] == [str(matching_alert.id)]
+ assert results[0]["insight_short_id"] == tagged_insight.short_id
+ assert results[0]["insight_display_name"] == "Untitled insight"
+
def test_list_filter_by_search(self) -> None:
self._create_alert("Revenue spike")
self._create_alert("Unrelated alert")
@@ -1880,6 +1928,7 @@ class TestAlertListFilters(APIBaseTest):
[
("search_length_cap", {"search": "a" * 201}, "search"),
("invalid_created_by_uuid", {"created_by": "not-a-uuid"}, "created_by"),
+ ("invalid_has_detector", {"has_detector": "sometimes"}, "has_detector"),
]
)
def test_list_filter_validation_errors(self, _name: str, query_params: dict[str, str], expected_attr: str) -> None:
diff --git a/products/alerts/frontend/generated/api.schemas.ts b/products/alerts/frontend/generated/api.schemas.ts
index 883ebafd7583..1f118251f851 100644
--- a/products/alerts/frontend/generated/api.schemas.ts
+++ b/products/alerts/frontend/generated/api.schemas.ts
@@ -596,6 +596,10 @@ export interface AlertApi {
readonly created_at: string
/** Insight ID monitored by this alert. Note: Response returns full InsightBasicSerializer object. */
insight: number
+ /** Short ID of the insight monitored by this alert. */
+ readonly insight_short_id: string
+ /** Display name of the insight monitored by this alert. */
+ readonly insight_display_name: string
/**
* Human-readable name for the alert.
* @maxLength 255
@@ -681,6 +685,10 @@ export interface PatchedAlertApi {
readonly created_at?: string
/** Insight ID monitored by this alert. Note: Response returns full InsightBasicSerializer object. */
insight?: number
+ /** Short ID of the insight monitored by this alert. */
+ readonly insight_short_id?: string
+ /** Display name of the insight monitored by this alert. */
+ readonly insight_display_name?: string
/**
* Human-readable name for the alert.
* @maxLength 255
@@ -866,10 +874,18 @@ export type AlertsListParams = {
* Optional. Restrict results to alerts created by the user with this UUID.
*/
created_by?: string
+ /**
+ * Optional. Restrict results by whether the alert uses anomaly detection.
+ */
+ has_detector?: boolean
/**
* Optional. Restrict results to alerts on this insight ID.
*/
insight_id?: number
+ /**
+ * Optional. Restrict results to alerts whose insight has this tag.
+ */
+ insight_tag?: string
/**
* Number of results to return per page.
*/
diff --git a/products/signals/ARCHITECTURE.md b/products/signals/ARCHITECTURE.md
index d08b806803b4..0850215a1e6b 100644
--- a/products/signals/ARCHITECTURE.md
+++ b/products/signals/ARCHITECTURE.md
@@ -22,7 +22,7 @@ If you add or remove a Signals workflow/activity from `backend/temporal/__init__
Several additional Signals workflows also exist but are not part of the main report pipeline:
- `backfill-error-tracking` (`backend/temporal/backfill_error_tracking.py`) — backfills recent error tracking issues as signals
-- `emit-eval-signal` (`backend/temporal/emit_eval_signal.py`) — converts LLMA evaluation results into Signals inputs on the Signals worker queue
+- `emit-eval-signal` (`backend/temporal/emit_eval_signal.py`) — legacy per-result evaluation path retained for existing Temporal histories and stored configs
- `run-signals-scout-coordinator` (`backend/temporal/agentic/scout_coordinator.py`) — periodic tick (every `COORDINATOR_INTERVAL_MINUTES = 30`) that fans out scheduled `signals-scout-*` scout runs per (team, skill). Spec'd separately below.
- `RunSignalsScoutWorkflow` (`backend/temporal/agentic/scout_scheduler.py`) — child workflow per planned run; thin wrapper around the harness activity. Spec'd separately below.
@@ -530,7 +530,7 @@ Per-team configuration for which signal sources are enabled.
**Behavioral notes:**
-- `llm_analytics` signals go through the standard enabled-row check like every other source. Per-result `evaluation` signals are additionally filtered by the per-evaluation `evaluation_ids` allowlist in the row's `config`, enforced upstream in the eval workflows; `evaluation_report` signals are gated by their own `(llm_analytics, evaluation_report)` row (the inbox "AI observability" toggle).
+- AI observability exposes eval-report signals in the Inbox UI. These signals are gated by the `(llm_analytics, evaluation_report)` row controlled by the AI observability toggle. The legacy per-result backend path remains registered but is no longer exposed or counted by the frontend.
- For session replay configs, serializer validation enforces that `config.recording_filters` is a JSON object when present.
- The serializer exposes a computed `status` field:
- `session_analysis_cluster` derives status from the Temporal clustering workflow
@@ -1140,9 +1140,9 @@ Report ↔ task relationships are recorded as `task_run` artefacts (see `SignalR
Auto-start dedup is separate from this freeform log: `maybe_autostart_implementation_task()` (`backend/auto_start.py`) gates on a legacy `SignalReportTask` implementation row, checked inside the report-row `select_for_update`, so concurrent evaluations can't double-start. Both the auto-start and the manual tasks-API path go through `record_implementation_task`, which dual-writes that gate row and the `implementation` `task_run` artefact — the transitional arrangement until the backfill lets the gate move to artefacts (see `SignalReportTask`).
-### Eval-signal summarization (`backend/temporal/emit_eval_signal.py`)
+### Legacy eval-signal flow (`backend/temporal/emit_eval_signal.py`)
-Separate from report generation, the `emit-eval-signal` workflow uses `call_llm()` with extended thinking to turn an LLMA evaluation result into a signal-sized description plus significance score. Low-significance eval results are dropped before calling `emit_signal()`.
+The frontend no longer exposes per-evaluation signal enablement. This backend workflow remains registered for existing Temporal histories and stored `(llm_analytics, evaluation)` configs until the legacy path is removed. Completed evaluation reports are the supported evaluation-based AI observability signal source.
### Resetting self-driving state for local re-testing
@@ -1405,7 +1405,7 @@ products/signals/
│ ├── buffer.py # BufferSignalsWorkflow + object-storage flush/backpressure activities
│ ├── clickhouse.py # Retry wrapper for HogQL / ClickHouse activity queries
│ ├── deletion.py # SignalReportDeletionWorkflow
-│ ├── emit_eval_signal.py # EmitEvalSignalWorkflow — eval result → signal
+│ ├── emit_eval_signal.py # Legacy per-result evaluation signal workflow
│ ├── emitter.py # SignalEmitterWorkflow — per-signal backpressure bridge
│ ├── grouping.py # Legacy v1 workflow + active shared grouping implementation
│ ├── grouping_v2.py # Active grouping v2 workflow + pause/unpause support
diff --git a/products/signals/backend/models.py b/products/signals/backend/models.py
index 3fb8fda0b2df..2a3618bdd485 100644
--- a/products/signals/backend/models.py
+++ b/products/signals/backend/models.py
@@ -48,6 +48,7 @@ class SignalSourceConfig(UUIDModel):
# other configs and are deliberately absent).
class SourceType(models.TextChoices):
SESSION_ANALYSIS_CLUSTER = "session_analysis_cluster", "Session analysis cluster"
+ # Legacy per-result source type retained for stored configs and historical signal payloads.
EVALUATION = "evaluation", "Evaluation"
EVALUATION_REPORT = "evaluation_report", "Evaluation report"
ISSUE = "issue", "Issue"
diff --git a/products/signals/backend/temporal/emit_eval_signal.py b/products/signals/backend/temporal/emit_eval_signal.py
index 7f17c353124f..b8d57f491fb2 100644
--- a/products/signals/backend/temporal/emit_eval_signal.py
+++ b/products/signals/backend/temporal/emit_eval_signal.py
@@ -1,3 +1,10 @@
+"""Legacy per-result evaluation signal path.
+
+The frontend no longer exposes per-evaluation signal enablement. Keep this workflow and activity
+registered for existing Temporal histories and stored configs until the backend path is removed.
+Evaluation reports are the supported AI observability signal source.
+"""
+
import json
from dataclasses import dataclass
from datetime import timedelta
diff --git a/products/signals/frontend/inbox/components/config/AgentsRoster.tsx b/products/signals/frontend/inbox/components/config/AgentsRoster.tsx
index b270e01fbbf1..40f3fcd3da62 100644
--- a/products/signals/frontend/inbox/components/config/AgentsRoster.tsx
+++ b/products/signals/frontend/inbox/components/config/AgentsRoster.tsx
@@ -48,9 +48,6 @@ const ENTITY_KIND_LABELS: Record<string, string> = {
classifier: 'Classifier',
scorer: 'Scorer',
summarizer: 'Summarizer',
- llm_judge: 'LLM judge',
- hog: 'Hog',
- sentiment: 'Sentiment',
}
function entityKindLabel(kind: string): string {
@@ -76,7 +73,7 @@ function resolveAgentStatus(
return 'watching'
}
-/** One individually switchable thing inside a source: a scanner, an evaluation, a signal type. */
+/** One individually switchable thing inside a source: a scanner or a signal type. */
interface RosterEntity {
id: string
name: string
@@ -208,9 +205,6 @@ interface ExpansionProps {
onToggleEntity: (entityId: string) => void
onConfigureFilters?: () => void
onRetryData: () => void
- /** AI observability only: the periodic digest, which is its own signal stream, not a master. */
- onToggleReports?: () => void
- reportsEnabled?: boolean
}
function ToolDataStatus({
@@ -278,8 +272,6 @@ function Expansion({
onToggleEntity,
onConfigureFilters,
onRetryData,
- onToggleReports,
- reportsEnabled,
}: ExpansionProps): JSX.Element {
const [filter, setFilter] = useState('')
const { entities } = state
@@ -322,25 +314,6 @@ function Expansion({
<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>
@@ -436,8 +409,6 @@ interface AgentRowProps {
onEnableTool: (tool: SourceToolStatus) => void
onConfigureFilters?: () => void
onRetryData: () => void
- onToggleReports?: () => void
- reportsEnabled?: boolean
}
const AgentRow = memo(function AgentRow({
@@ -452,8 +423,6 @@ const AgentRow = memo(function AgentRow({
onEnableTool,
onConfigureFilters,
onRetryData,
- onToggleReports,
- reportsEnabled,
}: AgentRowProps): JSX.Element {
const { armed, loading, requiresSetup, syncStatus, entities } = state
const status = resolveAgentStatus(armed, syncStatus)
@@ -539,8 +508,6 @@ const AgentRow = memo(function AgentRow({
onToggleEntity={(entityId) => onToggleEntity(agent.source, entityId)}
onConfigureFilters={onConfigureFilters}
onRetryData={onRetryData}
- onToggleReports={onToggleReports}
- reportsEnabled={reportsEnabled}
/>
)}
</div>
@@ -564,9 +531,6 @@ export function AgentsRoster(): JSX.Element {
errorTrackingTypeStates,
visionScanners,
visionScannersLoading,
- evaluations,
- evaluationsLoading,
- signalEmittingEvaluationIds,
isSessionAnalysisToggling,
isConversationsToggling,
isEvalReportsToggling,
@@ -587,13 +551,10 @@ export function AgentsRoster(): JSX.Element {
toggleErrorTracking,
toggleErrorTrackingType,
toggleEvalReports,
- toggleEvaluationSignals,
toggleCiSignals,
toggleAnomalyInvestigation,
toggleHealthChecks,
toggleScannerSignals,
- setAllScannerSignals,
- setEvaluationSignals,
initiateDataWarehouseSourceToggle,
enableSourceTool,
openSessionAnalysisSetup,
@@ -614,18 +575,6 @@ export function AgentsRoster(): JSX.Element {
[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 }) => ({
@@ -689,14 +638,10 @@ export function AgentsRoster(): JSX.Element {
case 'llm_analytics':
return {
...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),
+ armed: !!evalReportsConfig?.enabled,
loading: isEvalReportsToggling,
requiresSetup: false,
syncStatus: null,
- entities: evaluationEntities,
- entitiesLoading: evaluations === null && evaluationsLoading,
}
case 'analytics':
return {
@@ -745,9 +690,6 @@ export function AgentsRoster(): JSX.Element {
sessionAnalysisConfig,
isSessionAnalysisToggling,
evalReportsConfig,
- evaluationEntities,
- evaluations,
- evaluationsLoading,
isEvalReportsToggling,
anomalyInvestigationConfig,
isAnomalyInvestigationToggling,
@@ -784,7 +726,7 @@ export function AgentsRoster(): JSX.Element {
toggleSessionAnalysis()
return
case 'llm_analytics':
- // Switched per evaluation, plus the digest, both in the expanded list.
+ toggleEvalReports()
return
case 'analytics':
toggleAnomalyInvestigation()
@@ -804,11 +746,6 @@ export function AgentsRoster(): JSX.Element {
}
},
[
- scannerEntities,
- setAllScannerSignals,
- evaluationEntities,
- evalReportsConfig,
- setEvaluationSignals,
toggleErrorTracking,
toggleConversations,
toggleSessionAnalysis,
@@ -824,13 +761,11 @@ export function AgentsRoster(): JSX.Element {
(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]
+ [toggleScannerSignals, toggleErrorTrackingType]
)
const visibleGroups = AGENT_ROSTER_GROUPS.map((group) => ({
@@ -873,8 +808,6 @@ export function AgentsRoster(): JSX.Element {
agent.source === 'session_replay' ? openSessionAnalysisSetup : undefined
}
onRetryData={loadToolDataEvents}
- onToggleReports={agent.source === 'llm_analytics' ? toggleEvalReports : undefined}
- reportsEnabled={!!evalReportsConfig?.enabled}
/>
))}
</div>
diff --git a/products/signals/frontend/inbox/components/config/SignalSourcesPanel.stories.tsx b/products/signals/frontend/inbox/components/config/SignalSourcesPanel.stories.tsx
index 68dd4dc9dcc3..5a63f9a96246 100644
--- a/products/signals/frontend/inbox/components/config/SignalSourcesPanel.stories.tsx
+++ b/products/signals/frontend/inbox/components/config/SignalSourcesPanel.stories.tsx
@@ -64,10 +64,6 @@ 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),
]
@@ -95,25 +91,6 @@ function scannersFor(state: PanelState): Record<string, unknown>[] {
]
}
-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'] : []),
@@ -140,10 +117,6 @@ function PanelHarness(state: PanelState): JSX.Element {
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." }]
diff --git a/products/signals/frontend/inbox/components/config/SignalSourcesPanel.tsx b/products/signals/frontend/inbox/components/config/SignalSourcesPanel.tsx
index 8c490de27b58..aed5c68d6023 100644
--- a/products/signals/frontend/inbox/components/config/SignalSourcesPanel.tsx
+++ b/products/signals/frontend/inbox/components/config/SignalSourcesPanel.tsx
@@ -29,7 +29,6 @@ export function SignalSourcesPanel(): JSX.Element {
loadSources,
loadSourceConfigs,
loadVisionScanners,
- loadEvaluations,
loadToolDataEvents,
closeSessionAnalysisSetup,
closeDataSourceSetup,
@@ -40,7 +39,6 @@ export function SignalSourcesPanel(): JSX.Element {
loadSources()
loadSourceConfigs()
loadVisionScanners()
- loadEvaluations()
loadToolDataEvents()
}, []) // eslint-disable-line react-hooks/exhaustive-deps
diff --git a/products/signals/frontend/inbox/components/config/agentRosterMeta.ts b/products/signals/frontend/inbox/components/config/agentRosterMeta.ts
index 2d30548c4635..166c04a169bf 100644
--- a/products/signals/frontend/inbox/components/config/agentRosterMeta.ts
+++ b/products/signals/frontend/inbox/components/config/agentRosterMeta.ts
@@ -104,14 +104,10 @@ export const AGENT_ROSTER_GROUPS: AgentRosterGroup[] = [
source: 'llm_analytics',
sourceProduct: SignalSourceProduct.LlmAnalytics,
label: 'AI observability',
- 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',
+ watches: 'Changes in the quality and behavior of your AI features',
+ detail: 'Completed eval reports can become signals for agent investigation. Configure which reports run and when in AI observability.',
+ docsUrl: 'https://posthog.com/docs/ai-observability/self-driving',
+ docsLabel: 'AI observability Self-driving',
},
{
source: 'analytics',
diff --git a/products/signals/frontend/inbox/signalSourcesLogic.test.ts b/products/signals/frontend/inbox/signalSourcesLogic.test.ts
index 0e064b33966f..2387ebfac7f5 100644
--- a/products/signals/frontend/inbox/signalSourcesLogic.test.ts
+++ b/products/signals/frontend/inbox/signalSourcesLogic.test.ts
@@ -180,7 +180,7 @@ describe('signalSourcesLogic', () => {
expect(logic.values.isGithubIssuesToggling).toBe(false)
})
- it('creates an AI observability config for evaluation reports', async () => {
+ it('uses only eval reports for the AI observability signal source', async () => {
const createSourceConfig = jest.spyOn(api.signalSourceConfigs, 'create').mockResolvedValue({
id: 'config-evaluation-reports',
source_product: SignalSourceProduct.LlmAnalytics,
@@ -191,7 +191,20 @@ describe('signalSourcesLogic', () => {
updated_at: '2026-07-30T00:00:00Z',
status: null,
})
- logic.actions.loadSourceConfigsSuccess([])
+ logic.actions.loadSourceConfigsSuccess([
+ {
+ id: 'retired-evaluation-config',
+ source_product: SignalSourceProduct.LlmAnalytics,
+ source_type: SignalSourceType.Evaluation,
+ enabled: true,
+ config: { evaluation_ids: ['evaluation-1'] },
+ created_at: '2026-07-30T00:00:00Z',
+ updated_at: '2026-07-30T00:00:00Z',
+ status: null,
+ },
+ ])
+
+ expect(logic.values.enabledSourcesCount).toBe(0)
logic.actions.toggleEvalReports()
await expectLogic(logic).toFinishAllListeners()
diff --git a/products/signals/frontend/inbox/signalSourcesLogic.ts b/products/signals/frontend/inbox/signalSourcesLogic.ts
index 4af852729743..fd3d1ff08b38 100644
--- a/products/signals/frontend/inbox/signalSourcesLogic.ts
+++ b/products/signals/frontend/inbox/signalSourcesLogic.ts
@@ -21,8 +21,6 @@ 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,
@@ -56,7 +54,7 @@ const TOOL_USAGE_EVENTS = ['$exception', '$ai_generation', '$ai_trace', '$pagevi
/**
* 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.
+ * run a few dozen scanners, and the median runs one.
*/
const ENTITY_PAGE_SIZE = 100
@@ -226,8 +224,6 @@ export interface signalSourcesLogicValues {
sourceType: SignalSourceType
}[]
evalReportsConfig: SignalSourceConfig | null
- evaluations: EvaluationApi[] | null
- evaluationsLoading: boolean
githubIssuesConfig: SignalSourceConfig | null
hasEmittingScanner: boolean | null
hasNoSources: boolean
@@ -248,7 +244,6 @@ export interface signalSourcesLogicValues {
pgAnalyzeIssuesConfig: SignalSourceConfig | null
sessionAnalysisConfig: SignalSourceConfig | null
sessionAnalysisSetupOpen: boolean
- signalEmittingEvaluationIds: string[]
sourceConfigs: SignalSourceConfig[] | null
sourceConfigsLoading: boolean
sourcesModalOpen: boolean
@@ -306,21 +301,6 @@ export interface signalSourcesLogicActions {
ciSignalsConfig: CISignalsConfigApi
payload?: any
}
- loadEvaluations: () => any
- loadEvaluationsFailure: (
- error: string,
- errorObject?: any
- ) => {
- error: string
- errorObject?: any
- }
- loadEvaluationsSuccess: (
- evaluations: EvaluationApi[],
- payload?: any
- ) => {
- evaluations: EvaluationApi[]
- payload?: any
- }
loadSourceConfigs: () => any
loadSourceConfigsFailure: (
error: string,
@@ -409,9 +389,6 @@ export interface signalSourcesLogicActions {
enabled: boolean
source: WarehouseBackedSource
}
- setEvaluationSignals: (evaluationIds: string[]) => {
- evaluationIds: string[]
- }
startDataWarehouseSourceToggle: (source: WarehouseBackedSource) => {
source: WarehouseBackedSource
}
@@ -439,9 +416,6 @@ export interface signalSourcesLogicActions {
toggleEvalReports: () => {
value: true
}
- toggleEvaluationSignals: (evaluationId: string) => {
- evaluationId: string
- }
toggleHealthChecks: () => {
value: true
}
@@ -515,7 +489,6 @@ export interface signalSourcesLogicMeta {
enabled: boolean
sourceType: SignalSourceType
}[]
- signalEmittingEvaluationIds: (sourceConfigs: SignalSourceConfig[] | null) => string[]
enabledSourcesCount: (sourceConfigs: SignalSourceConfig[] | null, hasEmittingScanner: boolean | null) => number
hasNoSources: (sourceConfigs: SignalSourceConfig[] | null, enabledSourcesCount: number) => boolean
}
@@ -562,8 +535,6 @@ export const signalSourcesLogic = kea<signalSourcesLogicType>([
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,
@@ -665,21 +636,6 @@ export const signalSourcesLogic = kea<signalSourcesLogicType>([
},
},
],
- 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({
@@ -1035,29 +991,14 @@ export const signalSourcesLogic = kea<signalSourcesLogicType>([
)?.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". Replay Vision has no config row at
// all, so it is counted separately, once, however many of its scanners emit.
+ // Evaluation configs can survive from the retired per-result path, but eval reports are
+ // the only AI observability source that emits signals.
(sourceConfigs: SignalSourceConfig[] | null, hasEmittingScanner: boolean | null): number => {
const configured =
sourceConfigs?.filter(
@@ -1066,6 +1007,10 @@ export const signalSourcesLogic = kea<signalSourcesLogicType>([
!(
c.source_product === SignalSourceProduct.SignalsScout &&
c.source_type === SignalSourceType.CrossSourceIssue
+ ) &&
+ !(
+ c.source_product === SignalSourceProduct.LlmAnalytics &&
+ c.source_type === SignalSourceType.Evaluation
)
).length ?? 0
return configured + (hasEmittingScanner ? 1 : 0)
@@ -1300,42 +1245,6 @@ export const signalSourcesLogic = kea<signalSourcesLogicType>([
}
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.ciSignalsIsFullyEnabled
const wasConnected = values.ciSignalsConfig?.configured ?? false
@@ -1519,7 +1428,6 @@ export const signalSourcesLogic = kea<signalSourcesLogicType>([
// without needlessly loading the source configs
actions.loadSourceConfigs()
actions.loadVisionScanners()
- actions.loadEvaluations()
if (values.featureFlags[FEATURE_FLAGS.ENGINEERING_ANALYTICS]) {
actions.loadCiSignalsConfig()
}
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 0abae31ab81d..2cf6c485d62d 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -9318,6 +9318,10 @@ export namespace Schemas {
readonly created_at: string;
/** Insight ID monitored by this alert. Note: Response returns full InsightBasicSerializer object. */
insight: number;
+ /** Short ID of the insight monitored by this alert. */
+ readonly insight_short_id: string;
+ /** Display name of the insight monitored by this alert. */
+ readonly insight_display_name: string;
/**
* Human-readable name for the alert.
* @maxLength 255
@@ -53451,6 +53455,10 @@ export namespace Schemas {
readonly created_at?: string;
/** Insight ID monitored by this alert. Note: Response returns full InsightBasicSerializer object. */
insight?: number;
+ /** Short ID of the insight monitored by this alert. */
+ readonly insight_short_id?: string;
+ /** Display name of the insight monitored by this alert. */
+ readonly insight_display_name?: string;
/**
* Human-readable name for the alert.
* @maxLength 255
@@ -81875,10 +81883,18 @@ export namespace Schemas {
* Optional. Restrict results to alerts created by the user with this UUID.
*/
created_by?: string;
+ /**
+ * Optional. Restrict results by whether the alert uses anomaly detection.
+ */
+ has_detector?: boolean;
/**
* Optional. Restrict results to alerts on this insight ID.
*/
insight_id?: number;
+ /**
+ * Optional. Restrict results to alerts whose insight has this tag.
+ */
+ insight_tag?: string;
/**
* Number of results to return per page.
*/
diff --git a/services/mcp/src/generated/alerts/api.ts b/services/mcp/src/generated/alerts/api.ts
index 6d5a5a481c6b..1e31f93fb5de 100644
--- a/services/mcp/src/generated/alerts/api.ts
+++ b/services/mcp/src/generated/alerts/api.ts
@@ -21,7 +21,12 @@ export const AlertsListQueryParams = /* @__PURE__ */ zod.object({
.string()
.optional()
.describe('Optional. Restrict results to alerts created by the user with this UUID.'),
+ has_detector: zod
+ .boolean()
+ .optional()
+ .describe('Optional. Restrict results by whether the alert uses anomaly detection.'),
insight_id: zod.number().optional().describe('Optional. Restrict results to alerts on this insight ID.'),
+ insight_tag: zod.string().optional().describe('Optional. Restrict results to alerts whose insight has this tag.'),
limit: zod.number().optional().describe('Number of results to return per page.'),
offset: zod.number().optional().describe('The initial index from which to return the results.'),
search: zod
diff --git a/services/mcp/src/tools/generated/alerts.ts b/services/mcp/src/tools/generated/alerts.ts
index 28bc2b7ead40..52c708f1d23d 100644
--- a/services/mcp/src/tools/generated/alerts.ts
+++ b/services/mcp/src/tools/generated/alerts.ts
@@ -219,7 +219,9 @@ const alertsList = (): ToolBase<typeof AlertsListSchema, WithPostHogUrl<Schemas.
path: `/api/projects/${encodeURIComponent(String(projectId))}/alerts/`,
query: {
created_by: params.created_by,
+ has_detector: params.has_detector,
insight_id: params.insight_id,
+ insight_tag: params.insight_tag,
limit: params.limit,
offset: params.offset,
search: params.search,
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/alerts-list.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/alerts-list.json
index b891ba8c2a3f..1a3526f21ef2 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/alerts-list.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/alerts-list.json
@@ -5,10 +5,18 @@
"description": "Optional. Restrict results to alerts created by the user with this UUID.",
"type": "string"
},
+ "has_detector": {
+ "description": "Optional. Restrict results by whether the alert uses anomaly detection.",
+ "type": "boolean"
+ },
"insight_id": {
"description": "Optional. Restrict results to alerts on this insight ID.",
"type": "number"
},
+ "insight_tag": {
+ "description": "Optional. Restrict results to alerts whose insight has this tag.",
+ "type": "string"
+ },
"limit": {
"description": "Number of results to return per page.",
"type": "number"