:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(replay-vision): make the observations skill readable by scanner scouts (#87084)
Tue Haulund9f5131d96850
diff --git a/products/replay_vision/frontend/replay_scanners/scannerScout.ts b/products/replay_vision/frontend/replay_scanners/scannerScout.tsindex e9067ea1309b..d46b6e1dc046 100644--- a/products/replay_vision/frontend/replay_scanners/scannerScout.ts+++ b/products/replay_vision/frontend/replay_scanners/scannerScout.ts@@ -82,7 +82,7 @@ Every run leaves exactly one report: your digest. That report is what the team r1. \`vision-scanners-get\` with scanner_id \`${scannerId}\` — the scanner's current name, type, prompt, and enabled state. If it no longer exists, close out with a one-line summary and no report.2. \`scout-runs-list\` filtered to your own skill_name — find your previous successful run. Your window is everything since it (fall back to the last 24 hours on the first run or after a gap).3. \`scout-scratchpad-search\` (text: \`${scannerId}\`) — baselines, known noise, and \`report:\`/\`dedupe:\` pointers from prior runs. Every entry you write is keyed on that id, so it is what finds them again.-4. Load the packaged skill \`posthog:exploring-replay-vision-observations\` through the runtime's packaged-skill mechanism for the observation data model and query patterns.+4. \`llma-skill-get\` \`exploring-replay-vision-observations\` — the observation data model, what \`confidence\` and each status mean, and how to cite a finding.## Read the window@@ -118,7 +118,7 @@ Write the report so it stands alone for a reader with no prior context:- Open with the takeaway in one line, then at most three bullets ordered by impact.- Each bullet: what changed, with only the numbers needed to judge it; why it matters; the evidence-backed cause or best next investigation; and the specific next action.-- Ground every claim in specific observations, as real markdown links: \`[what it shows](/replay-vision/observations/<observation_id>)\`, taking \`<observation_id>\` from the \`id\` of an observation you actually read. A bare \`[obs 3]\` is not a link and leaves the reader nowhere to go. Two or three per bullet is plenty; link the clearest cases, not every one.+- Ground every claim in observations you actually read, as real markdown links to the recording: \`[what it shows](/project/<project_id>/replay/<session_id>?t=<seconds>)\`, so the link opens on the moment being claimed. A bare \`[obs 3]\` is not a link and leaves the reader nowhere to go. Two or three per bullet is plenty; link the clearest cases, not every one.- Close with what you checked, and name anything you could not cover and why.When nothing clears the bar, still file the report, with the verdict \`Nothing notable\` and a short coverage line ("42 observations across 30 sessions, distributions steady"). ${focus.priority}diff --git a/products/signals/backend/scout_harness/lazy_seed.py b/products/signals/backend/scout_harness/lazy_seed.pyindex b2cd1f95cf2c..e66823e2b2cb 100644--- a/products/signals/backend/scout_harness/lazy_seed.py+++ b/products/signals/backend/scout_harness/lazy_seed.py@@ -39,6 +39,17 @@ _SKILLS_DIR = Path(__file__).resolve().parent.parent.parent / "skills"# means cleaning up its rows out-of-band._COMPANION_SKILL_DIRS = ("authoring-scouts",)+# Companions that another product ships and maintains, seeded on the same terms as the ones above.+# A scout is exactly the agent the companion rule is written for: it reads skills through+# `llma-skill-get`, which only sees per-team rows, so a skill that lives solely in+# `dist/skills.zip` is unreachable from a run no matter what the scout's prompt says. The+# alternative — each product bundling a private copy onto every scout it creates — freezes the+# copy at creation, so an edit to the source never reaches a scout already in rotation.+# Cross-product by file path, not by import: the harness reads the markdown and never imports the+# owning product. The stranding caveat above applies here too.+_PRODUCTS_DIR = Path(__file__).resolve().parents[3]+_EXTERNAL_COMPANION_SKILL_DIRS = (_PRODUCTS_DIR / "replay_vision" / "skills" / "exploring-replay-vision-observations",)+# Mirrors the regex in `products/posthog_ai/scripts/build_skills.py` so frontmatter parsing# stays consistent across the two consumers. Keep these in sync if the skill spec evolves._FRONTMATTER_RE = re.compile(r"^---\s*\n(.*?)\n---\s*\n", re.DOTALL)@@ -312,16 +323,30 @@ def discover_canonical_skills(skills_dir: Path | None = None) -> tuple[Canonicalon the first read instead of flapping silently."""base = skills_dir or _SKILLS_DIR+ # `skills_dir` means "read this fleet in isolation", which is what the tests want; the+ # cross-product companions belong to the real fleet only.+ external = _EXTERNAL_COMPANION_SKILL_DIRS if skills_dir is None else ()if not base.is_dir():return ()- discovered: list[CanonicalSkill] = []- by_name: dict[str, Path] = {}+ candidates: list[tuple[Path, bool]] = []for entry in sorted(base.iterdir()):if not entry.is_dir():continueis_scout = entry.name.startswith(SIGNALS_SCOUT_SKILL_PREFIX)- if not is_scout and entry.name not in _COMPANION_SKILL_DIRS:+ if is_scout or entry.name in _COMPANION_SKILL_DIRS:+ candidates.append((entry, is_scout))+ for entry in external:+ if not (entry / "SKILL.md").is_file():+ # Warn rather than raise: `canonical_skill_names` turns a parse error into an empty+ # fleet, so a moved directory in another product would make every scout read as+ # custom. The fleet lock in the tests is what fails loud on this.+ logger.warning("discover_canonical_skills: external companion skill missing at %s", entry)continue+ candidates.append((entry, False))++ discovered: list[CanonicalSkill] = []+ by_name: dict[str, Path] = {}+ for entry, is_scout in candidates:if not (entry / "SKILL.md").is_file():continueskill = _parse_canonical_skill(entry, is_scout=is_scout)diff --git a/products/signals/backend/test/test_scout_harness_lazy_seed.py b/products/signals/backend/test/test_scout_harness_lazy_seed.pyindex 0bceab4e865f..90df95717696 100644--- a/products/signals/backend/test/test_scout_harness_lazy_seed.py+++ b/products/signals/backend/test/test_scout_harness_lazy_seed.py@@ -401,6 +401,10 @@ class TestDiscoverCanonicalSkills:# Companion (non-scout) skill, seeded so store-only agents can read the# authoring guide via llma-skill-get."authoring-scouts",+ # Companion owned by another product, resolved by file path. Moving or renaming+ # that directory drops it from every team's store, and a scout told to read it+ # would report it missing instead of failing.+ "exploring-replay-vision-observations",}assert expected.issubset(names), f"missing canonical skills: {expected - names}"