Skip to content

feat(sessions): summary poll — stop shipping the full list on non-list routes (v0.296.0) - #542

Merged
vikasprogrammer merged 1 commit into
mainfrom
feat/sessions-summary
Aug 3, 2026
Merged

feat(sessions): summary poll — stop shipping the full list on non-list routes (v0.296.0)#542
vikasprogrammer merged 1 commit into
mainfrom
feat/sessions-summary

Conversation

@vikasprogrammer

Copy link
Copy Markdown
Owner

Sessions-pagination Phase 2. Plan: docs/sessions-pagination-plan.md. Builds on Phase 1 (#539).

Problem

The console's 1.5 s poll shipped all ~950 sessions every tick, on every route — even Inbox/Tasks/Overview/Settings, which never render the list. #530/#532 made unchanged ticks cheap on the wire, but the server still rebuilt 950 rows each tick and any change re-shipped them.

Change

New GET /api/sessions/summary returns only the always-on rows — every LIVE session + the viewer's most-recent ended tail (capped 60) + a global doneToday count — built from aliveNames() + a bounded id query + listSessions(ids), viewer-scoped, never rebuilding the whole table.

The global poll now switches source by route: the Sessions & Chat list views still fetch full /api/sessions (they render it); every other route polls the summary. So most navigation stops pulling ~950 rows per tick.

Kept correct via the reader map (see plan):

  • Badge derives from messages (untouched); per-session bells from blocked (⊂ live, always in the summary).
  • openNotification falls back to the Phase-1 by-id fetch for an older session not in the summary.
  • Overview doneToday reads the summary count (Overview is owner-only → a global count is correct).
  • Mutation handlers reload via the route-appropriate endpoint (reloadSessions), never re-inflating a summary route with the full list.
  • SessionsPage/ChatPage/OverviewPage internals unchanged — they still receive a sessions array, sourced full on their own routes.

Measured (live instawp snapshot, 950 rows)

  • Poll payload off the list routes: 950 → ~68 rows (all live + 60 recent-ended, viewer-scoped).
  • Summary server build ~23–33 % faster than the full listSessions, before the row-count/​wire win.

Verification

  • In-process endpoint test: shape, bounded (68 vs 950), recent-ended cap, doneToday matches a direct count, 304 on unchanged tick, viewer-scoped (a member sees 0 unowned rows).
  • Headless-browser smoke (real 950-row DB): inbox route polls /api/sessions/summary with zero full-list calls; the sessions route switches to the full list and renders "950 sessions"; Overview polls summary + renders "Done today"; no console/page errors.
  • Typecheck + web build + npm run test:governance (29/29) green.

Next

Phase 3 — server-side pagination + filter/sort/search on /api/sessions so the list view itself scales (it still fetches the full list when open). See the plan doc.

🤖 Generated with Claude Code

…t routes (v0.296.0)

Sessions-pagination Phase 2 (plan: docs/sessions-pagination-plan.md). The console's
1.5s poll shipped all ~950 sessions every tick on every route. New GET
/api/sessions/summary returns only the always-on rows — every LIVE session + the
viewer's recent-ended tail (cap 60) + a global doneToday count — built from
aliveNames() + a bounded id query + listSessions(ids), viewer-scoped, never rebuilding
the whole table.

The global poll now switches source by route: the Sessions & Chat list views still
fetch full /api/sessions (they render it); every OTHER route polls the summary. So
navigating Inbox/Tasks/Overview/Agents/Settings no longer pulls ~950 rows per tick.

openNotification falls back to the Phase-1 by-id fetch for an older session not in the
summary; Overview's doneToday reads the summary count (owner-only → global count is
correct); mutation handlers reload via the route-appropriate endpoint. Badge (messages)
and per-session bells (blocked ⊂ live) unaffected.

Measured on a live instawp snapshot (950 rows): poll payload 950 → ~68 rows off the list
routes; summary builds ~23-33% faster than the full list before the row-count win.
Verified: in-process endpoint test (bounded/viewer-scoped/304/doneToday) + headless
browser smoke (inbox polls summary, zero full-list calls; sessions route renders all 950;
Overview KPI; no console errors). Typecheck + web build + test:governance (29/29) green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vikasprogrammer
vikasprogrammer merged commit 493eb52 into main Aug 3, 2026
1 check passed
vikasprogrammer added a commit that referenced this pull request Aug 3, 2026
…rtualize now, paginate later) (#544)

Adds a "Console performance" section to TODO.md tracking the shipped console-perf
arc (Phases 1+2, #539/#542) and the Phase 3 decision: do client row virtualization
first (3a, low-risk render fix), defer server-side pagination (3b) until a tenant's
session count clears ~3-5k. Updates docs/sessions-pagination-plan.md Status to match.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant