Skip to content

PR review notifications refer to the reviewer by GitHub login even when they are the mentioned Slack user #2248

Closed

Description

@sentry-junior

When someone reviews a pull request that Junior opened for them, Junior's notification can mention that person in Slack and then name them again by their GitHub login, as if they were someone else. Example from a real thread, where the reviewer also asked for the PR:

@BYK BYK approved getsentry/toolkit#1679. Both #1678 and #1679 have since merged.

The reviewer's GitHub account is linked: userLookup with provider: github, query: BYK returns the same Slack user that the message mentions. So the identity link exists; the event path just doesn't use it for the reviewer.

Why it happens

  • normalizePullRequestReviewEvent (packages/junior-github/src/webhooks/events.ts) carries the reviewer only as a raw login inside trustedSummary (... was approved by ${reviewer}, ... received requested changes from ${reviewer}). The same applies to the comment authors in the review-comment and issue-comment normalizers. The event data has no reviewer or actor field.
  • withGitHubPullRequestPeople (packages/junior-github/src/webhooks/pull-request-people.ts) fills people only for pull_request.review.approved and pull_request.merged. It takes them from the PR author, assignees, commit authors and Co-authored-by trailers. It never adds the reviewer as an actor, and it doesn't run for changes-requested, commented or review-comment events.
  • resolveEventPeopleMentions (packages/junior/src/chat/events/people.ts) resolves those people to Slack mentions, and buildTaskInput (packages/junior/src/chat/task-input.ts) renders them only as People involved: <@U…>. Nothing tells the model which mention, if any, belongs to the person who did the action.
  • The model gets People involved: <@U…> and Trusted summary: … approved by BYK with nothing connecting the two, so it writes a third-person sentence about the person it is mentioning.

Proposed fix

  1. Add an optional actor to EventInput in @sentry/junior-plugin-api (e.g. actor?: EventPerson), separate from people. GitHub review and comment normalizers set it from review.user.login or comment.user.login.
  2. In core ingest, resolve the actor through the same linked-identity lookup as people (exact single match only, no guessing).
  3. Render the result in the task input, e.g. Actor: <@U…> (GitHub: BYK). If the actor is also in People involved, say so explicitly (for example Actor is the person being notified).
  4. Update the outcome guidance in packages/junior-github/src/events/pull-request.ts: when the actor is the person being notified, address them as "you" or don't notify them about their own action, and never repeat the mention as a third-person login. Possibly skip approval and review notices entirely when the only recipient is the actor.
  5. Tests: extend webhook-outcomes.test.ts / github-plugin.test.ts with a case where the reviewer's GitHub login links to the requester's Slack user, and add an eval that asserts the notification doesn't name the same person twice.

Related

via BYK.

--

View Junior Session [Sentry]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions