Skip to content

feat(github): Ask unlinked requesters to connect GitHub after PR creation - #2429

Open
sentry-junior[bot] wants to merge 2 commits into
mainfrom
feat/github-connection-request
Open

sentry-junior[bot] wants to merge 2 commits into
mainfrom
feat/github-connection-request

Conversation

@sentry-junior

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

Copy link
Copy Markdown
Contributor

Junior assigns new pull requests to the requester only when their Slack identity has a linked GitHub account. If no account is linked, the pull request stays unassigned and nobody is told. Requesters then can't find their PRs with assignee: searches, and they don't know the fix is /jr link github.

When createPullRequest can't find a linked GitHub login for the requester, Junior now privately sends them a link to connect GitHub. It uses the existing OAuth flow: an ephemeral message in the thread, or a DM if that fails. The OAuth callback already links the GitHub identity to the user who started the flow, so their next PR gets assigned to them.

Changes

  • @sentry/junior-plugin-api: adds ctx.users.requestConnection(): Promise<boolean> to the tool context. It's provider-neutral and the turn keeps running.
  • Core (chat/plugins/connection-request.ts): implements it with startOAuthFlow, passing the Slack actor, channel and thread. It returns false and sends nothing in these cases:
    • the turn didn't start from a Slack message (automations, events, web, local)
    • the plugin has no OAuth
    • the plugin is service-account-only (accounts.user-oauth: false)
  • GitHub plugin: after it creates the PR and tries assignment, it asks a requester with no linked login to connect.
    • At most one ask per person per day, deduplicated with ctx.state.setIfNotExists. If delivery fails, the key is cleared so a later PR tries again.
    • Best effort: a failure here never fails PR creation.
    • The tool result gets an assignmentNotice so the agent can tell the requester why the PR is unassigned.

Not covered

  • PRs Junior already opened are not assigned retroactively.

Tests

  • junior-github: covers the unlinked-requester case (asks once per day, adds the notice, makes no assign call). Also asserts that a linked requester is never asked.
  • Unit test for the core gating: a Slack message turn sends the link, while non-Slack turns and service-account-only plugins send nothing.
  • Ran pnpm typecheck, package lint and the junior-github tests.

via Armen.

--

View Session [Sentry]

…tion

When Junior opens a pull request for someone with no linked GitHub
account, it cannot assign the pull request to them. Until now this
failed silently, so people did not know why their pull requests were
unassigned or how to fix it.

Add ctx.users.requestConnection() to the plugin tool context. Core
privately sends the Slack actor a link to connect the plugin's OAuth
account through the existing OAuth flow, without pausing the turn. It
sends nothing outside Slack message turns or for service-account-only
plugins.

The GitHub createPullRequest tool calls it when the requester has no
linked GitHub login, at most once a day per person, and returns an
assignmentNotice so the agent can explain the unassigned pull request.

Co-Authored-By: Armen Zambrano Gasparnian <armenzg@sentry.io>
@vercel

vercel Bot commented Oct 30, 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 30, 2026 3:09pm UTC

Request Review

@sentry-evals

sentry-evals Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Sentry Evals

junior-guardian

Run Status Passed Failed Errored Cost Tokens Duration
Head Passed 94 0 0 $0.03 0 30.64s

Base commit cd0acb3 has no eval run to compare against.

@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

1 screenshot change — 1 changed · 0 added · 0 removed

Review screenshots in Frameshift

Conversation Share Details · Desktop
Conversation Share Details · Desktop
Changed

@armenzg armenzg self-assigned this Oct 30, 2026
@armenzg
armenzg marked this pull request as ready for review October 30, 2026 15:01
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Oct 30, 2026

@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 2 potential issues.

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 17a856f. Configure here.

Do not pass the thread to the OAuth flow. With a thread and no paused
turn, the callback posts a public "connected" message there. This
matches the /jr link path.

Release the daily ask key when requestConnection throws, so a failed
ask does not block the next pull request from asking again.

This branch was successfully deployed

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

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant