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(slack-app): prompt to connect GitHub when ask needs a repo (#61124)

Vojta Bartoš6af8804541f2
diff --git a/posthog/temporal/ai/posthog_code_slack_mention.py b/posthog/temporal/ai/posthog_code_slack_mention.py
index 7f7c1bfaf84b..b45ebdcae175 100644
--- a/posthog/temporal/ai/posthog_code_slack_mention.py
+++ b/posthog/temporal/ai/posthog_code_slack_mention.py
@@ -416,7 +416,28 @@ class PostHogCodeSlackMentionWorkflow(PostHogWorkflow):
if cascade.mode == "auto":
repository = cascade.repository
elif cascade.mode == "no_repo":
+ # Cascade only emits `no_repo` when neither the team nor the
+ # mentioning user has any GitHub install. Classify first so
+ # non-coding asks ("how do I configure retention?") still
+ # answer with no repo; coding asks surface the connect-personal-
+ # GitHub prompt instead of silently no-op'ing.
repository = None
+ if workflow.patched("posthog-code-classify-before-gate-2026-06"):
+ needs_repo = await _execute_posthog_code_activity(
+ classify_posthog_code_task_needs_repo_activity,
+ event.get("text", ""),
+ thread_messages,
+ )
+ if needs_repo:
+ blocked = await _execute_posthog_code_activity(
+ block_posthog_code_task_if_no_personal_github_activity,
+ inputs,
+ channel,
+ thread_ts,
+ user_id,
+ )
+ if blocked:
+ return
elif cascade.mode == "needs_user_github":
# Team has GitHub, but the mentioning user hasn't connected their
# personal install. Fire the gate so they get the Connect button