Skip to content

feat(agent): tell Slack-bound agent to echo labeled mention tokens#2676

Open
VojtechBartos wants to merge 1 commit into
mainfrom
vojtab/slack-label-prompt
Open

feat(agent): tell Slack-bound agent to echo labeled mention tokens#2676
VojtechBartos wants to merge 1 commit into
mainfrom
vojtab/slack-label-prompt

Conversation

@VojtechBartos

Copy link
Copy Markdown
Member

Problem

Slack only renders <@U_ID|displayname> (or bare <@U_ID>) as a real ping. When the agent writes plain @displayname text in its reply, Slack treats it as text — the user it's referring to doesn't get notified.

The PostHog/posthog companion PR (PostHog/posthog#63495) makes the backend deliver Slack's labeled wire form <@U_ID|displayname> in the message context the agent sees. This PR closes the loop on the agent side: tell it to copy that token verbatim into its reply.

Changes

Add a one-paragraph instruction to the Slack-origin system prompt (next to the existing # Response Style section):

# Mentioning users
When you want to ping a Slack user in your reply, copy their `<@U…|displayname>` token verbatim from the message context — Slack renders that as a real mention. Writing `@displayname` as plain text does NOT ping them.

Only added when getCloudInteractionOrigin() === "slack", so non-Slack interactions are unaffected.

How did you test this?

Manual: end-to-end test from a Slack thread where the user @-mentions someone. With backend PR + this prompt change in place, the agent's reply renders mentioned users as actual Slack pings. Without the prompt change, the agent tends to paraphrase to plain @name and the ping is lost.

No automated tests added — the change is in a string literal.

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

Slack only renders `<@U_ID|displayname>` as a real ping; plain `@displayname`
in agent output stays as text. The token arrives in the user's message
context already labeled (the backend resolver enriches it before the agent
sees it), so the agent just needs to copy it back verbatim.
@github-actions

github-actions Bot commented Jun 15, 2026

Copy link
Copy Markdown

React Doctor found no issues in the changed files. 🎉

Reviewed by React Doctor for commit cdb38ee.

@greptile-apps

greptile-apps Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "feat(agent): tell Slack-bound agent to e..." | Re-trigger Greptile

@VojtechBartos VojtechBartos self-assigned this Jun 15, 2026
@VojtechBartos VojtechBartos requested a review from a team June 15, 2026 15:15
@VojtechBartos VojtechBartos marked this pull request as ready for review June 15, 2026 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants