Mobile consumed the windowed thread detail with no way to fetch older
activities, silently truncating history. Mirror the web lazy-load:
- useThreadComposerState: older-activity state + a thread-keyed in-flight ref
guard, a reset effect on thread switch, and loadThreadActivities with the same
union cursor. Older pages are deduped (against prior pages and the live window)
and prepended into the feed; initial hasMore comes from the server's
hasMoreActivities flag.
- ThreadFeed: onStartReached triggers the load, maintainVisibleContentPosition
anchors the viewport on prepend, and the header shows a spinner while loading.
- Forward the values through ThreadRouteScreen → ThreadDetailScreen.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
The server windows thread detail to the most recent 500 activities and reports
`hasMoreActivities`. The web timeline now fetches older pages on demand via the
getThreadActivities RPC:
- client-runtime: loadThreadActivities command on orchestrationEnvironment.
- ChatView keeps per-thread older pages in local state, prepends them ahead of
the live window, and derives hasMore from the server flag (no client-side
window-size constant). A thread-keyed in-flight ref coalesces the duplicate
dispatches a fast scroll-to-top would otherwise fire, and a request-key guard
discards results after a thread switch.
- MessagesTimeline triggers a load on reaching the top
(maintainVisibleContentPosition anchors the viewport on prepend) with a
"Load older history" header and loading indicator.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
A busy SQLite database materialised hundreds of MB of activity payloads into the
Node heap and crashed the server. Bound the reads and add an on-demand
pagination path so deep history is still recoverable.
- /api/orchestration/snapshot and the `t3` CLI offline path called getSnapshot(),
loading every thread's full activity/message/checkpoint history even though
they only read `.projects`. Point both at getCommandReadModel() (same shape,
without the heavy per-thread tables).
- getThreadDetailById windows activities to the most recent 500 (it fetches
WINDOW+1 to detect truncation and sets `hasMoreActivities` so clients can
lazy-load). Live activities still stream in via the event subscription.
- New orchestration.getThreadActivities RPC pages older activities on demand:
cursor is {beforeSequence} for sequenced rows or {beforeCreatedAt,
beforeActivityId} for legacy unsequenced (NULL) rows, output {activities,
hasMore}. The sequenced query orders by `sequence DESC` with
`(sequence < ? OR sequence IS NULL)` so the (thread_id, sequence, created_at,
activity_id) index satisfies the ORDER BY instead of a filesort. Unsequenced
rows page by a (created_at, activity_id) cursor consistent with the window's
ordering.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Julius Marminge <[email protected]>
Co-authored-by: Julius Marminge <[email protected]>