Repository navigation
feat(dashboard): Catch readers up on unread Conversation activity - #2657
Conversation
Add a Catch me up action under the New marker when two or more Turns finished since the reader's read position. The server summarizes only the unread rows with the fast model, using the Brief from the read position as earlier context, and adds a Needs you line when something waits on the reader. Nothing is stored. Co-Authored-By: BYK <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
2 screenshot changes — 1 changed · 1 added · 0 removed Review screenshots in Frameshift
|
|
Pics or didn't happen (in PR description) |
BYK
left a comment
There was a problem hiding this comment.
Feel like this is better closer to Jump to bottom button, right?
Or at least the summary box should have a link that does the same as jump to bottom.
Also, should we consider combining the "Catch me up" button next to the "New" marker so it takes up less space?
…ry to the latest row
…ch-up # Conflicts: # packages/junior/src/api/conversations/routes.ts # packages/junior/src/api/schema.ts
This comment has been minimized.
This comment has been minimized.
BYK
left a comment
There was a problem hiding this comment.
Pretty sure you can make this prettier and more slick. This works for now but it doesn't look great compared to the rest of the UI.
Polish the catch-up: an accent pill in the New marker, an accent card with a divided Needs you row, and a quiet Jump to latest button.
…#2717) Dashboard telemetry can't currently answer "which route is slow". Server segments get their names only from the outer Hono app: `GET /api/conversations/*`, `GET /api/plugins/*`, and `GET /*` for egress. Browser `pageload`/`navigation` spans are all named `Pageload`/`Navigation`. Polls that run after a navigation span ends show up as orphan segments. The navigation span's duration is also not the time it takes to see the transcript. **Server route names** - `routeNameMiddleware()` (`chat/sentry-route-name.ts`) is registered first in the dashboard app. It takes the pattern of the first matched non-middleware route from Hono `matchedRoutes`, names the request span with it, and stores it in `app.http.route`. - `scrubPrivateSentrySpan` calls `promoteHttpRouteName`. On sent `http.server` segments, this function writes the inner pattern back to the name, `http.route`, and `sentry.segment.name`. It has to do this because the outer app renames the span after the inner app returns. - Sandbox egress is named `/api/internal/sandbox-egress/:token/*`. Plugin routes are named `/api/plugins/<plugin>/*`, because plugin apps are plain fetch handlers and expose no patterns. - Named the anonymous middleware: `sandboxEgress`, `dashboardVersionHeader`, and `requireUserCustomizationExperiment`. **Browser** - `<TracedRoutes>` replaces `<Routes>` and keeps the route table in one place. It calls `matchRoutes` and names the active pageload/navigation span with `updateSpanName` and `sentry.segment.name.source: route`. It does this in a layout effect, so spans that the page ends in its first effects also get the route segment name. - `shouldCreateSpanForRequest: () => Boolean(getActiveSpan())`: after the route span ends, requests send no spans. - A `ui.render` span named `Conversation transcript shown` covers the time from the route span start to the first transcript commit. It carries `app.dashboard.load` = `pageload|navigation`. - `app.dashboard.navigation.pre_fetch_ms` (navigation entry `fetchStart`) is set on `pageload` spans. - TELEMETRY.md: the "Dashboard" section now has three query recipes. **Why not `enableReportPageLoaded`** `enableReportPageLoaded` would stop idle auto-finish on every pageload, so pages that never call `reportPageLoaded()` would wait for `finalTimeout`. It also covers only pageloads, and most conversation opens are client navigations. A child span measures both kinds of load and leaves idle ending unchanged. **Verification** - `tests/component/http/route-name-telemetry.test.ts` runs real Sentry init with a capturing transport and real nested Hono apps. With the promotion removed, it fails with the coarse names seen in prod. - An envelope sink plus Playwright against the dashboard e2e harness showed: - pageload and navigation named `/conversations/:conversationId` and `/automations` with source `route` - every child span's `sentry.segment.name` set to the route - transcript spans 69–262 ms against 0.9–1 s route spans - no orphan `http.client` segments over 25 s of polling - non-conversation navigations still end by `idleTimeout` - `pre_fetch_ms` does not show up in e2e, because the harness's `page.clock.install()` makes `performance.getEntriesByType("navigation")` return `[]`. I checked this in a separate script. Without the fake clock the entry is there. - Not verified locally: whether Relay derives `transaction` from the renamed streamed segment. The SDK sends the renamed `name` and `sentry.segment.name`. Check this in prod after deploy. - `pnpm typecheck`, `pnpm lint`, the egress integration tests, the payload filter tests, and `pnpm test:e2e:dashboard` (87/87) all pass. Dashboard unit tests pass except `dashboard-output.test.ts`: its Nitro build fails locally with a `@sentry/[email protected]` missing-export error, a dependency resolution problem in this sandbox. **Overlap** - #2657, #2676, and #2677 also edit `ConversationPage.tsx`. This PR adds only one import and one effect there. - The privacy work (egress token/query scrubbing, `httpBodies`) edits `sentry-payload-filter.ts` and `instrumentation.ts` separately. This PR adds one line to each. <!-- junior-request-attribution:start --> via @thomasjiangcy. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:agent%3A0b0c4156706860efb734f45c70a1e0e3 --> -- [View Session](https://junior-prod.sentry.dev/conversations/agent%3A0b0c4156706860efb734f45c70a1e0e3) [[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3A0b0c4156706860efb734f45c70a1e0e3/?project=4510944073809921) <!-- junior-session-footer:end --> --------- Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
…2716) When a conversation opens with no cached copy, the transcript waits for two requests in a row: `/pending-messages`, then `/api/conversations/:id`. #1932 added this order on purpose. Workers commit input before they acknowledge it, so reading the mailbox first means a message that moves into history between the two reads still appears in one of them. In prod traces, the detail request started only after the mailbox request returned: - [`3cffecfa…`](https://sentry.sentry.io/explore/traces/trace/3cffecfa6ae6460f8677a8fc57ea128e/) (navigation): mailbox 47→383ms, then detail from 385ms. - [`0d26d374…`](https://sentry.sentry.io/explore/traces/trace/0d26d3741d5d477793c326ccfbed4f4b/) (pageload): mailbox 713→856ms, then detail from 861ms. - [`19019d5f…`](https://sentry.sentry.io/explore/traces/trace/19019d5f769341a2916e865e93267baa/) and [`40a68dfc…`](https://sentry.sentry.io/explore/traces/trace/40a68dfc3ed248dca589f837bd109bb8/): the mailbox took 0.86s and 1.8s in the browser, and the detail waited for it. Change: - `GET /api/conversations/:id?mailbox=true` reads the mailbox first and then history, in one request. It returns the `/pending-messages` report as `mailbox`. A request with `mailbox=true` never returns 304. - The client uses it only for a first read with no cached copy. Polls and cached reopens keep the two reads, so the detail can still return 304 (#2655). - The mock reporting API and its hash-based 304 middleware support the flag. A shared e2e helper, `withRequestedMailbox`, adds the mailbox to mocked detail reports. Expected impact (inference): opening a conversation saves one round trip plus the server's mailbox read, about 150–350ms in typical traces and up to about 1.8s in the slow ones. Polling cost does not change. Checks: `pnpm typecheck` (junior, junior-dashboard), oxlint, prettier, `file-length:check`, junior `pending-messages` and `detail` integration tests, dashboard vitest, and the whole dashboard Playwright suite (87 passed). `tests/dashboard-output.test.ts` fails in my sandbox on `main` too, during its Nitro build, so it is not related to this change. Overlaps: #2657, #2676, #2677, #2678, and #2428 change the conversation page UI. This PR changes only `queries.ts` data loading and the detail route, so I expect few conflicts. #2657 (catch up on unread activity) may touch the same detail options. This branch is based on `main`. #2712 (Neon pool size) is independent, and it fixes most of the server-side wait in the slow traces. <!-- junior-request-attribution:start --> via @thomasjiangcy. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:agent%3A34a570431e2cdbd57aba2d8c15a0c1ac --> -- [View Session](https://junior-prod.sentry.dev/conversations/agent%3A34a570431e2cdbd57aba2d8c15a0c1ac) [[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3A34a570431e2cdbd57aba2d8c15a0c1ac/?project=4510944073809921) <!-- junior-session-footer:end --> --------- Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: Thomas Jiang <[email protected]>
Move Catch me up to the right end of the marker line, center Jump to latest in the card, and show a failed catch-up under the marker. Co-Authored-By: BYK <[email protected]>
|
Found 2 test failures on Blacksmith runners: Failures
|
…ersation read (#2720) Opening a conversation built the whole detail report twice. `readConversationDetailEtag`, added in #2655, hashed the viewer's read position, and the transcript sends `PUT /read-position` soon after it opens and again as the reader scrolls. Each write changed the version token. So the next poll got a 200 with the full report, not a 304. That new token also made `conversationDetailQueryOptions` refresh agents, memories, watches and Review items. A prod browser capture of one conversation open showed it: `pending-messages` → detail (200, 77.8 kB, 1.41s) → `read-position` → `pending-messages` → detail (200 again, 77.9 kB, 1.44s) → `memories` and `spend` again. Change: - The read position is no longer part of the detail ETag, and that query no longer runs on each poll. `useMarkConversationRead` already puts the stored position into the cached detail, so the reader's own client stays correct. - Polls now answer 304 after a read, so the cache keeps the `unreadCursor` from the last full build. `useMarkConversationRead` now drops `unreadCursor` and `unreadPage` when the new position reaches the latest page. It uses the same rule as the server (`lastReadSeq + 1 < firstSeq`). Without this, a second visit in the same session would open at rows the reader already read. The current visit is not affected, because `useReadPositionAtOpen` keeps the values from when the conversation opened. - The read-position integration scenario now checks that a poll after a read returns 304. Trade-off: another tab or device does not see the new read position until the detail changes or the page reloads. A new page load has no cache, so it always gets the current position. If the reader is still behind the latest page after a write, the cached cursor stays at the older position until the next full build. A reopen in that tab then loads from slightly earlier rows. Not checked: the dashboard Playwright read-position spec, because Chrome is not installed in my sandbox. CI runs it. Mock reporting uses a content-hash ETag, so the e2e path still rebuilds after a read either way. `tests/dashboard-output.test.ts` also fails on `main` in my sandbox. Overlaps: #2716 changes the first detail read (mailbox in the same request) in `queries.ts` and the detail route, but not the ETag. #2657 (unread catch-up) touches read-position e2e and the unread flow. Whichever merges second may need a small rebase. <!-- junior-request-attribution:start --> via @thomasjiangcy. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:agent%3Ab48dee8440f2faa8ee84518a2b9ac612 --> -- [View Session](https://junior-prod.sentry.dev/conversations/agent%3Ab48dee8440f2faa8ee84518a2b9ac612) [[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3Ab48dee8440f2faa8ee84518a2b9ac612/?project=4510944073809921) <!-- junior-session-footer:end --> --------- Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: Thomas Jiang <[email protected]>
![Fix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/fix-with-codesmith-light-3x.png)
Coming back to a busy Conversation means reading every row after the "New" marker. This adds a Catch me up action inside the marker. It shows a short summary of what changed since the reader's read position (#2513), plus a "Needs you" line when something waits on the reader and a Jump to latest link.
Design choices (agreed with BYK before building):
readConversationBriefThroughloads the newest Brief that covers nothing past the read position. That gives the earlier context in a few hundred tokens, so the model reads only the unread rows. Input is capped (40k chars, newest rows kept, 1,000 events max).botConfig.fastModelId(GPT-6 Luna by default). This is cheaper than Briefs, which run on the default profile (Opus in prod).canViewPrivateContentcheck as the Brief. Telemetry stays metadata-only, because no Turn privacy is set.POST /api/conversations/:id/catch-uptakes{ afterSeq, throughSeq }. The dashboard sends the unread range from when the Conversation opened, so rows that arrive later don't change the summary.Screenshots
From the dashboard e2e case. The catch-up response is mocked there.
The new classifier eval (
evals/classifiers/catch-up.eval.ts) needs AI Gateway access and has not run yet. Addtrigger-evals-classifiersto run it. The integration test, the dashboard e2e (including a new catch-up case and screenshot), typecheck, and lint pass locally.via @BYK.
--
View Session in Sentry