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(signals): ship a default pre-check for the replay vision scout (#115935)

posthog[bot]fc2c73a057c1
diff --git a/products/signals/backend/test/test_scout_precheck.py b/products/signals/backend/test/test_scout_precheck.py
index 63199a27ae18..3ff3a8bae259 100644
--- a/products/signals/backend/test/test_scout_precheck.py
+++ b/products/signals/backend/test/test_scout_precheck.py
@@ -323,6 +323,16 @@ class TestSystemTableSkillDefaults(ClickhouseTestMixin, NonAtomicBaseTest):
report = SignalReport.objects.create(team=self.team, status=status, title="r")
SignalReport.objects.filter(pk=report.pk).update(updated_at=NOW - timedelta(days=days_since_update))
+ def _seed_scanner(self, *, enabled: bool) -> None:
+ apps.get_model("replay_vision", "ReplayScanner").objects.create(
+ team=self.team,
+ name="s",
+ scanner_type="monitor",
+ scanner_config={"prompt": "p"},
+ model="gemini-3.8-flash",
+ enabled=enabled,
+ )
+
@parameterized.expand(
[
("customer_analytics_no_accounts", "signals-scout-customer-analytics", None, "skip"),
@@ -341,6 +351,11 @@ class TestSystemTableSkillDefaults(ClickhouseTestMixin, NonAtomicBaseTest):
("inbox_validation_old_resolution", "signals-scout-inbox-validation", "resolved_15d", "skip"),
("inbox_validation_recent_unresolved", "signals-scout-inbox-validation", "ready_1d", "skip"),
("inbox_validation_recent_resolution", "signals-scout-inbox-validation", "resolved_13d", "run"),
+ ("replay_vision_absent", "signals-scout-replay-vision", None, "skip"),
+ ("replay_vision_disabled_scanner", "signals-scout-replay-vision", "disabled_scanner", "skip"),
+ ("replay_vision_old_observation", "signals-scout-replay-vision", "observation_31d", "skip"),
+ ("replay_vision_enabled_scanner", "signals-scout-replay-vision", "enabled_scanner", "run"),
+ ("replay_vision_observations_only", "signals-scout-replay-vision", "observation_29d", "run"),
]
)
def test_system_table_defaults_skip_only_on_absence(self, _name, skill, seed, outcome) -> None:
@@ -373,6 +388,16 @@ class TestSystemTableSkillDefaults(ClickhouseTestMixin, NonAtomicBaseTest):
self._seed_report(SignalReport.Status.READY, days_since_update=1)
elif seed == "resolved_13d":
self._seed_report(SignalReport.Status.RESOLVED, days_since_update=13)
+ elif seed in ("enabled_scanner", "disabled_scanner"):
+ self._seed_scanner(enabled=seed == "enabled_scanner")
+ elif seed in ("observation_29d", "observation_31d"):
+ _create_event(
+ team=self.team,
+ event="$recording_observed",
+ distinct_id="d1",
+ timestamp=NOW - timedelta(days=29 if seed == "observation_29d" else 31),
+ )
+ flush_persons_and_events()
with (
patch(ROLLOUT_PERCENT, return_value=100),
diff --git a/products/signals/skills/signals-scout-replay-vision/SKILL.md b/products/signals/skills/signals-scout-replay-vision/SKILL.md
index b5bf2357fffb..23b6b7ce9164 100644
--- a/products/signals/skills/signals-scout-replay-vision/SKILL.md
+++ b/products/signals/skills/signals-scout-replay-vision/SKILL.md
@@ -18,6 +18,18 @@ allowed_tools:
metadata:
owner_team: signals
scope: replay_vision
+scout-precheck-query: |
+ SELECT 'enabled_scanner' AS kind, count() AS n
+ FROM system.replay_scanners
+ WHERE enabled = 1
+ HAVING n > 0
+ UNION ALL
+ SELECT 'observation' AS kind, count() AS n
+ FROM events
+ WHERE event = '$recording_observed'
+ AND timestamp >= {now} - INTERVAL 30 DAY
+ AND timestamp <= {now} + INTERVAL 1 DAY
+ HAVING n > 0
---
# Signals scout: replay vision
@@ -55,6 +67,8 @@ Two more sibling boundaries: the underlying friction (`$rageclick`, dead clicks,
## Quick close-out: is replay vision even in use?
+A scheduled run can start with a `<precheck_result>` block. An `enabled_scanner` row counts the enabled scanners. An `observation` row counts the `$recording_observed` events of the last 30 days. A run starts only when at least one row is present, so the no-observations, no-enabled-scanners case does not occur. When the block is present, replay vision is in use: skip the `vision-scanners-list` presence check below. Still run the count query to pick the case. With no `observation` row, go to the watch-gap pattern.
+
One cheap count tells you the posture:
```sql