Repository navigation
feat(github): Ask named people to review a new issue - #4100
sentry-junior[bot] wants to merge 8 commits into
Conversation
github_createIssue gets a review_by input: the people whose review or decision the issue waits on, such as for a design issue or a proposal. The agent leaves it out for tracking issues and bug reports. The GitHub plugin adds one "Review requested" Inbox item for each named person with a linked GitHub account who is in the Conversation. The item closes as done when the issue closes, when that person comments on the issue, or when they react to it. GitHub sends no webhook for reactions, so the plugin heartbeat reads them for recent issues. A reopen does not bring the item back. The plugin tool context gets the Conversation's plugin Inbox items, with a check for which Identities an item can go to, and a found linked handle now carries its Identity. Co-Authored-By: BYK <[email protected]>
…iew-by Co-Authored-By: BYK <[email protected]> # Conflicts: # packages/junior-github/tsconfig.json
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
BYK
left a comment
There was a problem hiding this comment.
Two things:
- I don't want yet another table to keep track of this. Let's try to find a way around this. Can be unification if PR related tables somehow or completely going by the assignee field of the issue as I mentioned earlier
- The display seems like the old PR card where the title is not very helpful. This should be fully aligned with the PRs. Not sure if this deserves a new filter pill yet though as that area is getting crowded. I guess this may be grouped under decisions maybe? If not it should go to Todo or others
|
207 screenshot changes — 207 changed · 0 added · 0 removed Review screenshots in Frameshift Show 12 more changed screenshots189 more changed screenshots in Frameshift. |
…iew-by Co-Authored-By: BYK <[email protected]>
Drop the junior_github_issue_reviewers table and its migration. github_createIssue now assigns each review_by person on GitHub and adds their item. Only review_by adds items, so an assignment that claims an issue adds and closes nothing. A comment closes the commenter's item, and an issue close closes each assignee's item, in the Conversations that the issue's footer names. The reaction poll reads the open issues that Junior opened from junior_github_issues, a few per heartbeat under one lock, and closes the items of assignees who reacted. The dashboard shows an issue review row like a pull request row: the issue title after a Review pill, with its number below. It stays under Other. Co-Authored-By: BYK <[email protected]>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 3 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 ce7526c. Configure here.
github_createIssue now rewrites Slack mentions itself, as github_createPullRequest does, and leaves review_by out of that rewrite. A mention keeps its Slack user ID for the lookup, so an unlinked person is not looked up by name and matched to someone else. The tool also builds its result after the create try block. An auth prompt while it asks for reviews no longer deletes the completed state, so a retry of that tool call does not open a second issue.
…iew-by Co-Authored-By: BYK <[email protected]> # Conflicts: # design/attention.md
…igned Unassigning a reviewer withdraws the ask, so the issues unassigned webhook dismisses that person's Review requested item in the Conversations that the issue footer names. Assigning still adds no item. Co-Authored-By: BYK <[email protected]>
|
Changed in ce7526c:
Since then:
|
BYK
left a comment
There was a problem hiding this comment.
I feel like we should also invest in a GitHub User Id -> Internal Id map in redis or something as this is pretty common op now. The reverse may also be useful. This should be in a follow up.
| item.subject?.objectType === "task" && | ||
| item.title.startsWith("Review requested · ") |
There was a problem hiding this comment.
This looks like a terrible way to identify? Why are we not recording this in objectType or kind or something?
|
Opened #4123 for the GitHub account ↔ Identity map, as a cache layer (state adapter) in front of GitHub and the identity links, not a database mirror of GitHub data. On the inline comment about how issue review rows are identified: this PR will rebuild on the generic Inbox item source refactor, so I'm leaving that code as is until then. |
…e footer (#4132) Stacked on #4128, which adds `scripts/github-state-baseline.json`. This PR removes this table's entry from that file. `junior_github_issues` copies the state of Junior's issues from webhooks. Nothing reads `state`, `state_reason`, `opened_at`, or `closed_at`. The only reader is the close annotation, which fans out to the row's `conversation_ids`. Those ids are also in the issue body footer that Junior writes, and every `issues` webhook carries that body. This drops the table. When a Junior-authored issue closes, the webhook reads the Conversations from its footer and marks the issue closed in each one that already holds a card for it. Guard: a person can edit the footer, so the footer only picks the candidates. The write needs the Conversation's own annotation for the issue key in `junior_conversation_annotations`, which Junior adds when it opens the issue. An edited footer cannot add a card to another Conversation. The issue author must still be the bot. #4100 reads this table for its reaction poll, so it needs another source before it can merge. <!-- junior-request-attribution:start --> via @BYK. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:agent%3Aa74cba793e2579695b0fbabff9e41a78 --> -- [View Session](https://junior-prod.sentry.dev/conversations/agent%3Aa74cba793e2579695b0fbabff9e41a78) [[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3Aa74cba793e2579695b0fbabff9e41a78/?project=4510944073809921) <!-- junior-session-footer:end --> --------- Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: BYK <[email protected]> Co-authored-by: BYK <[email protected]>
Closes #4123 No caller of the GitHub account ↔ Identity mapping calls GitHub. The mapping already lives in `junior_identities`, which OAuth account linking writes (`GET /user`, once). So caching it would save no GitHub call, and lookups already work while GitHub is down. The real costs are Postgres (Identity → User reads) and Slack (resolving a named person in `findLinkedHandle`). This PR caches both in the state adapter. A miss still reads Postgres and Slack as before. **Identity → User.** `readIdentityByIdFromSql` reads through the existing user cache in `chat/identities/user-cache.ts`. That covers `loadGitHubLogin` in the GitHub webhooks, work owners, Inbox items, and `readActorIdentity`. A new `identity:{id}` entry maps an Identity to its User id. A linked Identity never moves to another User, so this entry stays valid. The User entry is versioned and cleared on every Identity write, as before. Unlink deletes the Identity, so the cached User no longer has it, and the read falls back to SQL. **`findLinkedHandle`.** A `found` result is cached by provider, team, providers, and query, with stale-if-error. Other answers (`unlinked`, `not_found`, `ambiguous`) are never cached, because they can change when a person joins or links an account. A per-provider version clears every cached handle of that provider. Each Identity write that changes a lookup column (User, handle, or verified email) bumps the version, and so does unlink. Writes that change none of these, such as the actor of each message, do not bump it. TTLs and stale window: - Identity → User id: 24 h for a linked Identity, the same safety net as the user cache. 60 s for an Identity without a User. A write that gives an Identity a User clears that entry. - User and their Identities: unchanged (24 h, cleared on write). - Linked handle: fresh for 1 h. A link change clears it at once, so the TTL bounds only Slack directory changes, such as a new person with the same name. When Slack fails, the last found handle serves for up to 24 h after the TTL. - Reads in the first 10 s after a write do not fill either cache, as the user cache already does. `review_by` resolution in #4100 (`tool-support/issue-reviewers.ts`) should go through `ctx.users.findLinkedHandle` when it rebuilds, so it gets this cache. <!-- junior-request-attribution:start --> via @BYK. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:agent%3A0cb2154446e60476068694fc5d524147 --> -- [View Session](https://junior-prod.sentry.dev/conversations/agent%3A0cb2154446e60476068694fc5d524147) [[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3A0cb2154446e60476068694fc5d524147/?project=4510944073809921) <!-- junior-session-footer:end --> --------- Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: BYK <[email protected]>
|
Replaced by #4308: GitHub assignees now drive the issue's Inbox item, so |
…4305) When Junior hands a decision back to the requester in a pull request comment, the requester gets no Inbox item, and the pull request leaves Code · Mine. This happens in two ways. **Inside a change request.** Only Junior's mark asks the requester to review again (`pull-request-review-again.ts`). The event guidance said to mark a comment only "after acting on actionable feedback or answering a question". So a reply that pushed back, deferred, or left the decision to the reviewer left the comment unmarked. Examples: getsentry/devinfra-deployment-service#1019 (review body answered with a disagreement, unmarked) and #4100 (inline comment deferred to a later refactor, unmarked). **Outside a change request**, such as a reply to a comment-only review. A comment-only review ends GitHub's review request, so the next action ends too. A question back to the requester then has no signal, and a child agent cannot add an Inbox item. ## Changes - `events/pull-request.ts`: the feedback guidance says to mark a comment after Junior acts on it or replies to it, also when Junior pushes back, defers, or answers with a question. - `github_updatePullRequestFeedback`: the `status` param says what each value means. "declined" covers push-back, deferral, and a decision left to the author. - `github_commentOnPullRequest`: new `asks_requester` param. When it is true, the tool asks the person who asked Junior for the pull request for a review on GitHub, and returns `requester_asked`. It asks only when Junior opened the pull request for the person whose work the Turn does, and that person has a linked GitHub account. - `design/github.md`: a comment that Junior pushes back on or defers is declined, and a question to the requester in a PR comment asks for their review on GitHub. - Evals in `pull-request-reviews.eval.ts`: a pushed-back change request is marked declined, and a comment-only review is answered with `asks_requester` only when the requester asked to decide. ## Design The review request carries the signal, so `pull-request-action.ts` does not change. GitHub's `review_requested` webhook already makes the next action "review" when the requester has not acted since they were asked. That shows the pull request's one `pull-request-action:` item, with the pull request as its subject, assigned to the requester. GitHub also notifies them. When they review, GitHub ends the request, and the item closes. No new item stream, table, or state key. A "reply" action from Junior's latest comment would not work, because the derivation cannot tell whether a comment asks the requester something. Every "Fixed in abc" reply would ask them. Trade-offs: - The item text is the general "GitHub asks you to review #N." A text for a question needs a new reason in `pull-request-action.ts`, and that file is in stack getsentry/junior#4307. - A plain comment reply from the requester does not end GitHub's review request, so the item stays until they review. Review requests from GitHub already work this way. <!-- junior-request-attribution:start --> via @BYK. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:agent%3Aeb8917bd0ee6f1c48d0ea567d9aab5d9 --> -- [View Session](https://junior-prod.sentry.dev/conversations/agent%3Aeb8917bd0ee6f1c48d0ea567d9aab5d9) [[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3Aeb8917bd0ee6f1c48d0ea567d9aab5d9/?project=4510944073809921) <!-- junior-session-footer:end --> --------- Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: BYK <[email protected]>

A pull request that Junior opens becomes an Inbox item by itself, because GitHub sends a review request. An issue gets nothing, but not every issue is for a person to act on: a bug filed for tracking is not. So the trigger is explicit and the item is deterministic.
Tool
github_createIssuegets areview_byinput: the people whose review or decision the issue waits on. The tool text tells the agent to set it for design issues and proposals, and to leave it out for tracking issues and bugs. People resolve the waygithub_createPullRequestresolves reviewers (GitHub logins, emails, Slack mentions, or names) to a linked GitHub account. Likegithub_createPullRequest, the tool rewrites Slack mentions in its own text and leavesreview_byout, so a mention keeps its Slack user ID for the lookup. The tool assigns each person on the issue, so GitHub shows whom it waits on, and adds their items. The result listsreview_requestedlogins andreview_left_outpeople with a reason: no match, more than one match, no linked GitHub account, not in the Conversation, or GitHub did not assign them. The review requests run after the issue's idempotency state is saved, so a failure there cannot open a second issue on retry.Items
The GitHub plugin adds one "Review requested · #N" item for each assigned person, with the issue as its subject and the dedupe key
issue-review:{repo}#{number}:{login}in the plugin's namespace. Onlyreview_byadds items. An assignment that claims an issue (github_updateIssuewithassign_requester) adds nothing, and a close for a person who has no item does nothing. There is no new table or column. The item closes as done when:issueswebhook),issue_commentwebhook), orjunior_github_issues), under one lock with a saved cursor. It reads the reactions only of an issue with assignees and reactions, and repeat reads are conditional.Unassigning a person withdraws the ask, so the
issuesunassignedwebhook dismisses their item. Webhooks find the item's Conversations in the issue's footer. A reopen does not bring an item back. Dismiss and Snooze stay generic.Core contract
inboxItems, the plugin Inbox items of the Conversation, withassignable(identityIds). It uses core's existing rule that a plugin item goes only to people in its Conversation, so the tool can say who is left out.foundresult offindLinkedHandlenow has theidentityId.Design
design/github.mdgets one rule: an issue that Junior opens for a person's review is an action for that person, and it closes when the issue closes or when they respond on it.Dashboard
An issue review row shows like a pull request row: the issue title after the Review pill, with its number below. It gets no new pill and stays under Other, not PRs.
via @BYK.
--
View Session [Sentry]