Repository navigation
feat(linear): Show live Linear issue cards to viewers - #4331
Merged
Merged
Conversation
Read a Linear issue link as the viewer through the hosted Linear MCP get_issue tool, with one cached read per viewer for the access check and the card. Share the issue card mapping with the save_issue annotation. Co-Authored-By: BYK <[email protected]>
…' into feat/linear-object-links Co-Authored-By: BYK <[email protected]> # Conflicts: # packages/junior-linear/src/plugin.ts
Add an mcp.viewerTools manifest field that names the provider tools a viewer read may call. createViewerMcp allows only those tools, and none when the list is missing. Linear lists get_issue and Notion lists notion-fetch. Name a Linear issue Annotation by Linear's uuid, which stays when the issue moves to another team. Add a mock Linear issue card to the dashboard mock data. Co-Authored-By: BYK <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Co-Authored-By: BYK <[email protected]>
This was referenced Nov 25, 2026
…' into feat/linear-object-links Co-Authored-By: BYK <[email protected]>
… read A Ticket that an older release saved names its subject by identifier. When a viewer's own get_issue read of the card returns the uuid, move those Annotations to it. Core adds replaceSubjectId to the link context: it changes only the subject id of the plugin's own subject kind. A failed move only logs, so the card still shows. Co-Authored-By: BYK <[email protected]>
…' into feat/linear-object-links
After a team move, Linear finds an issue by its old identifier and returns it under the new one. Accept that result when its workspace matches and it has a uuid, and rekey Tickets saved under the link's identifier. An identifier is unique only in one workspace, so replaceSubjectId takes an optional urlPrefix. Core moves only Annotations whose saved url starts with it, and Linear passes the link's workspace.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort 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 e2d78c8. Configure here.
BYK
approved these changes
Nov 25, 2026
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]>
BYK
added a commit
that referenced
this pull request
Nov 25, 2026
…llow renames (#4356) Closes the last GitHub rename gap of the Annotations stack. A GitHub Annotation now names its object by GitHub's id, and a repository rename moves its keys and links. So search by the new name or link finds the object, and a later tool change hits the existing Annotation. ## Core: three provider-neutral methods on `ctx.annotations` Core owns the rows. The plugin owns the GitHub reads. - `listObjects({ after, limit, named })`: the keys of this plugin's Annotations, in key order after a cursor. With `named`, the keys whose subject names a provider id. Else the keys whose subject is only a `link`. - `nameObject(key, { subject, url })`: saves the subject and the current link on each `link` row with that key. The update time stays, so the row keeps its place. - `objectsMoved({ from, to })`: replaces a key prefix (in the column and in the saved Annotation) and a link prefix (links compare without case). A key moves only when its Conversation has no row of the same kind with the new key, so the primary key holds. All three mark the touched Conversations' detail as changed. `upsertPluginAnnotation` now finds the row of its object by subject first. When a tool saves an object under a new key, such as `github_updateIssue` after a rename, the existing row gets the new key and the upsert changes it. Before, the upsert added a second row. If the new key is already taken, nothing is rekeyed. GitHub tools key the Annotation by the repository in GitHub's `html_url`, so a call by a renamed repository's old name keeps the new key. ## GitHub - **Backfill and one-time sweep (`annotation-names.ts`)**: a started task with a payload schema. The heartbeat starts one slice at a time. The task key holds the slice number, and the progress (`pass`, `after`, `slices`, `done`) is kept in plugin state, so the job runs once per install. A slice reads at most 50 objects, by the link when it is a GitHub issue or pull request URL, else by the `owner/repo#n` key. It reads them with one read-only installation token (issues, pull requests, metadata). GitHub's redirect for a renamed repository is followed. - The `named` pass re-reads, once, each object whose Annotations already have GitHub's id. A rename from before this release then moves the repository's Annotations to the new name. - The `unnamed` pass then saves the id and current link of each object that has none. A pull request gets its own id, not its issues-API id. - A 404 or 410 (the object is gone, or the App cannot read it) leaves the row alone, and the cursor moves past it. - Any other error fails the slice, so the queue retries it, after the slice applies the moves it found. On the last delivery, that object is skipped, so one bad object cannot stall the job. - When GitHub answers with another repository name, the task reads the old repository name to tell a rename from a transferred issue. On a rename, the whole repository's Annotations move after the batch. In the `unnamed` pass, the pass then starts over, because the move can give unnamed rows keys before the cursor. Each such move names at least one object, so the restarts end. - **Renames from now on**: a `repository` webhook with `renamed` or `transferred` calls `objectsMoved`. The one-off repository name repair task does too. - **Attached links**: the issue and pull request cards now carry GitHub's id (`id` is added to the cached fields). So a newly attached GitHub link saves a real subject instead of a `link` row that the finished backfill would never see. ## Linear: skipped Old Linear rows keep the identifier (such as `ENG-123`) as `subject_id`. In this stack, the Linear plugin still names new rows by the identifier, because the hosted MCP server gives no other stable id here. The uuid change is in #4331, which is not in this stack. Reading the uuid also needs a viewer's MCP credentials. A background job has no viewer, and `policies/security.md` allows user-owned access only for the current actor or an explicitly delegated subject. So this PR does not borrow a person's credentials for a background read. ## Security This adds one credential path: a read-only installation token (issues, pull requests, metadata) for every repository of the installation. It lives in memory for one slice and is used only for GET requests. It is not scoped to repository names, because a renamed repository's old name fails a name-scoped token request. A breach of the task exposes read access to the installation's issues, pull requests, and repository metadata, which is the same scope as the existing repository name repair token plus issues and pull requests. ## Notes - The App must subscribe to the `repository` webhook event for renames to arrive by webhook. Until then, only the one-time sweep fixes renames. - The sweep reads each GitHub object that an Annotation names once, at 50 a heartbeat. - `objectsMoved` filters by plugin and prefix with no index, so it scans this plugin's Annotation rows once for each rename. Renames are rare. - A transferred issue that already has an id keeps its old key and link. The sweep moves only renamed repositories. The design commit deletes the closed Gap line from `design/annotations.md`. <!-- junior-request-attribution:start --> via @BYK. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:agent%3Aa3cc7ef6c48c45ba1f10a0512784a077 --> -- [View Session](https://junior-prod.sentry.dev/conversations/agent%3Aa3cc7ef6c48c45ba1f10a0512784a077) [[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3Aa3cc7ef6c48c45ba1f10a0512784a077/?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]>
…' into feat/linear-object-links Co-Authored-By: BYK <[email protected]> # Conflicts: # packages/docs/src/content/docs/extend/build-a-plugin.md
…' into feat/linear-object-links Co-Authored-By: BYK <[email protected]> # Conflicts: # design/annotations.md # packages/docs/src/content/docs/extend/build-a-plugin.md # packages/junior-linear/src/plugin.ts # packages/junior/tests/component/linear-native-create.test.ts
The base merged the link search test from #4386 after #4351 made the saved Annotation strict, so its `label` no longer typechecks. Co-Authored-By: BYK <[email protected]>
BYK
added a commit
that referenced
this pull request
Nov 26, 2026
Fixes #4374 Live object cards now read through one HTTP cache that core owns. Before, each provider cached in its own way. A card that a cache serves after its TTL, because a read failed, shows "Last fetched …" again. ## HTTP cache in core `chat/egress/http-cache.ts` keeps provider GET responses in the state adapter. - **Key:** each entry is keyed by credential scope, URL, and `Accept`. Egress entries use the egress credential context as the scope, so a viewer never gets another viewer's entry, and the system Actor never shares one with a viewer. Viewers do share the system Actor's entry for app-credential reads, because those reads are the same for everyone. - **Fresh entries:** within its TTL, an entry serves with no request. - **Stale entries:** an entry past its TTL asks the provider again with `If-None-Match` / `If-Modified-Since`. A `304` stores the entry again. - **Errors:** a network error or 5xx serves the last entry when the link type allows stale. Any other non-200 deletes the entry, so a credential that lost access can never be served it later. - **Limits:** entries stay for TTL + 6 h, and bodies over 256 KiB are not saved. - **Link types:** each link type sets `httpCache: { ttlMs, staleIfError? }` on its definition. The default is 60 s with stale on error. - **Access checks:** `resolveObjectLinkNow` and `viewerCanViewPluginLink` read with TTL 0 and no stale, so a change of access counts at once. The module header states what a breach of this store exposes: up to 6 h of provider reads (card data and plugin webhook reads such as pull requests, commit authors, and collaborator roles), and no token. ## Plugin API - `RouteRegistrationHookContext.httpCache` (`PluginHttpCache`) is for reads with a token that the plugin minted, such as webhook reads. Plugin scopes are namespaced per plugin and never serve stale. - `cacheCards` flips from an opt-out (`false`) to an opt-in (`true`). Only link types that read their provider without egress keep the per-viewer card cache: Slack and Conversation in core, Notion, and Linear (through `viewerMcp`). ## GitHub - Webhook reads go through `ctx.httpCache` with scope `installation:<id>`, TTL 0, and no stale (`installation-http-cache.ts`). `conditional-requests.ts` is deleted. Token narrowing does not change. - GitHub cards read with HTTP TTL 0 and no stale. The object cache and its webhook invalidation stay the freshness layer, so a stale body never gets stored as a fresh object entry. An object-cache entry served after its TTL also sets `fetchedAt`. ## "Last fetched" - `OwnedObjectAnnotation.fetchedAt` is set only when a cache served an entry past its TTL. Its value is the oldest such entry's store time. - The full card footer shows "Last fetched …" when `fetchedAt` is set, so the client needs no TTLs. | | Light | Dark | | --- | --- | --- | | Desktop |  |  | | Mobile |  |  | (Mock dashboard, Notion page card served with a 3-hour-old `fetchedAt`.) ## Linear Whichever of this PR and #4331 landed second adds the `cacheCards` opt-in for Linear's link type. #4331 landed first, so this PR adds it in its own commit, with a stale-on-error test. ## Base This PR targets `feat/github-issue-assignee-items`, because the Annotations stack (#4334, #4340, #4351, #4356) and Linear live cards (#4331) are merged there. It brings that branch in with a merge commit. <!-- junior-request-attribution:start --> via @BYK. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:agent%3A405f29e35c9132aca395b41d3747e969 --> -- [View Session](https://junior-prod.sentry.dev/conversations/agent%3A405f29e35c9132aca395b41d3747e969) [[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3A405f29e35c9132aca395b41d3747e969/?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.

A Linear issue link now resolves to a live card for each viewer, read with the viewer's own Linear login. This is the live resolver that has to exist before saved Linear facts can be dropped from Annotations.
Linear link type (
packages/junior-linear/src/links/issues.ts)linear.app/*/issue/*, with or without the title slug.canViewandresolveshare one cachedget_issueread per viewer (30s TTL). A read is rejected when the issue's workspace or identifier doesn't match the link.issue-card.tsholds the shared issue schema and card builder, whichsave_issueannotations now use too.mcp.viewerToolsmanifest fieldviewerMcpmay call.createViewerMcpallows only listed tools and none when the list is missing. It still requires the provider'sreadOnlyHint.allowed-tools/wrapped-tools).get_issue. Notion listsnotion-fetch, which its page cards and covers already used throughallowedTools.Linear subject id
Mock data
via @BYK.
--
View Session [Sentry]