feat(ui): add LRU thread views and on-demand rendering - #136
Conversation
|
The core thread-view retention optimization is already supported on |
|
Could you please check the merge conflicts and assess whether you still want to submit the remaining capabilities, such as On Demand rendering and the configurable view cache? If so, please rebase on the latest |
294ea01 to
d391c62
Compare
|
Thanks for pointing this out. I rebased the branch onto the latest The duplicate Thread-specific LRU/cache implementation has been removed. The configurable View cache now drives #134's shared The non-overlapping capabilities are retained:
I also fixed a remount race found by the new CEF smoke: Radix ScrollArea/virtualizer initialization could reset an initially restored position to the top. Restoration now retries across frames and is consumed only after two stable frames, with a bounded retry window. The updated branch is at |
|
@foreleven need review again, please |
d391c62 to
9b94f59
Compare
Summary
This PR is now rebased onto the latest
mainand integrated with the View-retention work from #134. The duplicate LRU implementation has been removed; the remaining changes extend the sharedRuntimePaneHostand message renderer with configurable performance controls.Relationship to #134
#134 already supplies the shared
RuntimePaneHostthat keeps only recent pane Views mounted while their longer-lived Sessions continue running. This PR now reuses that implementation rather than maintaining a parallel Thread-specific LRU.Capabilities that remain specific to this PR:
User-facing changes
The related settings now live under Settings → General → Performance.
Message rendering
Full and On Demand share the same visual enhancement definitions. Static previews render Markdown, JSON, XML, prompt-variable, and template-expression colors from the existing CodeMirror theme, while hover, inspection, selection, and autocomplete remain CodeMirror-only behaviors after activation.
Virtualization
Auto uses the following Full baselines and applies the rendering multiplier, clamped to 10–200 messages:
×1.5)×2)The threshold is calculated at startup and recalculated when the user switches back to Auto. Message rendering and virtualization remain orthogonal, so users can keep Full or On Demand without virtualization until their conversation size requires it.
View cache and lifecycle
View cache controls the maximum recently used Thread and Trace Views kept mounted, including the active View. The default is 3.
Evicting a View does not evict its Session: background streaming, tool execution, persistence, run status, and undo history continue without an attached View. Editor drafts are committed before eviction, and the existing rule that prevents closing a running tab remains unchanged.
The scroll snapshot stores a stable message ID rather than an index. On remount, the latest index is resolved from that ID and aligned to the viewport end. Restoration now retries across layout frames and is consumed only after two stable frames, covering both Radix ScrollArea initialization and asynchronous virtualizer measurement.
Implementation notes
modal={false}.Performance measurements
The included CEF/CDP benchmark uses isolated generated workspaces. Full methodology and raw-result references are documented in
docs/performance/thread-view-performance-2026-08.md.The benchmark intentionally treats virtualization as a retained-DOM/remount optimization rather than a guarantee of smoother large-distance scrolling; this is why Auto is the default and Off remains available.
Validation
bun run lint:changed— 30 changed source files passed.bun run typecheck:changed— 29 changed source files passed.git diff --check.0pxend-alignment error.1.75pxend-alignment error.0pxerror.