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): keep investigation apart from changes in suggested replies (#117645)

Vojta Bartoš88cdf98fa076
diff --git a/products/slack_app/backend/logic/reply_suggestions.py b/products/slack_app/backend/logic/reply_suggestions.py
index 65659d3c3850..d569befd9436 100644
--- a/products/slack_app/backend/logic/reply_suggestions.py
+++ b/products/slack_app/backend/logic/reply_suggestions.py
@@ -57,6 +57,10 @@ If the answer waits for the person, write up to 3 replies that the person will m
"Use option 2".
- Make each reply clear on its own. Write "Yes, open the pull request", not "Yes".
- Offer only actions that the answer names or clearly implies. Do not invent new work.
+- If the answer offers to investigate or check something first and then make a change, such as a pull \
+request or a code or config change, keep the two steps apart. Put first a reply that asks only for the \
+investigation, so the agent reports what it finds and waits. A reply that also makes the change is a \
+separate choice. Ask for a pull request or a change only in a reply that the person picks for that change.
- If the answer asks for information that only the person knows, such as a name, a value or a repository, \
do not guess it. Offer only the replies that are complete without it, or return an empty list.
- Make each reply a different choice. Do not offer two replies that mean the same thing.
diff --git a/products/slack_app/evals/eval_reply_suggestions.py b/products/slack_app/evals/eval_reply_suggestions.py
index 7cffe192a852..154c24dc4e19 100644
--- a/products/slack_app/evals/eval_reply_suggestions.py
+++ b/products/slack_app/evals/eval_reply_suggestions.py
@@ -91,6 +91,17 @@ WAITING_CASES = [
),
expected=_offer(True),
),
+ # A reader often wants only the check. One button that also opens the pull request takes that choice away.
+ BaseEvalCase(
+ name="investigation_before_a_change",
+ prompt=(
+ "Export jobs got slower this week. The median run went from 40s to 3 minutes, and only the jobs "
+ "that read the `invoices` table slowed down. A missing index is the most likely cause, but I did "
+ "not check the query plan. Next I can run EXPLAIN on the slow query, and if the index is missing, "
+ "add it in a migration and open a pull request. Do you want me to do that?"
+ ),
+ expected=_offer(True),
+ ),
BaseEvalCase(
name="permission_in_german",
prompt=(
diff --git a/products/slack_app/evals/scorers.py b/products/slack_app/evals/scorers.py
index e2533bcde4f7..2b88cac4813c 100644
--- a/products/slack_app/evals/scorers.py
+++ b/products/slack_app/evals/scorers.py
@@ -441,6 +441,7 @@ Each reply has a short button label and the full text the button sends. Every re
- not guess information the answer asks the person for, such as a name, a value or a repository
- be in the same language as the answer
- mean something different from every other reply
+- if the answer offers to check something first and then make a change, such as a pull request, not ask for the check and the change together unless another reply asks for the check alone
Answer `yes` if every reply follows all of these rules. Answer `no` if one reply breaks one rule.
""".strip(),