Skip to content

perf(dashboard): Check versions every 10s while the reader is away - #2864

Merged
BYK merged 1 commit into
mainfrom
perf/dashboard-away-backoff
Nov 7, 2026
Merged

BYK merged 1 commit into
mainfrom
perf/dashboard-away-backoff

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Follows #2863 (merged; this branch is rebased on main). After 5 minutes without input (pointer, key, wheel, touch, or focus), the versions poll runs every 10s instead of 5s. The next input checks at once and goes back to 5s.

  • client/versions.ts keeps the last input time in a ref. refetchInterval picks 5s or 10s after each check.
  • One capture-phase passive listener per input type. It updates the ref, and refetches only when the reader comes back from away.
  • The 10s away interval is the old idle detail interval. An untouched visible tab waits about as long as before this stack: 10s, plus one RTT for the detail read after the check. Hidden tabs still do not poll.
  • The 500ms window after a send and the 2s poll while a Turn runs are unchanged. The two versions e2e tests move to e2e/versions-poll.spec.ts, because conversations.spec.ts would pass 1,000 lines.

Why 5s while present, not lower

The versions check is 1 statement. It takes 17-19ms p50 for a heavy viewer (2,000 roots, 3,000 child agents) on local Postgres 17. Request count is the other cost that hurts today:

Present interval Requests/min, idle tab (3s and 2s computed) Worst-case idle delay
10s (before #2863, separate polls) 21 10s + 1 RTT
5s (#2863 and this PR) 12 5s + 2 RTT
3s 20 3s + 2 RTT
2s 30 2s + 2 RTT

3s gives back the request cut, and 2s is above the old count. 5s halves the delay and still sends 43% fewer requests.

Measurements

Requests/min for one open tab, mock dashboard:

Before #2863 #2863 This PR
Idle Conversation, reader present 21 12 12
Idle Conversation, reader away (visible, no input for 5 min) 21 12 6 (from the interval; the e2e test checks the 10s gap)
Active Turn 43 42 42 (the 2s detail poll does not back off)
List page, present 14 12 12

DB statements per check are the same as #2863: 1 per versions check (plus the viewer lookup), against 4 to 14 for each poll it replaced. An away tab runs 6 statements/min.

Worst-case delay before an idle Conversation shows a reply from Slack: present 5s + 2 RTT, away 10s + 2 RTT. The next input checks at once.

Checks

  • Dashboard tsc --noEmit, root pnpm lint (pre-push hook).
  • pnpm test:e2e:dashboard: 112 passed locally before the rebase. After the rebase on main, versions-poll.spec.ts passed 8/8 with --repeat-each 4 --workers 4.
  • The away test waits until the page has handled each answered check before it moves the clock. A timer that fires while a check is in flight joins that check, and TanStack then restarts the interval in real time, so the test failed under load without this.

No visible UI change.

via @BYK.

--

View Session in Sentry

@vercel

vercel Bot commented Nov 7, 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 7, 2026 3:16am UTC

Request Review

@github-actions github-actions Bot added the risk: medium PR risk score: medium label Nov 7, 2026
Base automatically changed from perf/dashboard-versions to main November 7, 2026 03:04
After 5 minutes without input, the versions poll runs every 10s instead
of 5s, the same as the old idle detail poll. The next input checks at
once and goes back to 5s.

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

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

9 screenshot changes — 9 changed · 0 added · 0 removed

Review screenshots in Frameshift

Conversation Attachment · Desktop
Conversation Attachment · Desktop
Changed
Conversation Captured Memories Popover · Desktop
Conversation Captured Memories Popover · Desktop
Changed
Conversation Captured Memories Popover · Mobile
Conversation Captured Memories Popover · Mobile
Changed
Conversation Details Watched Linked Work · Desktop
Conversation Details Watched Linked Work · Desktop
Changed
Conversation Details Watched Linked Work · Mobile
Conversation Details Watched Linked Work · Mobile
Changed
Conversation Long Transcript Touch · Mobile
Conversation Long Transcript Touch · Mobile
Changed
Show 3 more changed screenshots
Conversation Share Details · Desktop
Conversation Share Details · Desktop
Changed
Settings Mcp · Desktop
Settings Mcp · Desktop
Changed
System Cache Tokens · Desktop
System Cache Tokens · Desktop
Changed

@BYK
BYK merged commit d02b383 into main Nov 7, 2026
42 checks passed
@BYK
BYK deleted the perf/dashboard-away-backoff branch November 7, 2026 11:28

This branch was successfully deployed

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

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant