Repository navigation
feat(github): Ask unlinked requesters to connect GitHub after PR creation - #2429
Open
sentry-junior[bot] wants to merge 2 commits into
Open
sentry-junior[bot] wants to merge 2 commits into
sentry-junior[bot] wants to merge 2 commits into
Conversation
…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>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
1 screenshot change — 1 changed · 0 added · 0 removed Review screenshots in Frameshift
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

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
createPullRequestcan'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: addsctx.users.requestConnection(): Promise<boolean>to the tool context. It's provider-neutral and the turn keeps running.chat/plugins/connection-request.ts): implements it withstartOAuthFlow, passing the Slack actor, channel and thread. It returnsfalseand sends nothing in these cases:accounts.user-oauth: false)ctx.state.setIfNotExists. If delivery fails, the key is cleared so a later PR tries again.assignmentNoticeso the agent can tell the requester why the PR is unassigned.Not covered
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.pnpm typecheck, package lint and thejunior-githubtests.via Armen.
--
View Session [Sentry]