fix(server): paginate large thread history to stop the server running out of memory #3510
Closedolafura(GitHub profile, opens in a new tab)wants to merge 13 commits into
main fromrefs/pull/3510/headopened View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelssize:XL
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
- apps/web/src/components/ChatView.tsx line 1720OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -1686,0 +1700,21 @@1700+ reportFailure: false,1701+ });1702+ const activeThreadActivityRequestKey = activeThread1703+ ? `${activeThread.environmentId}\u0000${activeThread.id}`1704+ : null;1705+ const activeThreadActivityRequestKeyRef = useRef(activeThreadActivityRequestKey);1706+ activeThreadActivityRequestKeyRef.current = activeThreadActivityRequestKey;1707+ useEffect(() => {1708+ setOlderActivities([]);1709+ setOlderLoaded(false);1710+ setOlderHasMore(false);1711+ setLoadingOlderActivities(false);1712+ }, [activeThreadActivityRequestKey]);1713+1714+ const liveThreadActivities = activeThread?.activities ?? EMPTY_ACTIVITIES;1715+ const threadActivities = useMemo(1716+ () =>1717+ olderActivities.length > 01718+ ? [...olderActivities, ...liveThreadActivities]1719+ : liveThreadActivities,1720+ [olderActivities, liveThreadActivities],apps/web/src/components/ChatView.tsx line 1720OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -1686,0 +1700,21 @@1700+ reportFailure: false,1701+ });1702+ const activeThreadActivityRequestKey = activeThread1703+ ? `${activeThread.environmentId}\u0000${activeThread.id}`1704+ : null;1705+ const activeThreadActivityRequestKeyRef = useRef(activeThreadActivityRequestKey);1706+ activeThreadActivityRequestKeyRef.current = activeThreadActivityRequestKey;1707+ useEffect(() => {1708+ setOlderActivities([]);1709+ setOlderLoaded(false);1710+ setOlderHasMore(false);1711+ setLoadingOlderActivities(false);1712+ }, [activeThreadActivityRequestKey]);1713+1714+ const liveThreadActivities = activeThread?.activities ?? EMPTY_ACTIVITIES;1715+ const threadActivities = useMemo(1716+ () =>1717+ olderActivities.length > 01718+ ? [...olderActivities, ...liveThreadActivities]1719+ : liveThreadActivities,1720+ [olderActivities, liveThreadActivities],apps/web/src/components/ChatView.tsx line 1746OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -1686,0 +1726,21 @@1726+ : (activeThread?.hasMoreActivities ?? false);1727+ // Tracks the request key of an in-flight older-history load. The scroll1728+ // handler fires onLoadOlder on every frame while at the top, but the loading1729+ // *state* only updates on the next render — without a synchronous guard a fast1730+ // scroll-to-top dispatches several duplicate requests for the same cursor.1731+ const inFlightOlderKeyRef = useRef<string | null>(null);1732+ const loadOlderActivities = useCallback(() => {1733+ if (!activeThread || !hasMoreOlderActivities) {1734+ return;1735+ }1736+ const oldestActivity = threadActivities[0];1737+ if (!oldestActivity || !activeThreadActivityRequestKey) {1738+ return;1739+ }1740+ if (inFlightOlderKeyRef.current === activeThreadActivityRequestKey) {1741+ return; // a load for this thread is already in flight1742+ }1743+ const cursorInput =1744+ oldestActivity.sequence !== undefined1745+ ? { beforeSequence: oldestActivity.sequence }1746+ : { beforeCreatedAt: oldestActivity.createdAt, beforeActivityId: oldestActivity.id };apps/web/src/components/ChatView.tsx line 1765OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -1686,0 +1745,21 @@1745+ ? { beforeSequence: oldestActivity.sequence }1746+ : { beforeCreatedAt: oldestActivity.createdAt, beforeActivityId: oldestActivity.id };1747+ const requestKey = activeThreadActivityRequestKey;1748+ inFlightOlderKeyRef.current = requestKey;1749+ setLoadingOlderActivities(true);1750+ void loadThreadActivities({1751+ environmentId: activeThread.environmentId,1752+ input: { threadId: activeThread.id, ...cursorInput },1753+ })1754+ .then((result) => {1755+ if (activeThreadActivityRequestKeyRef.current !== requestKey) {1756+ return;1757+ }1758+ if (result._tag !== "Success") {1759+ return;1760+ }1761+ const page = result.value;1762+ setOlderActivities((prev) => {1763+ const seen = new Set(prev.map((activity) => activity.id));1764+ const fresh = page.activities.filter((activity) => !seen.has(activity.id));1765+ return [...fresh, ...prev];
- apps/web/src/components/ChatView.tsx line 1774OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -1686,0 +1754,21 @@1754+ setLoadingOlderActivities(true);1755+ void loadThreadActivities({1756+ environmentId: activeThread.environmentId,1757+ input: { threadId: activeThread.id, ...cursorInput },1758+ })1759+ .then((result) => {1760+ if (activeThreadActivityRequestKeyRef.current !== requestKey) {1761+ return;1762+ }1763+ if (result._tag !== "Success") {1764+ return;1765+ }1766+ const page = result.value;1767+ setOlderActivities((prev) => {1768+ // Dedup against both already-loaded older pages and the live window so1769+ // an overlap at the window boundary can't leave duplicate ids (which1770+ // would break timeline keys and work-log derivation).1771+ const seen = new Set(prev.map((activity) => activity.id));1772+ for (const activity of liveThreadActivities) {1773+ seen.add(activity.id);1774+ }apps/mobile/src/state/use-thread-composer-state.ts line 125OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -84,0 +105,21 @@105+ reportFailure: false,106+ });107+108+ const activityRequestKey = selectedThreadShell109+ ? `${selectedThreadShell.environmentId}\u0000${selectedThreadShell.id}`110+ : null;111+ const activityRequestKeyRef = useRef(activityRequestKey);112+ activityRequestKeyRef.current = activityRequestKey;113+114+ const liveActivities = selectedThreadDetail?.activities ?? EMPTY_ACTIVITIES;115+ // The live window's oldest activity is stable while new activities only116+ // append; it changes when the window is re-snapshotted (reconnect) or rows are117+ // removed (checkpoint revert), either of which can make prepended older pages118+ // stale or gappy — so reset the lazy-load state when it (or the thread) changes.119+ const liveOldestActivityId = liveActivities[0]?.id ?? null;120+ useEffect(() => {121+ setOlderActivities([]);122+ setOlderLoaded(false);123+ setOlderHasMore(false);124+ setLoadingOlderActivities(false);125+ }, [activityRequestKey, liveOldestActivityId]);
- apps/web/src/components/ChatView.tsx line 1762OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -1686,0 +1742,21 @@1742+ if (!oldestActivity || !activeThreadActivityRequestKey) {1743+ return;1744+ }1745+ if (inFlightOlderKeyRef.current === activeThreadActivityRequestKey) {1746+ return; // a load for this thread is already in flight1747+ }1748+ const cursorInput =1749+ oldestActivity.sequence !== undefined1750+ ? { beforeSequence: oldestActivity.sequence }1751+ : { beforeCreatedAt: oldestActivity.createdAt, beforeActivityId: oldestActivity.id };1752+ const requestKey = activeThreadActivityRequestKey;1753+ inFlightOlderKeyRef.current = requestKey;1754+ setLoadingOlderActivities(true);1755+ void loadThreadActivities({1756+ environmentId: activeThread.environmentId,1757+ input: { threadId: activeThread.id, ...cursorInput },1758+ })1759+ .then((result) => {1760+ if (activeThreadActivityRequestKeyRef.current !== requestKey) {1761+ return;1762+ }
- apps/web/src/components/ChatView.tsx line 1703OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -1683,4 +1684,20 @@16831684 );16841685 const selectedProvider: ProviderDriverKind = lockedProvider ?? unlockedSelectedProvider;16851686 const phase = derivePhase(activeThread?.session ?? null);1686- const threadActivities = activeThread?.activities ?? EMPTY_ACTIVITIES;1687+1688+ // ── Older-history lazy-load ────────────────────────────────────────────────1689+ // The detail snapshot windows activities to the most recent page (the server1690+ // sets `hasMoreActivities` when older ones exist); older pages are fetched on1691+ // demand (infinite scroll-up) and prepended. Messages aren't windowed1692+ // server-side, so this just back-fills the older tool activity.1693+ const [olderActivities, setOlderActivities] = useState<1694+ ReadonlyArray<OrchestrationThreadActivity>1695+ >([]);1696+ const [olderLoaded, setOlderLoaded] = useState(false);1697+ const [olderHasMore, setOlderHasMore] = useState(false);1698+ const [loadingOlderActivities, setLoadingOlderActivities] = useState(false);1699+ const loadThreadActivities = useAtomCommand(orchestrationEnvironment.loadThreadActivities, {1700+ reportFailure: false,1701+ });1702+ const activeThreadActivityRequestKey = activeThread1703+ ? `${activeThread.environmentId}\u0000${activeThread.id}`
- apps/web/src/components/ChatView.tsx line 1744OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -1686,0 +1724,21 @@1724+ useEffect(() => {1725+ const prev = olderWindowRef.current;1726+ olderWindowRef.current = {1727+ key: activeThreadActivityRequestKey,1728+ oldest: liveOldestActivityId,1729+ count: liveActivityCount,1730+ };1731+ const reshaped =1732+ activeThreadActivityRequestKey !== prev.key ||1733+ liveOldestActivityId !== prev.oldest ||1734+ liveActivityCount < prev.count;1735+ if (!reshaped) {1736+ return;1737+ }1738+ olderActivitiesGenRef.current += 1;1739+ inFlightOlderKeyRef.current = null;1740+ setOlderActivities([]);1741+ setOlderLoaded(false);1742+ setOlderHasMore(false);1743+ setLoadingOlderActivities(false);1744+ }, [activeThreadActivityRequestKey, liveOldestActivityId, liveActivityCount]);
- apps/web/src/components/ChatView.tsx line 1724OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -1686,0 +1704,21 @@1704+ : null;1705+ const liveThreadActivities = activeThread?.activities ?? EMPTY_ACTIVITIES;1706+ const liveOldestActivityId = liveThreadActivities[0]?.id ?? null;1707+ const liveActivityCount = liveThreadActivities.length;1708+ // Bumps on every lazy-load reset so a late in-flight load can't repopulate the1709+ // freshly-cleared state (the thread key alone doesn't change on a same-thread1710+ // window reshape).1711+ const olderActivitiesGenRef = useRef(0);1712+ // The request key of an in-flight older-history load — coalesces the duplicate1713+ // dispatches a fast scroll-to-top fires before the loading state updates.1714+ const inFlightOlderKeyRef = useRef<string | null>(null);1715+ // Reset the lazy-loaded older pages when the live window is *reshaped* rather1716+ // than purely appended-to: a different thread or a re-snapshot (reconnect)1717+ // changes its oldest row, and a checkpoint revert removes rows so the count1718+ // shrinks. A pure append (same thread, same oldest, larger count) keeps them.1719+ const olderWindowRef = useRef({1720+ key: activeThreadActivityRequestKey,1721+ oldest: liveOldestActivityId,1722+ count: liveActivityCount,1723+ });1724+ useEffect(() => {
- packages/client-runtime/src/state/threadReducer.ts line 76Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -37,0 +44,21 @@44+ * the server snapshot lists legacy unsequenced rows first, so the first live45+ * append re-sorts the array and shifts index 0. Lazy-load of older history uses46+ * this to detect a genuine window *reshape* (reconnect re-snapshot / checkpoint47+ * revert) without mistaking a plain append for one. Returns `null` when empty.48+ */49+export function liveWindowOldestActivityId(50+ activities: ReadonlyArray<OrchestrationThreadActivity>,51+): OrchestrationThreadActivity["id"] | null {52+ let oldest: OrchestrationThreadActivity | null = null;53+ for (const activity of activities) {54+ if (55+ oldest === null ||56+ activity.createdAt < oldest.createdAt ||57+ (activity.createdAt === oldest.createdAt && activity.id < oldest.id)58+ ) {59+ oldest = activity;60+ }61+ }62+ return oldest === null ? null : oldest.id;63+}64+apps/web/src/components/ChatView.tsx line 1793OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -1687,0 +1773,21 @@1773+ );1774+ // Before any page is loaded, the server tells us whether older history exists1775+ // beyond the windowed snapshot; afterwards the page `hasMore` is authoritative.1776+ const hasMoreOlderActivities = olderLoaded1777+ ? olderHasMore1778+ : (activeThread?.hasMoreActivities ?? false);1779+ const loadOlderActivities = useCallback(() => {1780+ if (!activeThread || !hasMoreOlderActivities) {1781+ return;1782+ }1783+ const oldestActivity = threadActivities[0];1784+ if (!oldestActivity || !activeThreadActivityRequestKey) {1785+ return;1786+ }1787+ if (inFlightOlderKeyRef.current === activeThreadActivityRequestKey) {1788+ return; // a load for this thread is already in flight1789+ }1790+ const cursorInput =1791+ oldestActivity.sequence !== undefined1792+ ? { beforeSequence: oldestActivity.sequence }1793+ : { beforeCreatedAt: oldestActivity.createdAt, beforeActivityId: oldestActivity.id };
- apps/web/src/components/ChatView.tsx line 1828OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -1687,0 +1808,21 @@1808+ })1809+ .then((result) => {1810+ // The window/thread was reset while this was in flight — drop the page1811+ // so it can't repopulate state cleared by the reset.1812+ if (olderActivitiesGenRef.current !== gen) {1813+ return;1814+ }1815+ if (result._tag !== "Success") {1816+ return;1817+ }1818+ const page = result.value;1819+ // Dedup against everything already loaded (older pages + live window) so a1820+ // boundary overlap can't leave duplicate ids. Loads are serialized by the1821+ // in-flight ref, so `threadActivities` is a current snapshot here.1822+ const seen = new Set(threadActivities.map((activity) => activity.id));1823+ const fresh = page.activities.filter((activity) => !seen.has(activity.id));1824+ if (fresh.length === 0) {1825+ // The page delivered nothing new; stop rather than re-dispatch the same1826+ // (unadvanced) cursor in a loop, and don't churn the array reference.1827+ setOlderLoaded(true);1828+ setOlderHasMore(false);
- apps/web/src/components/ChatView.tsx line 1822OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -1687,0 +1802,21 @@1802+ const gen = olderActivitiesGenRef.current;1803+ inFlightOlderKeyRef.current = requestKey;1804+ setLoadingOlderActivities(true);1805+ void loadThreadActivities({1806+ environmentId: activeThread.environmentId,1807+ input: { threadId: activeThread.id, ...cursorInput },1808+ })1809+ .then((result) => {1810+ // The window/thread was reset while this was in flight — drop the page1811+ // so it can't repopulate state cleared by the reset.1812+ if (olderActivitiesGenRef.current !== gen) {1813+ return;1814+ }1815+ if (result._tag !== "Success") {1816+ return;1817+ }1818+ const page = result.value;1819+ // Dedup against everything already loaded (older pages + live window) so a1820+ // boundary overlap can't leave duplicate ids. Loads are serialized by the1821+ // in-flight ref, so `threadActivities` is a current snapshot here.1822+ const seen = new Set(threadActivities.map((activity) => activity.id));
- apps/mobile/src/state/use-thread-composer-state.ts line 151Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -92,3 +245,19 @@245+ if (olderActivitiesGenRef.current === gen) {246+ inFlightOlderKeyRef.current = null;247+ setLoadingOlderActivities(false);248+ }249+ });250+ }, [251+ selectedThreadShell,252+ hasMoreOlderActivities,253+ mergedActivities,254+ activityRequestKey,255+ loadThreadActivities,256+ ]);257+92258 const selectedThreadFeed = useMemo(93- () => (selectedThreadDetail ? buildThreadFeed(selectedThreadDetail) : []),94- [selectedThreadDetail],259+ () =>260+ selectedThreadDetail261+ ? buildThreadFeed({ ...selectedThreadDetail, activities: mergedActivities })262+ : [],263+ [selectedThreadDetail, mergedActivities],
- apps/mobile/src/state/use-thread-composer-state.ts lines 219 to 221OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -91,0 +201,21 @@201+ const cursorInput =202+ oldestActivity.sequence !== undefined203+ ? { beforeSequence: oldestActivity.sequence }204+ : { beforeCreatedAt: oldestActivity.createdAt, beforeActivityId: oldestActivity.id };205+ const requestKey = activityRequestKey;206+ const gen = olderActivitiesGenRef.current;207+ inFlightOlderKeyRef.current = requestKey;208+ setLoadingOlderActivities(true);209+ void loadThreadActivities({210+ environmentId: selectedThreadShell.environmentId,211+ input: { threadId: selectedThreadShell.id, ...cursorInput },212+ })213+ .then((result) => {214+ // Window/thread reset while in flight — drop the page so it can't215+ // repopulate state cleared by the reset.216+ if (olderActivitiesGenRef.current !== gen) {217+ return;218+ }219+ if (result._tag !== "Success") {220+ return;221+ }
- apps/web/src/components/ChatView.tsx line 2019OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -1728,0 +1873,21 @@1873+ const fresh = page.activities.filter((activity) => !seen.has(activity.id));1874+ if (fresh.length > 0) {1875+ setOlderActivities((prev) => [...fresh, ...prev]);1876+ }1877+ setOlderLoaded(true);1878+ setOlderHasMore(page.hasMore);1879+ })1880+ .finally(() => {1881+ if (olderActivitiesGenRef.current === gen) {1882+ inFlightOlderKeyRef.current = null;1883+ setLoadingOlderActivities(false);1884+ }1885+ });1886+ }, [1887+ activeThread,1888+ activeThreadActivityRequestKey,1889+ hasMoreOlderActivities,1890+ threadActivities,1891+ loadThreadActivities,1892+ ]);1893+apps/web/src/components/ChatView.tsx line 5779Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -5076,3 +5241,6 @@50765241 activeTurnStartedAt={activeWorkStartedAt}50775242 listRef={legendListRef}50785243 timelineEntries={timelineEntries}5244+ hasMoreOlder={hasMoreOlderActivities}5245+ loadingOlder={loadingOlderActivities}5246+ onLoadOlder={loadOlderActivities}
- apps/mobile/src/features/threads/ThreadFeed.tsx line 1511OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -1486,4 +1504,8 @@14861504 keyboardLiftBehavior="whenAtEnd"14871505 estimatedItemSize={180}14881506 initialScrollAtEnd1489- ListHeaderComponent={<View style={{ height: topContentInset }} />}1507+ ListHeaderComponent={1508+ <View style={{ height: topContentInset }}>1509+ {loadingOlder ? <ActivityIndicator style={{ marginTop: 8 }} /> : null}1510+ </View>1511+ }apps/server/src/orchestration/Layers/ProjectionSnapshotQuery.ts line 127Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -116,3 +117,10 @@116117 const ThreadIdLookupInput = Schema.Struct({117118 threadId: ThreadId,118119 });120+121+/**122+ * Maximum number of most-recent activities loaded into a thread-detail snapshot.123+ * Bounds peak memory when opening a long-lived thread; older activities are124+ * fetched on demand (lazy-load, planned) and live ones stream in via events.125+ */126+const THREAD_DETAIL_ACTIVITY_WINDOW = 500;
- apps/mobile/src/features/threads/ThreadRouteScreen.tsx line 199Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -72,4 +72,6 @@7272 const composer = useThreadComposerState();7373 const gitState = useSelectedThreadGitState();7474 const gitActions = useSelectedThreadGitActions();75- const requests = useSelectedThreadRequests();75+ // Derive pending requests from the FULL loaded set (older pages + live76+ // window) so a prompt the user scrolled back to load still surfaces.77+ const requests = useSelectedThreadRequests(composer.mergedActivities);
- apps/web/src/components/chat/MessagesTimeline.tsx line 365OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -353,3 +360,6 @@353360 if (isAtEnd !== undefined) {354361 onIsAtEndChange(isAtEnd);355362 }363+ // Reaching the top lazy-loads older history; maintainVisibleContentPosition364+ // (set on the list) keeps the viewport anchored when rows prepend.365+ if (state?.isAtStart && hasMoreOlder && !loadingOlder) {apps/server/src/orchestration/http.ts line 39Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -29,4 +29,8 @@2929 Effect.fn("environment.orchestration.snapshot")(function* (args) {3030 yield* annotateEnvironmentRequest(args.endpoint.name);3131 yield* requireEnvironmentScope(AuthOrchestrationReadScope);32+ // The only consumer (the `t3` CLI project resolver) reads just33+ // `.projects`, so use the command read model — it returns the same34+ // OrchestrationReadModel shape but never materialises the per-thread35+ // activity/message/checkpoint tables (490MB+ on a busy DB → heap OOM).3236 return yield* projectionSnapshotQuery
- apps/web/src/components/ChatView.tsx line 1772OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -1728,0 +1752,21 @@1752+ input: { threadId: activeThreadIdForActivities, ...cursor },1753+ });1754+ // Failures stay silent on web (the "Load older history" affordance itself1755+ // is the retry surface); returning null keeps `hasMore` for the retry.1756+ return result._tag === "Success" ? result.value : null;1757+ },1758+ [activeThreadEnvironmentIdForActivities, activeThreadIdForActivities, loadThreadActivities],1759+ );1760+ const {1761+ mergedActivities: threadActivities,1762+ hasMoreOlder: hasMoreOlderActivities,1763+ loadingOlder: loadingOlderActivities,1764+ loadOlder: loadOlderActivities,1765+ } = useOlderThreadActivities({1766+ threadKey: activeThread ? `${activeThread.environmentId}\u0000${activeThread.id}` : null,1767+ liveActivities: activeThread?.activities ?? EMPTY_ACTIVITIES,1768+ hasMoreLiveActivities: activeThread?.hasMoreActivities ?? false,1769+ loadPage: loadOlderActivitiesPage,1770+ });1771+1772+
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:XL
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XXL
- apps/web/src/components/chat/MessagesTimeline.tsx line 425Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -375,4 +387,12 @@375387376388 strip.dataset.inView = inView ? "true" : "false";377389 }378- }, [listRef, minimapItems, minimapStripMap, onIsAtEndChange]);390+ }, [391+ listRef,392+ minimapItems,393+ minimapStripMap,394+ onIsAtEndChange,395+ hasMoreOlder,396+ loadingOlder,397+ onLoadOlder,398+ ]);apps/web/src/components/chat/MessagesTimeline.tsx line 425Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -375,4 +387,12 @@375387376388 strip.dataset.inView = inView ? "true" : "false";377389 }378- }, [listRef, minimapItems, minimapStripMap, onIsAtEndChange]);390+ }, [391+ listRef,392+ minimapItems,393+ minimapStripMap,394+ onIsAtEndChange,395+ hasMoreOlder,396+ loadingOlder,397+ onLoadOlder,398+ ]);
- @@ -1390,0 +1441,21 @@1441+ .pipe(1442+ Effect.mapError(1443+ (cause) =>1444+ new OrchestrationGetSnapshotError({1445+ message: `Failed to load thread ${input.threadId}`,1446+ cause,1447+ }),1448+ ),1449+ );1450+1451+ if (Option.isNone(snapshot)) {1452+ return yield* new OrchestrationGetSnapshotError({1453+ message: `Thread ${input.threadId} was not found`,1454+ cause: input.threadId,1455+ });1456+ }1457+1458+ return Stream.concat(1459+ Stream.make({ kind: "snapshot" as const, snapshot: snapshot.value }),1460+ bufferedLiveStream,1461+ );
- @@ -1398,0 +1455,21 @@1455+ }),1456+ ),1457+ );1458+1459+ if (Option.isNone(snapshot)) {1460+ return yield* new OrchestrationGetSnapshotError({1461+ message: `Thread ${input.threadId} was not found`,1462+ cause: input.threadId,1463+ });1464+ }1465+1466+ const replacementSnapshot =1467+ input.requestCompletionMarker === true1468+ ? Stream.make(1469+ { kind: "snapshot" as const, snapshot: snapshot.value },1470+ { kind: "synchronized" as const },1471+ )1472+ : Stream.make({1473+ kind: "snapshot" as const,1474+ snapshot: snapshot.value,1475+ });@@ -1190,3 +1210,17 @@11901210 ),11911211 { "rpc.aggregate": "orchestration" },11921212 ),1213+ [ORCHESTRATION_WS_METHODS.getThreadActivities]: (input) =>1214+ observeRpcEffect(1215+ ORCHESTRATION_WS_METHODS.getThreadActivities,1216+ projectionSnapshotQuery.getThreadActivitiesPage(input).pipe(1217+ Effect.mapError(1218+ (cause) =>1219+ new OrchestrationGetThreadActivitiesError({1220+ message: "Failed to load thread activities page",1221+ cause,1222+ }),1223+ ),1224+ ),1225+ { "rpc.aggregate": "orchestration" },1226+ ),
- @@ -1271,0 +1328,21 @@1328+ ),1329+ );1330+1331+ if (Option.isNone(snapshot)) {1332+ return yield* new OrchestrationGetSnapshotError({1333+ message: `Thread ${input.threadId} was not found`,1334+ cause: input.threadId,1335+ });1336+ }1337+1338+ const replacementSnapshot =1339+ input.requestCompletionMarker === true1340+ ? Stream.make(1341+ { kind: "snapshot" as const, snapshot: snapshot.value },1342+ { kind: "synchronized" as const },1343+ )1344+ : Stream.make({1345+ kind: "snapshot" as const,1346+ snapshot: snapshot.value,1347+ });1348+ return Stream.concat(replacementSnapshot, bufferedLiveStream);
juliusmarminge closed this
Sign in to join this conversation.


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 Plus
Run ID:
34ea15ec-9247-45dc-9bbe-39429d23002cYou 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