Skip to content

feat(annotations): Store only the title and the link of an object - #4351

Merged
BYK merged 25 commits into
feat/github-issue-assignee-itemsfrom
feat/annotation-drop-facts
Nov 25, 2026
Merged

BYK merged 25 commits into
feat/github-issue-assignee-itemsfrom
feat/annotation-drop-facts

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

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 (feat(linear): Show live Linear issue cards to viewers #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 light desktop dark desktop
Mobile light mobile dark 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 feat(linear): Show live Linear issue cards to viewers #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.

via @BYK.

--

View Session [Sentry]

sentry-junior Bot and others added 19 commits November 25, 2026 14:27
An Annotation now stores the subject of its object, in the Inbox form
(`<plugin>:<kind>` or a core kind), and what the Conversation did to it:
created, changed, or attached. Tool and hook results name the subject and
the action, with the kinds that the plugin registers in `inboxSubjects`.
The subject replaces `objectId`, and the Inbox owner lookup reads it. A
trigger fills both columns for rows that old workers write, and for
objects whose provider id is not known.

Also adds the Annotations design doc and its terms.

Co-Authored-By: BYK <[email protected]>
Cards read the object live, so a merge, a close, or a new pull request
body changes no Annotation. The GitHub plugin no longer updates the
status of pull request and issue cards, or their preview images, from
webhooks and the daily reconcile. A conversation change batch now holds
only Inbox item closes.

Co-Authored-By: BYK <[email protected]>
A core Annotation, such as an Automation card, stores its subject kind
without a plugin prefix, so listing it dropped the subject.
Sidebar chips, the Conversation detail, and Slack card details now read
each object's title and state live, through the same subject-to-link-to-
card resolver as the Inbox. A viewer who cannot read the object, or a
failed read, gets only the stored label and link. A delivered Message
card reads its object once with the access of the person who started the
Conversation, and falls back to the saved facts.

The dashboard drops its client-side annotation overlays and renders the
server's cards. Preview images come from the live card.

Co-Authored-By: BYK <[email protected]>
…' into feat/annotation-live-cards

Co-Authored-By: BYK <[email protected]>

# Conflicts:
#	packages/junior/tests/integration/annotation-cards.test.ts
…ved label

A card no longer shows an Annotation's stored label. It shows the label
of the live card, or, when Junior cannot read the object, the label
that its link type makes from the link. Link types get an optional
`label(url)` method. GitHub issue and pull request links make
`owner/repo#n`. A link type without one shows the host of the link.

Co-Authored-By: BYK <[email protected]>
Cards read their object live, so a merge wrote nothing and an open page
kept the old card. Plugins now report a changed object with
ctx.annotations.objectChanged(subject). Core moves detail_version of
each Conversation that annotates it, so the detail ETag and the versions
poll change. It writes no Annotation. GitHub calls it from issue and pull
request webhooks when the cached object changed.

The detail annotation tests move to their own file.

Co-Authored-By: BYK <[email protected]>
A check event marks the checks pending, a review clears the cached
decision, and a patch fills in merge state and check counts. Each now
calls objectChanged when it changes the entry, as pull request and
issue webhooks do. The patch read asks GitHub for the pull request id.
Dashboard search matches the stored title, key, and link of an
Annotation. A typed `<repository>#<number>` reference, or a link that a
plugin link type names that way, resolves to a code change subject
through the code change records, which follow repository renames. So a
renamed repository's pull request is found by its new name without a
provider call.

The searchConversations and Slack message search `annotation` filters
use the same resolution. Plugin `conversations.search` takes the
object's subject instead of a key, and github_getPullRequest finds
related conversations by the pull request's GitHub id.

Co-Authored-By: BYK <[email protected]>
…' into feat/annotation-subject-search

Co-Authored-By: BYK <[email protected]>
A word that every link holds, such as pull or github.com, matched each
annotated Conversation.
Annotations now store only the title and the link of an object. Cards
read the rest live.

Co-Authored-By: BYK <[email protected]>
An Annotation stored a copy of the label, the state, and other facts of
its object, and only webhooks kept that copy current. It now stores the
subject, the title, and the link. The title and the link are columns, so
search reads them directly. Cards read every other fact live, and the
plugin makes the label from the link.

Old workers still write the old JSON during rollout. The trigger fills
the new columns from it and strips the dropped keys.

Automation cards read the Automation from the database through a core
link type. An Annotation whose plugin has no link type shows its label
and its link.

The annotation-fields check fails when a column or a saved field is not
in its baseline, or when code reads a dropped field from the stored JSON.

Co-Authored-By: BYK <[email protected]>
…into feat/annotation-drop-facts

Co-Authored-By: BYK <[email protected]>

# Conflicts:
#	packages/junior/src/api/conversations/list.ts
@sentry-junior
sentry-junior Bot requested a review from BYK November 25, 2026 18:49
@vercel

vercel Bot commented Nov 25, 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 Nov 25, 2026 10:26pm UTC

Request Review

@github-actions github-actions Bot added the risk: high PR risk score: high label Nov 25, 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.

Stale Bugbot comment from a previous run.

…e object

An object that the viewer cannot read comes back as a resource_link with
its label and link. Message refs are always objects, so the transcript
showed the card as unavailable instead.

@BYK BYK left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Automations have owners, right? So we can fallback to that?

Vercel deployment cards show only the link's host, because Vercel has no link type.

Can/should we add one?

@sentry-junior

sentry-junior Bot commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

Automations have owners, right? So we can fallback to that? Can/should we add one?

Yes, it can be done. junior_automation_runs maps the run's conversation_id to its automation_id, and the Automation has a creator, so readConversationOwner in pending-cards.ts could fall back to the creator for a run Conversation.

I'd gate it on credentialMode, though:

  • creator: use the creator. The run already reads with their access and posts the output to the destination, so a card read the same way exposes nothing new.
  • system: keep the fallback. If we read the cards with the creator's access here, the destination channel would see objects that the run itself can't read. That gets around the opt-in that lets the creator's credentials be used only on request.

I left it out of this PR on purpose. It changes who the delivered snapshot reads as, and that's an access decision more than a fields cleanup, so I think it fits better as a separate change with a test for each mode.

…' into feat/annotation-no-status-writes

# Conflicts:
#	packages/junior-github/src/pull-request-outcomes/apply.ts
#	packages/junior/tests/integration/api/conversations/detail.test.ts
…' into feat/annotation-subject-search

# Conflicts:
#	packages/junior-plugin-api/src/tools.ts
Base automatically changed from feat/annotation-subject-search to feat/github-issue-assignee-items November 25, 2026 22:15
…' into feat/annotation-drop-facts

# Conflicts:
#	packages/docs/src/content/docs/extend/build-a-plugin.md
#	packages/junior-github/src/annotations.ts
#	packages/junior-plugin-api/src/annotations.ts
#	packages/junior/src/api/conversations/list.ts
#	packages/junior/src/chat/conversations/sql/annotation-filter.ts
#	packages/junior/src/chat/plugins/annotations.ts
#	packages/junior/tests/integration/api/conversations/detail-annotations.test.ts
#	packages/junior/tests/integration/api/conversations/sidebar-annotations.test.ts
#	packages/junior/tests/integration/list-agents-search.test.ts
#	packages/junior/tests/integration/search-conversations-tool.test.ts

@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 using default effort 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 d24ec3c. Configure here.

Calendar tools save an AccountChooser link for Workspace accounts, which
the Calendar link type did not claim, so those cards never read live.
The link type now claims it and reads the Calendar link inside.

Cancel no longer saves a cancelled status, so the live card now shows
that Google cancelled the event instead of hiding it.
@BYK
BYK merged commit 5c3e6e3 into feat/github-issue-assignee-items Nov 25, 2026
7 checks passed
@BYK
BYK deleted the feat/annotation-drop-facts branch November 25, 2026 22:31
sentry-junior Bot added a commit that referenced this pull request Nov 25, 2026
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 | ![light
desktop](https://junior-prod.sentry.dev/public/artifacts/583964b9-6bfc-4968-9a59-ac15cce51049.png)
| ![dark
desktop](https://junior-prod.sentry.dev/public/artifacts/b1b02f39-aedb-4a51-a4fc-7d1d8599cc1b.png)
|
| Mobile | ![light
mobile](https://junior-prod.sentry.dev/public/artifacts/ec70a7a2-2df4-45db-9a26-93482c93f024.png)
| ![dark
mobile](https://junior-prod.sentry.dev/public/artifacts/aeaaeda8-1bea-4fe5-814d-9c2b5f68f012.png)
|

(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]>
sentry-junior Bot added a commit that referenced this pull request Nov 26, 2026
…kage

The dashboard QA fixture stores its pull requests as object Annotations
since #4351, and the sidebar now names them by title alone, so the e2e
link lookup is scoped to the reply. The Linear card tests load the
plugin by package name, so the junior package depends on it like the
other plugins it tests.

This branch was successfully deployed

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

Labels

risk: high PR risk score: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant