Skip to content

fix(slack): Keep Slack mentions typed and tell Junior its own user ID - #2108

Merged
dcramer merged 5 commits into
mainfrom
fix/slack-mention-identity
Oct 13, 2026
Merged

dcramer merged 5 commits into
mainfrom
fix/slack-mention-identity

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

Junior thanked itself as @U0AGGRG1V0X in a public thread. A user wrote "a nice discussion with <@junior>", and Junior replied with "shout-out to @U0AGGRG1V0X". The reply showed the raw ID as plain text.

Three separate gaps caused this, and the same gaps apply to every person and channel mention:

  • Inbound: Junior parses messages with the SDK's sync parseMessage, which flattens <@U123> to @U123 and <#C123|name> to #name, with no name lookup. The agent sees a bare ID that it cannot classify. Slack tools return <@U123>, so the same person also shows up in two different forms. This is also the cause of Slack channel mentions lose their entity type #1996 (a channel ID taken for a Sentry issue ID).
  • Identity: the prompt gives Junior its username but not its user ID, so it cannot tell that a mention of itself is about itself.
  • Delivery: replies go out as markdown blocks through chat.postMessage and skip the SDK's bare-mention rewrite. So @U123 in a reply shows up as literal text, but <@U123> renders correctly (other Junior replies confirm this).

Changes:

  • parseContent restores the <@U…> / <#C…|name> tokens from the raw event text. This is the one projection used for the current instruction, queued and steering messages, stored history, Briefs, and memory.
  • The runtime context now includes slack.bot_user_id, and the identity section says that a mention of that ID refers to Junior.
  • Reply normalization turns a bare @U123 / @W123 user ID outside code into <@U123>.

This also does the "delivery-time mention normalize" step that was planned in #1163 but never shipped. The new behavioral eval checks that Junior recognizes a mid-message mention of itself and does not repeat its ID.

Refs #1996

via David Cramer.

--

View Junior Session [Sentry]

The Slack SDK flattens <@u123> to @u123 in inbound text, so the agent saw
bare IDs it could not identify, including its own. It then echoed them,
and replies posted through the markdown block showed the ID as literal
text.

Keep <@u123> and <#C123|name> tokens in agent-visible text, give the agent
its Slack user ID in runtime context, and turn bare @u123 IDs in replies
into real mentions.

Refs #1996

Co-Authored-By: David Cramer <[email protected]>
@vercel

vercel Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
junior-docs Ready Ready Preview Oct 13, 2026 10:00pm UTC

Request Review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 03d08e1. Configure here.

The behavioral evals recorded these model responses in https://github.com/getsentry/junior/actions/runs/38470392020.
The evals of this commit replay them in strict mode.

Eval-Suite: behavioral
@sentry-evals

sentry-evals Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Sentry Evals

junior-behavioral

Run Status Passed Failed Errored Cost Tokens Duration
Head Complete 64 9 1 $0.76 0 265.99s

Base commit 4fa904a has no eval run to compare against.

junior-guardian

Run Status Passed Failed Errored Cost Tokens Duration
Head Complete 53 0 5 $0.01 0 1.63s

Base commit 4fa904a has no eval run to compare against.

junior-integration

Run Status Passed Failed Errored Cost Tokens Duration
Head Complete 91 4 0 $0.48 0 170.30s

Base commit 4fa904a has no eval run to compare against.

junior-router

Run Status Passed Failed Errored Cost Tokens Duration
Head Complete 12 0 0 $0.00 0 0.26s

Base commit 4fa904a has no eval run to compare against.

Replace the regex repair of SDK-flattened mentions with a conversion that
keeps <@U…> and <#C…> tokens out of the SDK mrkdwn conversion, so the
agent gets the exact tokens Slack sent. Tighten the prompt and README text.

Co-Authored-By: David Cramer <[email protected]>
@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

3 screenshot changes — 3 changed · 0 added · 0 removed

Review screenshots in Frameshift

Automation Editor Conflict · Mobile
Automation Editor Conflict · Mobile
Changed
Automation Versions · Desktop
Automation Versions · Desktop
Changed
Automation Versions · Mobile
Automation Versions · Mobile
Changed

The behavioral evals recorded these model responses in https://github.com/getsentry/junior/actions/runs/38472891384.
The evals of this commit replay them in strict mode.

Eval-Suite: behavioral
The integration evals recorded these model responses in https://github.com/getsentry/junior/actions/runs/38472891356.
The evals of this commit replay them in strict mode.

Eval-Suite: integration
@dcramer
dcramer merged commit 63b1e11 into main Oct 13, 2026
52 of 55 checks passed
@dcramer
dcramer deleted the fix/slack-mention-identity branch October 13, 2026 22:40
sentry-junior Bot added a commit that referenced this pull request Oct 13, 2026
Main changed the system prompt in #2108, so these recordings no longer match.
CI records them again for this branch.

Co-Authored-By: David Cramer <[email protected]>

This branch was successfully deployed

1 active deployment
Preview – junior-docs — 11253329 Deployed Oct 13, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: high PR risk score: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant