Repository navigation
feat(identities): Link OAuth accounts from web connections and verified emails - #2201
Merged
Merged
Conversation
…ed emails Link provider identities when a connection starts from the web UI, not only Slack. Let plugins report provider-verified emails so an account can link through a matching user email. GitHub reads verified emails from /user/emails when the App has the Email addresses permission. Sentry reads the authorized user from its OAuth token response. Refs #2200 Co-Authored-By: Burak Yigit Kaya <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit cfde518. Configure here.
Verified emails only help link the account. A failed /user/emails call now logs a warning and resolves the account without emails.
This comment has been minimized.
This comment has been minimized.
BYK
reviewed
Oct 21, 2026
dcramer
approved these changes
Oct 22, 2026
BYK
added a commit
that referenced
this pull request
Nov 12, 2026
## Problem Agent replies and Review item bodies contain many bare URLs, such as `https://github.com/getsentry/junior/pull/3245`. The dashboard shows them as long raw links, also when the Conversation already has a saved Annotation for that object. A "Ready to merge" notice ends with the pull request URL, and the same pull request also shows as a separate subject. ## Fix Display text now uses the Annotations that are already on the client. A link whose URL is the canonical URL of an Annotation renders as follows: - **Inline:** a bare URL in a sentence, a list item, or a quote is a compact chip: object icon, label, and status (for example `#2201 · Draft`). The chip opens the URL. - **Block:** a bare URL alone in a top-level paragraph is the full `ObjectCard`. - **Labeled link:** `[text](url)` keeps its text. - **Hover:** each chip and labeled link shows the `ObjectCard` in a Base UI preview card. - **Dedupe:** the Review item details hide the "Subject" card when the body already shows the full card for the subject. A chip does not hide it. URL matching is exact on the Annotation `url`, with a trailing slash dropped. Links to a comment (`#discussion_r1`) or another page (`/files`) stay plain. The client does not parse provider URLs. Links to unknown objects do not change. Sources of known objects: - Transcript: the Annotations of the Conversation (`ConversationTranscriptView`). This includes Review item excerpts. - Review item card, view, and details: the Annotations of the Conversation that added the item, read from the query cache only (`ReviewItemObjects`). This does not start a fetch. `annotationCard` is now exported from `@sentry/junior/api/schema`, so resource links and objects map to one card shape. ## Limits - A Review item from a Conversation that the page did not load shows plain links, because the cache has no Annotations for it. - The "Ready to merge" body has the URL inside a sentence, so it shows a chip, and the Subject card stays. The Subject card hides only when the body has the URL in its own paragraph. - The dedupe check (`textHasStandaloneUrl`) reads paragraphs from the text. The renderer reads the Markdown tree. The two agree for plain paragraphs. In rare cases, such as an indented code block, the Subject card stays visible. - On main, no Review item surface shows the subject as a full object card. #3035 adds one (`ReviewItemSubjectPreview`). It can call `useTextShowsObjectCard` to hide it. - A preview card opens on hover and on focus. Touch screens do not open it. ## Tests - Unit (`tests/displayText.test.tsx`): a bare URL in a sentence, a list, and a quote becomes a chip. A bare URL alone in a paragraph, or as an autolink, becomes the card. `[text](url)` keeps its text. Unknown objects and other pages of a known object stay plain. `textHasStandaloneUrl` ignores code fences and inline URLs. - E2E (`e2e/conversation-object-links.spec.ts`): on the mock release Conversation, a bare PR URL in a sentence is a chip, a known PR URL on its own line is the card, and a hover on a labeled link opens the card. - The mock release Conversation reply now links to its three Annotations. - `pnpm typecheck`, `pnpm lint`, `pnpm file-length:check`, dashboard unit tests (451 passed), and the full dashboard e2e suite (158 passed, 1 skipped). ## Screenshots Mock mode, desktop. ### Inline chip and block card in a message | | Before | After | | --- | --- | --- | | Dark |  |  | | Light |  |  | ### Hover card on a `[text](url)` link Before, the link had no hover card. | Dark | Light | | --- | --- | |  |  | ### "Ready to merge" notice (body from `pull-request-ready.ts`) The bare URL is now a chip in the notice and in Details. | | Before | After | | --- | --- | --- | | Dark |  |  | | Light |  |  | ### Notice with the URL in its own paragraph (Subject card hidden) | | Before | After | | --- | --- | --- | | Dark |  |  | | Light |  |  | <!-- junior-request-attribution:start --> via @BYK. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:agent%3A855c2183278ba7c87a4c8a07cb5fd6e2 --> -- [View Session](https://junior-prod.sentry.dev/conversations/agent%3A855c2183278ba7c87a4c8a07cb5fd6e2) [[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3A855c2183278ba7c87a4c8a07cb5fd6e2/?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]>
BYK
added a commit
that referenced
this pull request
Nov 12, 2026
… small font sizes (#3305) ## Problem - The "Linked work" tooltip always opens upward. Base UI moves it to the other side only when it does not fit above. So the tooltip covers the rows above the trigger, even when there is much more space below it. - On `main`, the tooltip does not open on Code repository rows. The row is one stretched link, and its content has `pointer-events-none`. The link takes the hover, so the trigger never gets it. - The chip clips its object icon at a small root font size. The icon row is `h-3.5` (0.875rem), but `ObjectIcon` is a fixed 14px. At a 14px root, the row is 12.25px high and cuts the top and bottom of the icon. At a 16px root, the two sizes are equal, so the problem does not show. ## Fix - When the tooltip opens, it goes to the side of the trigger with more space: top or bottom. Only this tooltip changes, because other `TooltipContent` users set `side` on purpose (for example `WaitingChip` uses `right`). The `max-h-80` scroll list stays. - The trigger sets `pointer-events-auto`, so it gets the hover in rows with a stretched link. The rest of the row still opens the Conversation. - The chip's `ObjectIcon` gets `size-3.5`, so it scales with the row. - Checked at 14px and 16px roots: - **Status icons (11px):** they fit in the chip row. - **Mobile facepile:** the discs, icons and the `+N` badge all use px sizes, so they do not clip. - **Desktop `+N` badge:** it is `h-5` in rem, so it scales with the row. - **Fixture:** one mock row annotation (`#2201`) now has `objectType` and `status`, so the mock data shows the 14px `ObjectIcon`. ## Tests - **E2E:** `code.spec.ts` adds a test that sets a 14px root. A trigger with more space below opens down, and one with more space above opens up. The test reads Base UI's `data-side`. Without the fix, the "down" case fails: expected `bottom`, got `top`. - **No e2e test for the clipped icon:** `test-architecture:check` does not allow layout checks in dashboard e2e (`boundingBox`, `getBoundingClientRect`, `toHaveCSS`). `policies/testing.md` says to QA visual changes manually and attach visual evidence. A one-time Playwright check at a 14px root measured a 14px icon in a 12.25px row before the fix, and a 12.25px icon after it. - **Checks:** `pnpm typecheck` and `pnpm lint` pass. The full dashboard e2e suite passes: 160 passed, 1 skipped. ## Screenshots These were taken on a Code repository row at device pixel ratio 2. The tooltip shots use a 1400×1300 window, where the trigger has more space below. The "before" tooltip shots include the `pointer-events-auto` change, because without it the tooltip does not open on `main`. ### Chip icons | Root | Theme | Before | After | | --- | --- | --- | --- | | 14px | Dark |  |  | | 14px | Light |  |  | | 16px | Dark |  |  | | 16px | Light |  |  | At a 16px root, the before and after images are identical. ### Linked work tooltip | Root | Theme | Before | After | | --- | --- | --- | --- | | 14px | Dark |  |  | | 14px | Light |  |  | | 16px | Dark |  |  | | 16px | Light |  |  | <!-- junior-request-attribution:start --> via @BYK. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:agent%3A855c2183278ba7c87a4c8a07cb5fd6e2 --> -- [View Session](https://junior-prod.sentry.dev/conversations/agent%3A855c2183278ba7c87a4c8a07cb5fd6e2) [[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3A855c2183278ba7c87a4c8a07cb5fd6e2/?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]>
BYK
added a commit
that referenced
this pull request
Nov 14, 2026
…ard height stable (#3413) Saved object cards said "Latest saved state", which tells the reader nothing. They now say **Last fetched 5 minutes ago** (relative time from the Annotation's `updatedAt`, absolute time on hover). Live cards show no fetch time, because they were just fetched. A hover card for a link that has only a saved link Annotation (common for GitHub PRs) first shows the sparse saved card. Then it swaps to the live card when `/api/objects` answers. The height changed (167px → 221px in the mock), so the popup jumped. That hover card now has a fixed height (`min(22rem, available height)`) while the live card can still replace it, and it keeps that height after the swap. The card body scrolls when it is taller, and the footer stays at the bottom. If the live fetch finishes without a card, the saved card goes back to its natural height. Other hover cards never swap, so they keep their natural height. Preview images and the new fetch time come from one `SavedObjectsContext`, which replaces `ObjectPreviewImagesContext`. ## Screenshots Mock dashboard. `/api/objects` is delayed 6s and returns a live PR card for `#2201`. **Before**: the popup grows when the live card arrives.  **After**: same height in both states.  ## Not covered - The link text still changes from the label to the live title (`#2201` → `Update Junior to 4.2 after the release (#2201)`). This moves the anchor, so the popup still shifts sideways. - Standalone inline cards (a link alone on its line) still grow when the live card replaces the saved one. A fixed height there would leave big gaps in the transcript. <!-- junior-request-attribution:start --> via @BYK. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:local%3Aweb%3A38ca34424e6025ca446d8a2f --> -- [View Session](https://junior-prod.sentry.dev/conversations/local%3Aweb%3A38ca34424e6025ca446d8a2f) [[Sentry]](https://sentry.sentry.io/explore/conversations/local%3Aweb%3A38ca34424e6025ca446d8a2f/?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]>
BYK
added a commit
that referenced
this pull request
Nov 25, 2026
) An Annotation kept a copy of its object's label, state, description, and facts, and only webhooks kept that copy current. Now it stores the subject, the title, and the link. A card reads every other fact live, and the plugin makes the short label from the link. This closes the "An Annotation keeps a copy…" Gap in `design/annotations.md`. The Gap line is removed in its own commit. ## Storage - `junior_conversation_annotations` gets the `title` and `url` columns. The migration fills them from the JSON and removes `title`, `url`, `label`, `status`, `description`, `facts`, `sourceUpdatedAt`, `warning`, `trigger`, and `displayType` from `annotation_json`. - Old workers keep writing the old JSON during rollout. A new trigger, `junior_conversation_annotations_stored_fields`, moves the title and the link to the columns and removes the dropped keys. Triggers run in name order, so it runs after the legacy subject trigger, which still reads the old JSON. That trigger now also reads the link from the `url` column. - Search and the subject filter read the `title` and `url` columns. `storedAnnotationTitle` and `storedAnnotationUrl` are gone. - **The primary key stays `(conversation_id, plugin, kind, key)`, and there is no unique index on the subject.** Old workers' `ON CONFLICT` targets that key. Also, two rows of one Conversation can share a subject: a renamed repository gives a new key for the same object, and a `link` subject comes from the URL, so an attached link and a typed object can name the same thing. Legacy Slack card refs (a plugin + key digest) and old Message refs `{plugin, key}` resolve by key, so `key` stays. ## Plugin API and writers (hard cutover) - `objectAnnotations` entries and `PluginConversationAnnotations.upsert` take `savedObjectAnnotationSchema`: `{kind, key, subject?, objectType, title, url}`. `resourceLinkAnnotationSchema` is `{kind, objectType?, key, url}`. Both are strict, so a plugin that still sends a dropped field fails at the boundary. - `ObjectAnnotation` stays the live card shape that link types return. The new `LiveAnnotation` is the card or the label fallback that a viewer sees, and the sidebar hook gets it. - Updated writers: GitHub (create/update issue and pull request), Linear MCP, Google Calendar (create, update, cancel), Vercel deployments, core Automations, and attach. GitHub's live card comes from `githubObjectCard` in `issue-links.ts`. The create-tool replay states still accept the old fact fields as optional, because states saved before this change can still be replayed. - `build-a-plugin.md` describes what an Annotation stores. ## Readers - **Fallback card** (no access, provider down, failed read): the label from the plugin's link type, or else the link's host, or else the object type name, plus the link. The delivered Message card snapshot also posts the stored title, as before. - **Model metadata** (prompt tags and tool results that list Annotations) and search results get the label from the plugin. The label loads lazily (`chat/conversations/annotation-labels.ts`), because the link types import the app and the app imports the tools that save Annotations. - **Automations get a live source.** A new core link type (`api/objects/automation.ts`, `/automations/*`, not cached) reads the Automation from the database with the Automations view's access rule. The card shows the live status, trigger, and warning. `automationCardStatus` moved to `chat/automations/card.ts`. - **Legacy untyped `link` rows, and plugins without a link type, get the label-only fallback.** Today that means Vercel deployments, and Linear until its link type (#4331) lands. - The dashboard Linked work list shows a `resource_link` row as the label and the link, and asks for its live card. The client no longer reads the dropped fields. ## `annotation-fields:check` `scripts/check-annotation-fields.mjs` runs with the other checks in `scripts/check.mjs`. Its baseline is `scripts/annotation-fields-baseline.json`. It fails when: - a table column or a saved-schema field is not in the baseline, or - source reads a dropped field from the stored JSON (`annotation_json->>'status'`, `${annotations.annotation}->'facts'`, and so on). The baseline-growth check finds the baseline by its name, so the baseline can only shrink. ## Screenshots Linked work on a mock Conversation. #2201 and getsentry/relay#44 are label-and-link rows. getsentry/payments#91 is a live card. | | Light | Dark | | --- | --- | --- | | Desktop |  |  | | Mobile |  |  | ## Rollout risks - The migration removes the fields from the JSON. Until the deploy finishes, old readers show Annotations without the label, state, or facts. - Vercel deployment cards show only the link's host, because Vercel has no link type. - Linear cards show only the link's host until #4331 merges. Expect a conflict in `junior-linear/src/plugin.ts`. - A delivered Automation card reads the Automation with the access of the person who started the Conversation. An Automation run Conversation has no such person, so its delivered card uses the fallback. <!-- junior-request-attribution:start --> via @BYK. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:agent%3A883547fc43df31312aaeda4c4dbbb06a --> -- [View Session](https://junior-prod.sentry.dev/conversations/agent%3A883547fc43df31312aaeda4c4dbbb06a) [[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3A883547fc43df31312aaeda4c4dbbb06a/?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]>
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.

Provider accounts only linked to a person when the OAuth connection started from Slack and the plugin resolved the account. Connections from the dashboard or web UI never linked, and Sentry never resolved an account. This PR covers the first part of #2200.
resolveOAuthAccountcan returnverifiedEmails. Junior uses them only to link the account and never stores them with the tokens. The actor's user still wins. When the actor has no user (for example, a Slack profile without an email), the account links to the one user whose primary email matches. A matching verified email is saved on the provider identity.GET /user/emailsand keeps only the verified addresses. GitHub App user tokens need the App's Email addresses: Read account permission for this call. Without it, GitHub returns 403 and Junior links through the actor only, as it did before. The setup docs mention the optional permission.resolveOAuthAccountfrom theuserobject in its OAuth token response, because/api/0/users/me/rejects OAuth app tokens. Sentry does not say whether that email is verified, so it is only a label and never links the account. The hook context now includes the parsedtokenResponsefor this.Not in this PR: backfilling connections made before identity linking existed. Those users need to reconnect for now.
Refs #2200
via BYK.
--
View Junior Session [Sentry]