Repository navigation
perf(desktop): persist private history across app restarts - #300
Merged
Merged
Conversation
nixuuu
marked this pull request as ready for review
November 6, 2026 20:38
nixuuu
force-pushed
the
perf/tail-first-1
branch
from
November 6, 2026 21:04
afee425 to
cf16038
Compare
This was referenced Nov 13, 2026
nixuuu
added a commit
that referenced
this pull request
Nov 20, 2026
## Change - Web and desktop show the loaded timeline immediately. Scrolling up to a gap reads one older page. “Show earlier work” loads the selected turn, including turns that span several pages. On mobile, a gesture toward the history edge loads at most one page. - Web, desktop and mobile keep the live stream open when an older page covers the changes already received. If the stream advanced past the page, the client replays from the page checkpoint to recover concurrent edits and deletions. - Desktop persists a bounded history tail. Web and desktop limit inactive expanded content to 32 items and 8 MiB and cancel obsolete reads on reset. An oversized result stays available while in use. Clients reuse the measured size of an unchanged snapshot when leaving a conversation. - Header-only updates preserve the timeline rows. Unchanged controls and heartbeats still run validation and connection diagnostics while avoiding redundant view updates. ## Verification - Chromium on Linux, 2,160 items and 19 subagents. Opening the thread issued 0 older-page requests, down from 16 (453,590 response bytes). Checked scroll restoration, a multi-page turn, a quote, retry after a failed read and a timeline that fits on screen. Tested wide and narrow viewports in both themes. - Android emulator. A layout change after scrolling issued 0 history reads, down from 16. A gesture fetched one page on the existing stream. Twelve pairs of unchanged controls and heartbeats produced 0 React commits, down from 21. Sending a message and resuming from the background advanced and restored the live checkpoint. - With 4,608 synthetic items, 32 exits from an unchanged cached thread required 0 full encodings, down from 32. In a 10,000-item renderer probe, median header-update processing fell from 3.10 ms to 0.007 ms. Forty-eight expanded outputs of 512 KiB retained 7.5 MiB of inactive content, down from 24 MiB. - Targeted domain, history cache, gRPC replay, continuity, work-window and mobile synchronization checks passed, along with web, mobile and domain typechecks and repository lint on the edited files. The concurrent-deletion test compares a paged-and-resumed client with a continuously connected client. - Copy audit (§8) passed. The former idle “Loading earlier work…” label now reads “Show earlier work” and acts as a button. “Loading earlier work…” appears during a read and “Retry” after failure. The native equivalent uses the existing “Show earlier messages” button. - The Windows Electron and day-long Windows session remain unmeasured. Native testing used Android. Additional Expo ESLint reported pre-existing hook findings. Fixes: #300 Fixes: #302 Fixes: #541 Fixes: #556 Fixes: #672 Fixes: #687
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Restarting Electron previously discarded all thread, bot chat and exchange state. This stage saves public protobuf projections in the app's private data directory and restores them before the first watch, so reopening sends the saved journal checkpoint.
The shared durable LRU holds 32 views / 96 MiB, at most 16 MiB per entry. Atomic rename, 0700 directories, 0600 files, projection validation and generation fences protect partial writes and session changes. Mode change, unpair and revocation clear disk and memory. Plain browser sessions deliberately remain memory-only: no conversation content in IndexedDB or localStorage. Polish desktop documentation records the boundary and limits.
Restart findings and measurements
The existing mobile caches really do survive force-stop/relaunch. On an Android Fold emulator, using the current development binary, reopening a 3,000-message thread sent a 433-byte protobuf delta and reopening a 3,000-message bot chat sent a 310-byte delta with zero messages. Cached bot content rendered before the delta arrived. No mobile persistence/schema-key fix was needed. An obsolete development binary initially buffered small streaming responses; the check was repeated on the current build.
For context, the uncached full thread response was 3,559,707 protobuf bytes. Desktop persistence plus a real gateway restart is verified by integration tests; native Electron shell launch-to-paint timing and an actual packaged Electron quit/relaunch remain unverified. The client paging stages below address uncached opens.
Verification
dev, including feat(mobile): float composers and extend layouts edge to edge #292, feat(mobile): add reanimated motion layer on the web's tokens #297/feat(mobile): animate ui state changes with reanimated #298 and ci(release): publish nightlies every 4 hours during the day #304.bun install,bun run gen:check,bun run typecheck,bun run lint,bun run format:checkand Expo lint passed on this stage.No migrations or new native mobile dependencies. No UI copy changes in this stage.