Skip to content
Source
Sign inSign up
pingdotgg/t3code

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 intomain fromrefs/pull/3510/headopened View on GitHub

Fixes the server-side root cause behind #2761 (and likely #996).

What Changed

The server used to load a thread's entire history — every tool activity, message, and checkpoint — into memory at once. On a busy database that's hundreds of MB, which exhausted the Node heap and crashed the server (and made large threads slow to load / churn reconnects, as reported in #2761).

Now the server loads only the most recent slice of a thread's activity and tells the client whether older history exists; the web and mobile apps fetch older pages on demand as you scroll up. Deep history is still fully reachable — it's paged in instead of loaded all at once.

  • Server: the snapshot endpoint and the t3 CLI offline path stop loading every thread's full history (they only read the project list). Thread detail is bounded to the most recent activities, with a hasMoreActivities flag and a cursor-paginated getThreadActivities RPC for older pages. The older-page query is shaped to use the existing index instead of a full sort.
  • Reconnect catch-up: shell/thread subscriptions replay only a recent gap (up to 1,000 global events); older cached cursors receive a fresh projection snapshot instead of traversing the full event log.
  • Web / Mobile: lazy-load older history on scroll-up — prepend older pages, anchored so the viewport doesn't jump.

The commits remain separated by server, web, mobile, shared-client, reconnect-safety, and rebase-formatting concerns so each layer is independently reviewable.

Why

Programs in a thread emit a lot of tool activity over time. The server treated "open a thread" (and "load the snapshot") as "read all of it from SQLite into memory." For a long-lived thread or a busy database, that single read materialised more than the heap could hold, so the process ran out of memory and died — and even when it didn't crash, shipping one giant snapshot blocked the connection (#2761). Bounding the read + paging older history on demand keeps memory flat regardless of how much history a thread accumulates.

UI Changes

The web and mobile timelines gain a small "Load older history" affordance and a loading spinner when you scroll to the top of a thread longer than the window. It's a minor, additive interaction. I wasn't able to attach before/after screenshots or a scroll video here — happy to add them, or the server commit alone (no UI) carries the actual reliability fix if you'd rather review that first.

Checklist

  • I explained what changed and why
  • before/after screenshots for UI changes — to be added (web/mobile lazy-load affordance)
  • video for the scroll-up interaction — to be added
  • The server fix is independently reviewable (first commit, no UI)

🤖 Generated with Claude Code


Note

High Risk Changes core read paths (bounded thread detail, snapshot/CLI switching to command read model, subscribe catch-up behavior) and pagination edge cases for sequenced vs legacy activities; any consumer expecting a full snapshot or unbounded replay could break.

Overview Server memory and API: Thread detail now loads only the 500 most recent activities and sets hasMoreActivities when more exist. getThreadActivities pages older rows via sequence or legacy (createdAt, activityId) cursors. The orchestration HTTP snapshot and t3 CLI offline path use getCommandReadModel instead of materializing full per-thread tables. subscribeThread replays at most 1,000 global events after the cursor; otherwise it emits a replacement thread snapshot (with live events buffered so nothing is lost).

Clients: New useOlderThreadActivities in client-runtime prepends paged history, dedupes, and resets on live-window reshape. Web and mobile scroll-up (and explicit controls) load older pages; the feed and composer use merged activities so approvals/user-input prompts still surface after scrolling back. Mobile picks the newest open pending request when multiple exist in the merged set. Sidebar thread prewarming is removed.

Contracts: OrchestrationThread gains optional hasMoreActivities; HTTP snapshot success type documents empty thread payloads on the command read model.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit eac66d8abaccc0ecda0a4862aeaeb74343f3a243. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

Paginate large thread activity history to prevent server memory exhaustion

  • Caps thread detail snapshots to the 500 most recent activities and adds a hasMoreActivities flag on OrchestrationThread payloads when older history exists.
  • Adds a new orchestration.getThreadActivities WebSocket RPC to fetch older activities using a sequence-based or legacy unsequenced (createdAt/id) cursor, with a max page size of 500.
  • Bounds subscribeThread catch-up replay to 1000 events; for stale or invalid cursors, sends a thread snapshot followed by buffered live events instead of attempting unbounded replay.
  • Adds useOlderThreadActivities hook in client-runtime and wires it into ChatView (web) and useThreadComposerState (mobile) to support infinite scroll-up with deduplication and reshape detection.
  • The MessagesTimeline (web) and ThreadFeed (mobile) components now render a 'Load older history' button or loading indicator at the top, with auto-load on scroll to start.
  • Risk: the orchestration/snapshot HTTP endpoint and offline CLI snapshot now return the command read model (getCommandReadModel) instead of the full snapshot, which is a breaking change for any consumers relying on the full activity history from that endpoint.
Macroscope summarized eac66d8.
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      Important

      Review skipped

      Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

      ⚙️ Run configuration

      Configuration used: Repository UI

      Review profile: CHILL

      Plan: Pro Plus

      Run ID: 34ea15ec-9247-45dc-9bbe-39429d23002c

      You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

      Use the checkbox below for a quick retry:

      • 🔍 Trigger review
      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create PR with unit tests

      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
      Comment `@coderabbitai help` to get the list of available commands.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    3. Thanks Bugbot — addressed in cddc7e19f:

      • Reconnect leaves stale older pages / Revert keeps lazy-loaded activities (both): the lazy-load state now resets when the live window's oldest activity id changes, not just on thread switch. That id is stable while activities only append, so it doesn't fire during a normal turn — but a reconnect re-snapshot or a checkpoint revert that drops live rows changes it, invalidating the prepended older pages. Applied to web and mobile.
      • Web skips live activity dedup: web now dedups a new older page against both the already-loaded older pages and the live window (mobile already did this), so a boundary overlap can't produce duplicate ids.
      • Unsequenced cursor hides sequenced history: I believe this is a false positive. Legacy NULL-sequence rows always sort as the oldest in both the detail window (sequence DESC, NULLs last) and the pager. So the oldest-loaded row becomes unsequenced only after every sequenced row is already in the loaded set — there are never sequenced rows older than an unsequenced one for the sequence IS NULL cursor to strand. Happy to add a test if useful.
    4. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Needs human review

      Introduces a new RPC endpoint and pagination infrastructure across server and clients, fundamentally changing how thread activities are loaded (windowed to 500 with lazy-load). While addressing memory concerns, this is substantial new capability with cross-cutting runtime behavior changes rather than a simple bug fix.

      You can customize Macroscope's approvability policy. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    5. Addressed the latest review in 75d25e266 (rebased on current main):

      • Stale in-flight load after reset — the reset now bumps a generation counter (olderActivitiesGenRef); the in-flight load captures it at dispatch and drops its result in .then()/.finally() if it changed, so a late page can't repopulate the cleared state. Replaces the thread-key-only staleness check (which was unchanged on a same-thread reshape).
      • Revert may skip reset / Reconnect leaves stale pages — the reset now also fires when the live window shrinks (a checkpoint revert that drops rows without changing the oldest row), not just when the oldest id changes (reconnect). A pure append (same oldest, larger count) keeps the loaded pages. Applied to web and mobile.
      • Empty page churns / loops — when dedup leaves nothing new, the handler returns without creating a new array reference and stops, so an unadvanced cursor can't loop identical requests.
      • Web skips live dedup — dedups against the full merged set (older + live).
      • Unsequenced cursor hides sequenced history — I believe this is a non-issue and added a server regression test to prove it: NULL-sequence rows always sort oldest, so when the oldest loaded row is unsequenced every sequenced row is already in the window; the sequence IS NULL cursor reaches all 103 older unsequenced rows in the test without stranding any of the sequenced ones.

      Server/web/mobile typecheck, lint, and the projection + timeline suites pass.

    6. Addressed the latest review round:

      Cursor — "Append clears lazy-loaded history" (Medium) — The reset effect used liveThreadActivities[0]?.id as the live window's oldest boundary. The reducer's activityOrder sorts unsequenced rows to the end (a missing sequence is treated as newest) while the server snapshot lists legacy unsequenced rows first, so the first live append re-sorted the array and shifted index 0 — making a plain append look like a window reshape and wrongly clearing the user's scrolled-up history. Replaced it with an order-independent oldest sentinel, liveWindowOldestActivityId (min by createdAt, then id), which is stable across appends (always newest) and only changes on a genuine reshape (reconnect re-snapshot / revert). Applied to both ChatView and the mobile composer; the helper lives in client-runtime with unit tests.

      macroscope — mixed-thread flash (Low, ChatView.tsx:1724) — Moved the older-pages reset from useEffect to useLayoutEffect so the cleared state commits before paint; otherwise a thread switch rendered one frame with the previous thread's lazy-loaded pages still merged in, flashing stale work-log/approval rows. Mirrored in mobile.

      The two earlier macroscope Mediums (1703 staleness guard, 1762/1786 empty-fresh loop) are already ✅ resolved in the prior commit — the generation-ref guard supersedes the request-key check, and the empty-fresh path early-returns without churning the array. The High 1772 ("unsequenced cursor hides sequenced history") remains a false positive: the lazy-load cursor (threadActivities[0]) is only unsequenced when the whole thread fits the window, in which case hasMoreActivities is false and no sequenced rows are stranded.

      pnpm --filter @t3tools/web typecheck, --filter @t3tools/mobile typecheck, the client-runtime reducer suite (24 passing incl. the new helper specs), and lint are green. Squashed into the lazy-load-hardening commit and rebased on upstream/main.

    7. Latest round:

      Cursor — "Wrong pagination cursor after live sort" (High). Valid consistency gap I introduced last round. I'd made the reshape sentinel order-independent (liveWindowOldestActivityId = chronological-oldest) but left the pagination cursor on threadActivities[0], which the reducer can fill with a newer sequenced row (it sorts unsequenced rows to the end). Those two now agree: extracted oldestActivityByChronology(activities) and made the cursor page from it in both ChatView and the mobile composer, so paging always continues from the genuinely-oldest loaded row (driving the unsequenced beforeCreatedAt/beforeActivityId cursor when that row is legacy-unsequenced, instead of a beforeSequence that could skip it). The sentinel now delegates to the same helper. Added a reducer test asserting the cursor-oldest is the unsequenced legacy row and that the sentinel agrees.

      Cursor — "Stale hasMore after revert" (Medium). False positive. thread.reverted keeps activity.turnId === null || retainedTurnIds.has(activity.turnId) — it drops activities for the reverted (newer) turns, never the older history. hasMoreActivities describes whether older rows exist beyond the window, which a revert of newer turns doesn't change, so retaining the flag is correct. (And even if it were stale-true, the lazy-load already no-ops on an empty page: fresh.length === 0 clears hasMore without looping.)

      @t3tools/web + @t3tools/mobile + @t3tools/client-runtime typecheck clean, reducer suite 26 passing, lint clean. Squashed into the lazy-load-hardening commit and rebased on upstream/main.

    8. Self-review (10-angle, max effort) of 848cff64

      Ran an adversarial multi-angle review and grounded the findings against the real 1.5 GB database (131,532 activities). Posting the results.

      Key empirical finding

      The projection_thread_activities.sequence column is 100% NULL in every database I can observe (both the 4 MB dev DB and the 1.5 GB realistic one), and 0 threads have a NULL-sequence row newer than a sequenced one. runtimeEventToActivities only sets sequence from event.sessionSequence, which no provider currently emits. So the beforeSequence/sequenced-row pathway is never exercised in production — all paging goes through the created_at keyset. This reframes the scary-looking findings as latent, not live.

      Fixed

      SevFindingFix
      Low (hardening)The internal SQL-input schemas typed beforeSequence/limit as bare Schema.Number, looser than the contract's NonNegativeInt. The WHERE clause (sequence < beforeSequence OR sequence IS NULL) is only equivalent to the old COALESCE(sequence,-1) < beforeSequence for non-negative cursors — a negative one silently returns only unsequenced rows.Tightened both internal schemas to NonNegativeInt so any future non-RPC caller is validated, not just the RPC boundary. Typecheck + 11 pager tests green.

      Latent / by-design (NOT changed — flagging for a decision)

      • Window vs reducer NULL-ordering disagreement (highest-severity-if-triggered): the server window orders sequence DESC (SQLite → NULLs last/oldest) while the client reducer's activityOrder uses sequence ?? MAX_SAFE_INTEGER (NULLs newest). They only agree today because every row is NULL. If sequence is ever partially backfilled, a thread with mixed rows would (a) drop the newest unsequenced rows from the 500-window and (b) paginate in a different order than it displays. The robust fix is to order both sides by created_at consistently — but that's an index-strategy change (the covering index leads with sequence) and a no-op today, so I've left it. Recommend either ordering by created_at end-to-end, or guaranteeing sequence is all-or-nothing.
      • Speculative sequence machinery: given the above, the entire sequenced-cursor arm (second SQL query, union input arm, "beforeSequence" in input branch, the sequence-leading index) is dead in practice. A single (created_at, activity_id) keyset would cover 100% of today's reality with ~half the surface. Kept as forward-looking, but worth a conscious call.
      • web/mobile duplication (AGENTS.md "Duplicate logic across multiple files … should be avoided"): the ~120-line lazy-load state machine (gen guard, in-flight ref, reshape useLayoutEffect, dedup) is near-verbatim in ChatView.tsx and use-thread-composer-state.ts. Should become one shared hook — deferred because it's a cross-app React-architecture refactor, not a surgical fix.
      • Asymmetry: activities are windowed to 500 but messages in the same getThreadDetailById are still unbounded, so the heap-OOM rationale is only half-applied.
      • handleScroll/loadOlder identity churn on every live append (perf, not correctness); THREAD_DETAIL_ACTIVITY_WINDOW overloaded as window size + default page + max page.

      Verified safe (no action)

      getSnapshot→getCommandReadModel (only the CLI reads .projects); toReversed() (Node/lib supports it); mapThreadActivityRow typing; hasMoreActivities optional doesn't break fixtures/decoders; window slice/hasMore arithmetic; the empty-page stop guard; sequence===0 cursor; created_at tie-break cursor. No CLAUDE.md/AGENTS.md violations beyond the duplication note.

    9. Addressed the latest review round (ead248b4)

      Three threads — two fixed, one verified as a false positive. Both fixes applied to web (ChatView) and mobile (use-thread-composer-state) identically.

      🟡 Cursor — "Duplicate page ends pagination early" (r3455736449) — Fixed. Paging now runs off an explicit olderCursorRef that advances to each page's oldest row (pages are ascending, so [0] is oldest) on every successful page — even one that dedupes to zero new rows. Because the server cursor is strict, the cursor strictly decreases, so an all-overlap page keeps paging (respecting the server's page.hasMore) without re-requesting the same cursor or looping. The old setOlderHasMore(false) early-stop is removed.

      🟢 macroscope — "stale dedup seen" (r3455790594) — Fixed as suggested. Added a threadActivitiesRef (mobile: mergedActivitiesRef) assigned the merged array every render; the .then() dedup now builds seen from …Ref.current instead of the closure-captured snapshot, so a live append or a prior prepend that settles mid-flight is always reflected.

      🟡 Cursor — "Stale hasMore after revert" (r3455516138) — False positive. thread.reverted keeps turnId === null || retainedTurnIds.has(turnId), dropping activities for the reverted (newer) turns and keeping older ones. hasMoreActivities describes whether rows exist older than the window, which a newer-turn revert doesn't change — so retaining it is correct. No code change.

      These were latent (reachable only in the mixed sequenced+unsequenced case, which never occurs — sequence is 100% NULL in the real DB), but the fixes make paging correct-by-construction rather than relying on that invariant.

      Verified: @t3tools/web + @t3tools/mobile typecheck clean, lint clean, reducer (26) / MessagesTimeline (12) / pager (11) suites green. Squashed into the lazy-load commit and rebased on upstream/main.

    10. Follow-up found by a later review round (documenting, not fixed here)

      Newest-500 window can hide an unresolved approval prompt. derivePendingApprovals (web/mobile/tui) runs over the windowed activity set. If a turn emits 500+ activities after an approval.requested is raised (parallel tool fan-out, verbose work-log streaming), the request row falls out of the window and no approval prompt renders — the thread looks stuck "working" unless the user scrolls up far enough to lazy-load the request row back in. Narrow in practice (turns usually block while an approval is pending), but real under heavy fan-out.

      I prototyped the obvious server fix — unioning unresolved approval.requested/user-input.requested rows into the windowed snapshot — but it breaks lazy-load: an injected old row becomes the client's chronological-oldest, so the paging cursor jumps past the gap between it and the window bottom, permanently skipping rows. The correct shape is a contract-level change: return pinned unresolved-request activities in a separate field from the pageable window, and have clients merge them into derivations but not into paging. That spans contracts + server + three clients, so I'm flagging it as a follow-up rather than bolting it onto this PR.

    11. Addressed the latest review round (8328c8ad)

      Two findings on the mobile client, both fixed:

      🔴 Mobile approvals ignored lazy-loaded activities (r3515136008) — useSelectedThreadRequests derived pending approvals/user-input from the windowed live set only. It now takes the activity set as a parameter and ThreadRouteScreen passes useThreadComposerState().mergedActivities (older pages + live window), matching web's derivation over the merged timeline. Sound by construction: resolutions are always newer than their requests, so a loaded request whose resolution exists always has that resolution in the contiguous loaded range — no stale-prompt false positives. (A request older than anything loaded remains the cross-client windowing follow-up documented earlier.)

      🟡 Silent failure left hasMore promising unreachable history (r3515148588) — a failed page load now surfaces Could not load older thread history. via the connection-error banner (interruptions stay silent). Deliberately did not adopt the suggested setOlderHasMore(false): the history still exists server-side, and clearing the flag would make it unreachable until a reshape — the opposite of the intent. Keeping it true lets scroll-to-top retry (in-flight ref + loading state already reset in .finally()).

      Mobile typecheck + lint clean, reducer suite 26 passing. Squashed into the hardening commit; still 0 behind upstream/main.

    12. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟡 Medium

      https://github.com/pingdotgg/t3code/blob/8328c8ad5af48971259d89273ccdfe91cf050dae/apps/web/src/components/chat/MessagesTimeline.tsx#L494

      The early return at rows.length === 0 && !isWorking renders the "Send a message" empty state instead of the list. deriveMessagesTimelineRows can produce zero visible rows from non-empty timelineEntries — for example, when the window only contains tool-neutral work entries that workEntryIndicatesToolNeutralStatus filters out — and hasMoreOlder can still be true. In that state the ListHeaderComponent with the "Load older history" button is never rendered, so the user loses the only control that can fetch the page where the actual conversation lives. Consider guarding the empty state with !hasMoreOlder && !loadingOlder so the list (and its header) still renders when older history is available.

      ✅ Resolved in b3b47b8f785c830dafef11974b9aa232b5bb53cb

    13. Fixed in b3b47b8f as suggested — the empty-state early return is now guarded with !hasMoreOlder && !loadingOlder, so a window that derives zero visible rows (tool-neutral work entries only) still renders the list and its "Load older history" header instead of stranding the user on the empty state.

    14. Sorry, I'm unable to act on this request because you do not have permissions within this repository.

    15. Consolidation (e63995be) — one lazy-load engine instead of per-client copies

      Half of this PR's review churn was the same state machine hand-copied into the web ChatView and the mobile composer (~160 lines each), with every fix applied twice and the copies drifting. This commit extracts the shared engine:

      useOlderThreadActivities (client-runtime, react as an optional peer dep scoped to the subpath) owns all the review-hardened behavior in one place: the reshape-sentinel reset (reconnect/revert clear pages, appends don't), the generation guard, synchronous in-flight coalescing, the advancing cursor (all-overlap pages keep paging), dedup against the latest merged set, and hasMore-preserving failure handling. Clients pass a loadPage transport wrapper and keep only their platform scroll trigger + error surfacing (web stays silent — the "Load older history" button is its retry surface; mobile surfaces the connection-error banner).

      The decision kernel (reshape detection, cursor selection, page dedup) is exported as pure functions with unit tests, so the drift-prone logic is directly tested rather than exercised only through app behavior.

      Net effect: web/mobile app code shrinks by ~220 lines; a future fix lands once. Web + mobile + client-runtime typecheck clean; 36 client-runtime tests (10 new kernel tests) and the 15 timeline tests pass; lint clean; 0 behind upstream/main.

    16. carlulsoe(GitHub profile, opens in a new tab)commented

      Hi, i experienced the same issue: Real-world validation for the reconnect-safety part of this PR:

      • An Android client resumed its cached shell at approximately sequence 46,900 while the server projection was at approximately 48,450.
      • subscribeShell({ afterSequence }) partially advanced, then stopped delivering newer shell state. The connection remained alive (heartbeats continued), but recent threads never appeared.
      • The server was running 0.0.29-nightly.20260712.791.
      • As an operational hotfix, I changed the stale-resume path to attach the live buffer, load an authoritative shell snapshot, then replay only events newer than that snapshot. After reconnecting, the Android client received the snapshot and immediately converged to the browser/server state.
      • The unrelated Node runtime change was ruled out as the cause.

      This cursor was about 1,550 global events behind, so the 1,000-event cutoff introduced here would have selected the fresh-snapshot path and avoided the failure. This is good evidence that bounding shell/thread catch-up and falling back to a current snapshot is needed in practice, not only for memory protection.

    17. olafura(GitHub profile, opens in a new tab)commented

      Hi, i experienced the same issue: Real-world validation for the reconnect-safety part of this PR:

      • An Android client resumed its cached shell at approximately sequence 46,900 while the server projection was at approximately 48,450.
      • subscribeShell({ afterSequence }) partially advanced, then stopped delivering newer shell state. The connection remained alive (heartbeats continued), but recent threads never appeared.
      • The server was running 0.0.29-nightly.20260712.791.
      • As an operational hotfix, I changed the stale-resume path to attach the live buffer, load an authoritative shell snapshot, then replay only events newer than that snapshot. After reconnecting, the Android client received the snapshot and immediately converged to the browser/server state.
      • The unrelated Node runtime change was ruled out as the cause.

      This cursor was about 1,550 global events behind, so the 1,000-event cutoff introduced here would have selected the fresh-snapshot path and avoided the failure. This is good evidence that bounding shell/thread catch-up and falling back to a current snapshot is needed in practice, not only for memory protection.

      carlulsoe Thank your for testing it, glad it helps

    18. Real-world confirmation that this PR targets the right root cause: hit the exact failure mode on 0.0.29-nightly.20260718.841 — backend child OOMs at the default V8 heap cap (~45 s after startup, RSS → 3.7 GB) while loading a 5.1 GB state.sqlite with 1.54M orchestration_events, producing an endless "cannot connect remote endpoint 127.0.0.1:3773" crash-loop.

      Full diagnostics posted in https://github.com/pingdotgg/t3code/issues/996#issuecomment-5019806566. Notable data point for sizing the page limits: in-memory expansion was roughly 5× the raw JSON payload, and single threads can reach 165k+ events, so per-thread pagination (not just per-snapshot) matters. Would love to see this merged — currently the only user-side fix is manual SQLite surgery.

    19. danieliser(GitHub profile, opens in a new tab)commented

      Real-world macOS desktop validation: this PR targets the backend OOM path we captured.

      The test profile had an untouched 4.43 GiB state.sqlite, approximately 1.24M orchestration events, and 432k projected activities. Before the patch, the packaged backend listened successfully and then OOM-aborted 35–85 seconds later at roughly 2.8 GiB RSS. The native stack passed through node::sqlite::StatementSync::All and V8 string creation.

      Tracing showed cached task cursors 271k–591k global events behind. subscribeThread read the entire intervening global range and filtered by task only after SQLite decoded it. Electron’s first-ten sidebar detail prewarmer caused several catch-ups concurrently.

      I tested all commits from this PR with two companion changes:

      1. The stale-cursor snapshot path now emits synchronized when requestCompletionMarker is true, between the replacement snapshot and buffered live events. A focused regression test covers snapshot -> synchronized.
      2. Electron’s hidden sidebar detail prewarmer was removed. Existing per-task atoms already have a five-minute idle TTL, so unopened sidebar rows should not retain detail streams indefinitely.

      I also used an 8 GiB packaged-backend heap default as a safety rail while preserving explicit NODE_OPTIONS.

      With the same database and no pruning or vacuuming, observed backend RSS stayed around 295k–437k KiB instead of climbing to ~2.8M KiB, port 3773 remained available for 15+ minutes, and no new crash report appeared.

      This was a combined build, so the RSS result should not be attributed to #3510 alone. However, the SQLite trace directly confirms that its bounded replay, stale-snapshot fallback, and activity paging target the actual OOM path.

      I recommend merging after fixing the missing synchronization marker. Recovering the aggregate-indexed per-task replay from closed PR #3825 would be a strong follow-up.

    20. Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

      Fix All in Cursor ❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the [Cursor dashboard](https://www.cursor.com/dashboard/bugbot). Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit d7ddba7aa49131844042ef3ece5bae9e45c81339. Configure [here](https://www.cursor.com/dashboard/bugbot).
    21. Closing in favor of #2829 (orchestration V2).

      #2829 deletes the V1 orchestration layer this PR builds on — apps/server/src/orchestration/**, provider/Layers/*Adapter.ts and provider/Services/** are removed and replaced by apps/server/src/orchestration-v2/**, with the IPC surface renamed to ORCHESTRATION_V2_WS_METHODS. The files this PR touches either no longer exist or are rewritten, so it can't be rebased — it would need reimplementing against the V2 adapters.

      This is not a judgement on the change itself. Several of these are real gaps we still want fixed; the base just moved out from under them.

      Once #2829 merges, please rebase onto main, port the change to the V2 equivalent, and reopen (or open a fresh PR). Ping me and I'll prioritise the review.

    22. juliusmarminge closed this

Sign in to join this conversation.