Repository navigation
perf(dashboard): Move the feed token only on what a live Turn shows - #2994
Merged
Merged
Conversation
Every Event of a live Turn moves the root's last_activity_at, which the feed token hashed, so each versions poll during a Turn refetched the list. Hash the minute that the row shows as an age, the feed order, and the newest Message of each role instead. Record which tokens a poll moved on a browser span. Co-Authored-By: BYK <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
11 screenshot changes — 11 changed · 0 added · 0 removed Review screenshots in Frameshift |
BYK
approved these changes
Nov 9, 2026
23 tasks done
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.
After #2922, 35% of
/api/versionspolls in prod (0.287.0) still refetched the list. With a live Turn open it was 61–74%.Cause
The feed token hashed each root's
last_activity_at. Every Event in a live Turn moves it:turn_started, eachassistant_message,tool_execution_startedandtool_result, checkpoints, andturn_completed. So each poll during a Turn movedconversations.I reproduced it locally with a real web Turn (fake model, 20 tool steps 3s apart) and the versions poll every 5s.
conversationsmoved on 13 of 13 polls, andlast_activity_atchanged each time. Only 2 of those polls had a new Message, 2 a status change, and 1 a title change.reviewItemsnever moved during the Turn. It still refetches the list, because waiting Conversations outside the first page join the feed. The new diagnostic will show how often that happens in prod.Change
What the feed token hashes for each row:
date_trunc('minute', last_activity_at), for the root and for its nested Threads. Rows show last activity only as a whole-minute age (now,3m,5 minutes ago) and, while a Turn runs, a spinner. The token moves at most once a minute during a Turn, and the age is never more than one minute stale.junior_conversation_events_message_role_idx. Before,last_activity_atstood in for both.stopped_at, unread, pins, Threads, and annotations are hashed as before. A new reply, status, title, unread state, or pin still shows within one poll.Diagnostic: when a versions poll moves a token, the browser sends a
functionspan namedRefresh changed reads. Itsapp.dashboard.versions.movedattribute lists the tokens that moved (for exampleconversations,reviewItems). A poll that moves nothing adds no span. A query recipe is inTELEMETRY.md.Side effect: while a Turn runs, the list's
lastSeenAtcan be up to a minute stale. Archive compareslastSeenAtwith the stored value, so an archive during a live Turn can return 409 "Conversation received new activity". It already could: before this change, each 5s poll window during a Turn had a new Event. Idle rows are not affected.Measured (local Postgres 17)
Polls that refetch the list (
conversationsmoved, sincereviewItemsdid not move), on a live Turn of about 65s with a 5s poll:The polls that still move are the Turn start (status and title), the Turn end (status and the reply), and one minute change. A longer Turn adds about one move per minute plus one per visible Message, so the floor is about 8% of 5s polls. The feed token doesn't depend on the open Conversation, so a live Turn in a row that isn't open gives the same numbers.
Full
/api/versionspoll p50 (400 polls, median of 3 interleaved runs, 50-row first page):That is about 1ms more per poll, for the two Message lookups. Each list refetch it avoids costs about 295ms and 24.6 queries in prod.
Tests
versions.test.ts:conversation;conversation;conversations;conversations.pnpm typecheck, rootpnpm lint,tests/integration/api(71 files, 209 tests), dashboard unit tests (59 files, 408 tests).No visible UI change.
via @BYK.
--
View Session in Sentry