Summary#
Fixes #2761.
This rebases the server and web implementation from #3510 onto current main, where that PR is now conflicting after the repository history changes. Original implementation commits retain @olafura as their author. It deliberately leaves native mobile out of scope.
- bound initial thread-detail activity reads to the newest 500 rows
- expose cursor-based older-activity pages over RPC
- let web users load older history while preserving scroll position and live updates
- reset and deduplicate paged history when the live window reshapes
- avoid sidebar thread-detail prewarming in browser/headless clients; Electron keeps its current warm-up behavior
Why#
A live remote-web reproduction showed that the server and Tailscale path returned a 12.6 MB snapshot in about 0.2 seconds, so transport was not the bottleneck. The browser was eagerly hydrating eight visible thread details totaling roughly 38 MB. The largest thread contained 1,758 activities and serialized to 16.4 MB.
With this change, a browser initially hydrates only the selected thread and only its newest 500 activities. In the same dataset that window is about 6.7 MB, while older history remains reachable on demand.
Verification#
pnpm exec vp run typecheck
pnpm exec vp check — 0 errors; 9 existing nested-component warnings
pnpm exec vp test apps/server/src/orchestration/Layers/ProjectionSnapshotQuery.test.ts — 11 passed
pnpm exec vp test packages/client-runtime/src/state/threadReducer.test.ts — 26 passed
pnpm exec vp test apps/web/src/components/chat/MessagesTimeline.test.tsx — 15 passed
- full workspace build — web, server, marketing, and desktop completed
Related: #3817 addresses heartbeat tolerance, but does not reduce the large history payload or browser processing cost.
Note
Medium Risk
Touches projection read paths, a new RPC surface, and chat timeline state (cursors, dedup, reshape resets); behavior is heavily tested but wrong pagination could hide or duplicate activity rows on long threads.
Overview
Caps thread-detail activity loads to the 500 newest rows and sets hasMoreActivities when older rows exist, with a new orchestration.getThreadActivities RPC (sequenced beforeSequence or legacy beforeCreatedAt / beforeActivityId cursors) to page older history.
Web merges lazy-loaded pages into the live window in ChatView, resets on thread/window reshape, dedupes by id, and MessagesTimeline scroll-up auto-load (edge-triggered to avoid retry loops) plus a manual “Load older history” control. Browser sidebar no longer prewarms thread details; Electron still does. snapshot HTTP and CLI offline resolution switch from getSnapshot to getCommandReadModel so project-only consumers avoid loading full per-thread tables.
Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit de8fd65934768173819b93adcd6b92af3e8c7fc3. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).
Note
Paginate large thread history for remote web clients#
- Caps thread-detail snapshots at the 500 most recent activities and sets
hasMoreActivities on threads that have older history beyond this window.
- Adds a new
orchestration.getThreadActivities WebSocket RPC with cursor-based pagination, supporting both sequenced (beforeSequence) and legacy unsequenced (beforeCreatedAt/beforeActivityId) cursors.
ChatView now lazy-loads and prepends older activities on demand, merging them with the live window for display and the composer context meter.
MessagesTimeline renders a 'Load older history' header control or a loading indicator, and auto-triggers a single load when the viewport reaches the top, rearming only when the cursor advances or the user scrolls away.
- Sidebar thread prewarming is disabled for browser clients and kept only for Electron, and the snapshot/offline-snapshot endpoints now return the lightweight command read model instead of the full projection snapshot.
- Behavioral Change: remote clients no longer receive full thread activity history in the initial snapshot; older history must be fetched via the new paginated RPC.
Macroscope summarized de8fd65.
Important
Review skipped#
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID:
0354f988-d9a3-4df0-ac72-7c2a2bf226c0You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share