Skip to content

feat(annotations): Find Annotations by subject in search and filters - #4340

Merged
BYK merged 4 commits into
feat/annotation-no-status-writesfrom
feat/annotation-subject-search
Nov 25, 2026
Merged

BYK merged 4 commits into
feat/annotation-no-status-writesfrom
feat/annotation-subject-search

Conversation

@sentry-junior

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

Copy link
Copy Markdown
Contributor

Search and object filters now find an Annotation by its subject, so a pull request in a renamed repository is still found by its new name.

Search text to subject

resolveAnnotationFilter (chat/conversations/sql/annotation-filter.ts) turns text that names an object into a filter, without a provider call:

  • A pasted link goes to the plugin link type that claims it. Its existing label(url) names the object from the link alone, such as owner/repo#12.
  • A <repository>#<number> reference, typed or from a link label, is looked up in the code change records. Webhooks and the name repair keep the repository name current there, so the result is the code change's provider id. That is the subject id of each codeChange subject kind of the plugin (github:pull_request).

No new plugin hook: the code change records and the link labels already hold what is needed.

Where it applies

  • Dashboard search (api/conversations/list.ts) matches the stored title, key, and link (no longer label), or the resolved subjects. The stored title and link are read through storedAnnotationTitle / storedAnnotationUrl, so a later change can point them at columns.
  • searchConversations and the Slack message search annotation filter match the key (exact, or nested children after #), the stored link, or the resolved subjects. The param names stay the same. Their descriptions now say that a link works too.
  • Plugin conversations.search takes { subject } in place of { annotation } and matches (subject_kind, subject_id). github_getPullRequest passes the pull request's GitHub id, so related_conversations survives a repository rename.

codeChangeSubjectKinds moved from the Inbox search to subject-links.ts so both searches use it. findObjectLinkType is now generic over the link type shape.

Left as is

  • api/objects/attach.ts still deduplicates an attach by key or link. A card read from a link has no provider id (the object cache does not keep one), so it cannot compare subjects.
  • Message card refs (cards.ts, pending-cards.ts) and the Annotation upsert and remove use the key, because that is the Annotation's identity inside one Conversation, not an object lookup.

Limits

A GitHub issue, or a pull request that Junior did not record as a code change, has no entry in the code change records. Without a provider read, a renamed repository's issue is found only by its old key, link, or title.

PluginConversationToolContext.search is a breaking change for plugins that call it with annotation. The only caller in this repo is github_getPullRequest.

via @BYK.

--

View Session [Sentry]

sentry-junior Bot and others added 2 commits November 25, 2026 17:01
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]>
@sentry-junior
sentry-junior Bot requested a review from BYK November 25, 2026 17:03
@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:08pm 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.

A word that every link holds, such as pull or github.com, matched each
annotated Conversation.
…' into feat/annotation-subject-search

# Conflicts:
#	packages/junior-plugin-api/src/tools.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 1 potential issue.

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 f256fe0. Configure here.

@BYK
BYK merged commit c85800b into feat/github-issue-assignee-items Nov 25, 2026
7 checks passed
@BYK
BYK deleted the feat/annotation-subject-search branch November 25, 2026 22:15
BYK pushed a commit that referenced this pull request Nov 25, 2026
…4386)

Follow-up to #4340.

`github_getPullRequest` finds `related_conversations` by the pull
request's subject (`github:pull_request` + GitHub's id). A card attached
from a pasted link can lack GitHub's id, so its Annotation's subject is
the core `link` kind with the link. Those Conversations dropped out of
`related_conversations`, even when the repository name did not change.

Plugin `conversations.search` now also takes the object's `url`. Core
matches it, case-insensitively, against the stored link and the key, in
addition to the subject. `github_getPullRequest` passes the pull
request's `html_url`.

<!-- junior-request-attribution:start -->
via @BYK.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:agent%3Acc073f0ef328a6593b0845d156272adf -->

--

[View
Session](https://junior-prod.sentry.dev/conversations/agent%3Acc073f0ef328a6593b0845d156272adf)
[[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3Acc073f0ef328a6593b0845d156272adf/?project=4510944073809921)

<!-- junior-session-footer:end -->

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
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]>

This branch was successfully deployed

1 active deployment
Preview – junior-docs — f256fe08 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