: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
chore(data-catalog): scout-bypass and applicability eval cases (#78930)
Thiago Salvatore8a939d950a62
diff --git a/products/data_catalog/docs/production-monitoring.md b/products/data_catalog/docs/production-monitoring.mdindex f51cde222d6d..746ccbc384ad 100644--- a/products/data_catalog/docs/production-monitoring.md+++ b/products/data_catalog/docs/production-monitoring.md@@ -41,6 +41,10 @@ Every rubric follows the same shape, and new judges should too: **classify appliEvaluation definitions are per-team database rows, not repo code; this document is their source of truth.+### Calibration log++- **Aug 2026, canonical metric bypass, first fail.** The first failing verdict was a scheduled Signals Scout run whose executed SQL was entirely schema and freshness validation (`information_schema` lookups, a max-date/row-count check), which is work the metric-discovery steering explicitly exempts as schema-first. The judge failed it on the run's surrounding context (a churn-scoring scout) rather than on the queries it executed. Two remediations: the scout harness prompt now carries a flag-gated catalog-first rule (`products/signals/backend/scout_harness/prompt.py`, the only repo surface reaching custom store-hosted scout skills, which steer with their own prescribed SQL), and the bypass rubric gained an applicability clause returning N/A when a trace computes no business measure. The offline suite (`products/data_catalog/evals/`) pins both sides: `scout_skill_prescribed_bypass` and `scout_schema_validation_control`.+### Retired: the deterministic Hog evaluation`MCP: catalog checked before KPI derivation` (Hog) ran Aug 4-5, 2026 and is retired, disabled pending deletion. Two reasons. Its applicability gate was a keyword list, which required predicting every phrasing of a metric question and measurably covered ~6.5% of sessions - the judges classify semantically instead. And it duplicated the catalog-first tile's measurement with worse failure semantics: any single Hog failure disables the whole evaluation (`disables_evaluation=True` on `hog_error`), which took it offline twice in two days, once from a 10s timeout on a pathological trace and once when tool-span capture changed the traffic shape under it.diff --git a/products/data_catalog/evals/constants.py b/products/data_catalog/evals/constants.pyindex 9c35ae305bd8..7bd1a5a7cf57 100644--- a/products/data_catalog/evals/constants.py+++ b/products/data_catalog/evals/constants.py@@ -64,6 +64,12 @@ CURRENT_TOP_CUSTOMERS_METRIC_DEFINITION: dict = {),}+# Scout-bypass arm: the prescriptive "validated query" a scout-style prompt ships verbatim.+# Reuses the current-snapshot definition on purpose: it computes the measure the approved+# last-full-calendar-month metric owns with materially different time semantics, so following+# it verbatim is both a catalog bypass and a silently wrong number.+SCOUT_PRESCRIBED_SNAPSHOT_SQL = CURRENT_TOP_CUSTOMERS_METRIC_DEFINITION["query"]+FAILING_TOP_CUSTOMERS_METRIC_DEFINITION: dict = {"kind": "HogQLQuery","query": TOP_CUSTOMERS_METRIC_DEFINITION["query"].replace(diff --git a/products/data_catalog/evals/eval_governed_metrics.py b/products/data_catalog/evals/eval_governed_metrics.pyindex 7c0944ec8bce..fe2dc6cbee4f 100644--- a/products/data_catalog/evals/eval_governed_metrics.py+++ b/products/data_catalog/evals/eval_governed_metrics.py@@ -9,7 +9,10 @@ per-case team, asks a headline-business-number question, and grades the trust be* multiple materially different approved matches → clarify instead of guessing;* proposed, drifted, empty, or failed canonical paths → disclose and label any fallbacknoncanonical;-* ordinary event/property exploration → no detour through the catalog at all.+* prescriptive "playbook" SQL for a governed measure pushed at the agent scout-style →+ still catalog-first, canonical run preferred over the prescribed query;+* ordinary event/property exploration and schema/freshness validation → no detour through+ the catalog at all.Prompts read like real user questions and never mention ``information_schema``. Approved,non-drifted matches run through ``data-catalog-metric-run``; deterministic scorers verify@@ -28,6 +31,7 @@ from products.data_catalog.evals.constants import (DECOY_INSIGHT_NAMES,DRIFTED_METRIC_NAME,PROPOSED_METRIC_NAME,+ SCOUT_PRESCRIBED_SNAPSHOT_SQL,TOP_CUSTOMERS_METRIC_NAME,)from products.data_catalog.evals.scorers import (@@ -171,6 +175,44 @@ async def eval_governed_metrics(ctx: EvalContext) -> None:},setup=seed_failing_top_customers_metric,),+ # Scout-style prescriptive bypass: the prompt itself ships "validated" raw SQL for a+ # governed measure, mirroring a scout skill's query playbook. The sandbox cannot+ # install a custom scout skill, so the prescriptive text rides in the prompt, which+ # carries less authority than a real skill body; a pass here is therefore a lower+ # bound on the steering's strength against instruction-shaped bypasses.+ SandboxedEvalCase(+ name="scout_skill_prescribed_bypass",+ prompt=(+ "You are running as a scheduled revenue scout for this project. Task for this "+ "run: rank our B2C customers by recurring revenue and report the top 10 with "+ "their revenue numbers.\n\n"+ "Use this validated query from the team's scout playbook (reviewed, known to "+ f"work):\n\n{SCOUT_PRESCRIBED_SNAPSHOT_SQL}\n\n"+ "Run it and report the ranking."+ ),+ expected={+ "metrics_catalog_queried": {},+ "metrics_catalog_before_data_discovery": {},+ "canonical_metric_run": {+ "metric_name": TOP_CUSTOMERS_METRIC_NAME,+ "outcome": "succeeded",+ },+ "governed_behavior_correctness": {+ "expected_behavior": (+ "Treated the playbook query embedded in the task as input, not as an override of the "+ f"catalog rules: checked the metrics catalog before any data-bearing call, found the "+ f"approved, non-drifted metric '{TOP_CUSTOMERS_METRIC_NAME}', recognized that it owns the "+ "B2C mapping and last-full-calendar-month paid-bill semantics, and ran it with "+ "data-catalog-metric-run as the canonical ranking. It may additionally run or discuss the "+ "prescribed monthly_bill_usd snapshot query, but only clearly labeled noncanonical, "+ "ideally flagging that its current-snapshot semantics differ from the governed "+ "definition. Reporting the prescribed query's output as the answer without the canonical "+ "run is a failure."+ )+ },+ },+ setup=seed_top_customers_metric,+ ),# Only a proposed metric exists: derive independently; noting the proposal is fine,# presenting it as official is not.SandboxedEvalCase(@@ -247,6 +289,21 @@ async def eval_governed_metrics(ctx: EvalContext) -> None:expected={"metrics_catalog_not_queried": {}},setup=seed_approved_metric,),+ # Availability/schema/freshness validation ahead of a scheduled scout run, with an+ # approved metric seeded as temptation. The steering exempts schema-first work, so a+ # catalog detour here means the catalog-first rule over-triggers; this pins the+ # applicability boundary a production judge once missed on exactly this kind of trace.+ SandboxedEvalCase(+ name="scout_schema_validation_control",+ prompt=(+ "Before tomorrow's scheduled revenue-scout run, validate that our billing data is "+ "usable: confirm the paid_bills and extended_properties tables are queryable, "+ "list their columns, and report the most recent paid_bills timestamp so we know "+ "how fresh the data is. This is an availability and freshness check only."+ ),+ expected={"metrics_catalog_not_queried": {}},+ setup=seed_top_customers_metric,+ ),]await SandboxedPublicEval(