: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: Tweaks to Haiku prompt to improve repo selection. (#60092)
Alex Lebedev00730892997b
diff --git a/posthog/temporal/ai/eval_slack_repo_selection.py b/posthog/temporal/ai/eval_slack_repo_selection.pyindex fbb5f5aed09a..f23472843aba 100644--- a/posthog/temporal/ai/eval_slack_repo_selection.py+++ b/posthog/temporal/ai/eval_slack_repo_selection.py@@ -168,36 +168,66 @@ CASES: list[Case] = [),Case(name="marketing_site",- description="Haiku LLM filters as ops/perf rather than code change.",+ description="Perf complaint about a site the team likely owns code for — agent should route to docs/marketing repo.",text_template="@PostHog the docs site loads really slowly on mobile",thread_messages=[{"user": "tester", "text": "@PostHog the docs site loads really slowly on mobile"},{"user": "other", "text": "yeah I noticed the same on /docs/getting-started"},],- expected_stage="haiku",- expected_outcome="no_repo",- note=(- "Ideally the agent would route this to a docs/marketing repo if connected. "- "Haiku LLM treats it as a perf/CDN question instead. Out of this PR's scope; "- "candidate for a follow-up Haiku-tuning PR backed by this eval."- ),+ expected_stage="agent",+ expected_outcome="found",),Case(name="sdk_specific_trace_trip",- description="Haiku heuristic trips on 'trace' in 'stack trace'.",+ description="App/SDK crash with stack trace — agent should route to the relevant SDK repo (e.g. posthog-ios).",text_template="@PostHog the iOS SDK is crashing on app launch after upgrade to 3.19",thread_messages=[{"user": "tester", "text": "@PostHog the iOS SDK is crashing on app launch after upgrade to 3.19"},{"user": "other", "text": "stack trace shows PostHogReplay.start() failing"},],+ expected_stage="agent",+ expected_outcome="found",+ ),+ Case(+ name="posthog_product_hang",+ description="Complaint about a PostHog product page hanging — looks like 'broken page' but it's the SaaS, not the team's code.",+ text_template="@PostHog the trends page hangs forever when I add 10+ series",+ thread_messages=[+ {"user": "tester", "text": "@PostHog the trends page hangs forever when I add 10+ series"},+ {"user": "other", "text": "tried Firefox and Chrome, just a spinner"},+ ],expected_stage="haiku",expected_outcome="no_repo",- note=(- "Pre-existing heuristic false negative: 'trace' is in product_debug_terms "- "(for APM-trace queries) but matches 'stack trace' too. Same scope note as marketing_site."- ),),# --- Agent path (the new logic this PR introduces) -------------------------+ Case(+ name="sdk_instrumentation_on_own_site",+ description="PostHog SDK behaving oddly on the team's own site — the issue is in their code, not in PostHog.",+ text_template="@PostHog autocapture isn't picking up clicks on our checkout button, other buttons work",+ thread_messages=[+ {+ "user": "tester",+ "text": "@PostHog autocapture isn't picking up clicks on our checkout button, other buttons work",+ },+ {"user": "other", "text": "we just shipped a redesign yesterday"},+ ],+ expected_stage="agent",+ expected_outcome="found",+ ),+ Case(+ name="wrong_data_tracking_bug",+ description="'Wrong data in PostHog' — almost always a tracking bug in the team's own code, not PostHog.",+ text_template="@PostHog we're not seeing any signup_completed events even though we tested signups today",+ thread_messages=[+ {+ "user": "tester",+ "text": "@PostHog we're not seeing any signup_completed events even though we tested signups today",+ },+ {"user": "other", "text": "the funnel shows 0 conversions but our team manually completed 5"},+ ],+ expected_stage="agent",+ expected_outcome="found",+ ),Case(name="vague_code_bug",description="Vague but code-flavored; agent should disambiguate from cache.",diff --git a/products/slack_app/backend/api.py b/products/slack_app/backend/api.pyindex 0d9ebf4eca4c..4a671974ca10 100644--- a/products/slack_app/backend/api.py+++ b/products/slack_app/backend/api.py@@ -1036,7 +1036,6 @@ def classify_task_needs_repo("insight","session replay","recording",- "trace","mcp","webhook",)@@ -1077,6 +1076,15 @@ def classify_task_needs_repo("automations, destinations, feature flags, experiments, surveys, dashboards, insights, ""recordings, traces, or Slack integrations inside PostHog, unless the user explicitly ""asks to change code, open a PR, edit files, or work in a specific repository.\n\n"+ "A complaint about something the team's own app, site, or SDK does (crashes, broken pages, "+ "wrong rendering, slow loads of a site they ship) is a code change in a repo they own → "+ "needs_repo. But complaints about PostHog itself as a product (its dashboards hanging, "+ "product pages loading slowly, UI bugs in PostHog screens) are SaaS product issues, not "+ "the team's code → no_repo. Important exception: 'wrong data', 'missing events', or "+ "'numbers look off' in PostHog usually means the team's tracking code is broken (wrong "+ "event names, identification logic, SDK setup) — that's a code fix in their repo → "+ "needs_repo. When in doubt, lean needs_repo=true — the discovery agent can still report "+ "there's no good match.\n\n"f"Conversation:\n{conversation}\n\n"f"Latest message: {event_text}\n\n"'Respond with ONLY a JSON object: {{"needs_repo": true}} or {{"needs_repo": false}}'