: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(slack_app): stop waking the agent on orders aimed at a person (#83596)
Vojta Bartoš182546dc22db
diff --git a/posthog/temporal/ai/slack_app/activities/classifiers.py b/posthog/temporal/ai/slack_app/activities/classifiers.pyindex 50355b63ab39..cc7cc14a9428 100644--- a/posthog/temporal/ai/slack_app/activities/classifiers.py+++ b/posthog/temporal/ai/slack_app/activities/classifiers.py@@ -243,8 +243,9 @@ def classify_message_is_agent_directed("have stopped tagging it. Decide whether the latest message is an instruction to ""the agent that happens to omit the @mention.\n\n""Answer true only when the message is addressed to the agent:\n"- " - An order or request to do something ('also handle the empty case', 'skip the "- "migration', 'open a PR for that too', 'try again with the other helper').\n"+ " - An order or request to do something, with the agent as the only plausible "+ "audience ('also handle the empty case', 'skip the migration', 'open a PR for that "+ "too', 'try again with the other helper').\n"" - A question put to the agent about its own work ('why did you skip the ""redesign commit?', 'does your PR cover the mobile breakpoint?').\n"" - An answer to something the agent just asked in this thread.\n"@@ -261,6 +262,15 @@ def classify_message_is_agent_directed("the audience.\n"" - Conversation between humans — answering each other, tagging each other, ""deciding something among themselves.\n"+ " - An instruction or request aimed at a named person, even with no @mention "+ "('sam go ahead and add yourself as the owner', 'jake, can you take this one'). A "+ "name in the thread is the audience; an order is not addressed to the agent just "+ "because it is phrased as one.\n"+ " - A request only a person could carry out — joining a call, meeting a customer, "+ "updating an account in a system the agent has no access to — even when it says "+ "'you', and even when it directly follows something the agent said.\n"+ " - Someone taking the work on themselves ('let me fix that', 'I'm on it', 'I'll "+ "take a look'). That stands the agent down; it is not a handoff to it.\n"" - Acknowledgements, praise, and reactions ('thanks', 'lgtm', 'nice', '+1').\n"" - Context dropped into the thread with no instruction attached — a link, a ""stack trace, a screenshot — unless the message asks the agent to act on it.\n"diff --git a/posthog/temporal/tests/ai/slack_app/activities/__snapshots__/test_classify_message_is_agent_directed.ambr b/posthog/temporal/tests/ai/slack_app/activities/__snapshots__/test_classify_message_is_agent_directed.ambrindex db8398790242..9342fa30bdf3 100644--- a/posthog/temporal/tests/ai/slack_app/activities/__snapshots__/test_classify_message_is_agent_directed.ambr+++ b/posthog/temporal/tests/ai/slack_app/activities/__snapshots__/test_classify_message_is_agent_directed.ambr@@ -4,7 +4,7 @@The PostHog agent is working on a task in this Slack thread. People in the thread have stopped tagging it. Decide whether the latest message is an instruction to the agent that happens to omit the @mention.Answer true only when the message is addressed to the agent:- - An order or request to do something ('also handle the empty case', 'skip the migration', 'open a PR for that too', 'try again with the other helper').+ - An order or request to do something, with the agent as the only plausible audience ('also handle the empty case', 'skip the migration', 'open a PR for that too', 'try again with the other helper').- A question put to the agent about its own work ('why did you skip the redesign commit?', 'does your PR cover the mobile breakpoint?').- An answer to something the agent just asked in this thread.- A correction of what the agent said or did ('no, the bug is in the handler, not the wrapper').@@ -13,6 +13,9 @@- Opinions and discussion about the task or the product, addressed to the room ('this needs a stronger label', 'it should probably live under settings', 'I've seen this set back and forth so much'). Relevant to the task is not the same as addressed to the agent.- Talk about the agent in the third person ('why is the bot reacting to me?', 'it keeps replying', 'is it supposed to do that?'). Being the topic is not being the audience.- Conversation between humans — answering each other, tagging each other, deciding something among themselves.+ - An instruction or request aimed at a named person, even with no @mention ('sam go ahead and add yourself as the owner', 'jake, can you take this one'). A name in the thread is the audience; an order is not addressed to the agent just because it is phrased as one.+ - A request only a person could carry out — joining a call, meeting a customer, updating an account in a system the agent has no access to — even when it says 'you', and even when it directly follows something the agent said.+ - Someone taking the work on themselves ('let me fix that', 'I'm on it', 'I'll take a look'). That stands the agent down; it is not a handoff to it.- Acknowledgements, praise, and reactions ('thanks', 'lgtm', 'nice', '+1').- Context dropped into the thread with no instruction attached — a link, a stack trace, a screenshot — unless the message asks the agent to act on it.- Anything off-topic.diff --git a/products/slack_app/evals/eval_followup_classifier.py b/products/slack_app/evals/eval_followup_classifier.pyindex 7395c93aeeff..6150ce10de57 100644--- a/products/slack_app/evals/eval_followup_classifier.py+++ b/products/slack_app/evals/eval_followup_classifier.py@@ -127,6 +127,40 @@ CHATTER_CASES = [prompt="yep, same conclusion I came to",expected=_routes(False),),+ # Orders aimed at a person. The @mention that would settle who is being asked is the+ # first thing people drop once a thread is moving, which leaves the imperative — the+ # shape the agent reads as its own instruction.+ BaseEvalCase(+ name="instruction_to_a_named_human",+ prompt="sam go ahead and put yourself down as reviewer on that PR too",+ expected=_routes(False),+ ),+ BaseEvalCase(+ name="request_only_a_person_can_do",+ prompt="if you could join the call with their eng team tomorrow that would be great too",+ expected=_routes(False),+ ),+ # Someone picking the work up themselves. The agent read this as its own go-ahead and+ # answered to say it was standing aside, which is itself the interruption.+ BaseEvalCase(+ name="colleague_claims_the_work",+ prompt="ah I see what's going on, let me fix that",+ expected=_routes(False),+ ),+ # A proposal put to colleagues mid-debate. Argued and task-relevant, so it reads far+ # more like an instruction than the offhand opinions above do.+ BaseEvalCase(+ name="proposal_in_a_debate",+ prompt="hmm, I'd be more inclined to drop the wrapper entirely and handle it at the call site",+ expected=_routes(False),+ ),+ # A thread kept as a running list. The item carries an implicit work item, which is a+ # sharper lure than a bare link.+ BaseEvalCase(+ name="bookkeeping_entry",+ prompt="https://posthog.slack.com/archives/C123/p456 [email protected]",+ expected=_routes(False),+ ),]