Problem
In long-running threads, older chat history becomes inaccessible in the UI: as a conversation grows, the beginning of the thread disappears from the scrollback.
This makes it hard to recover context in longer chats and power-user sessions.
Current behavior
- The UI retains only a small window of conversation items per thread.
- As more items arrive (streaming deltas, tool output, etc.), earlier items are dropped locally.
Root cause (code)
The frontend unconditionally limits thread items via prepareThreadItems():
src/utils/threadItems.ts has MAX_ITEMS_PER_THREAD = 200.
prepareThreadItems() slices to the last 200 items (normalized.slice(-MAX_ITEMS_PER_THREAD)).
- Reducers call
prepareThreadItems(...) during normal thread updates, so the cap applies continuously.
Proposal
Add an app-wide setting to configure thread history scrollback retention:
- Default stays 200 items (no behavior change for most users).
- Allow power users to increase to higher values (e.g. 500/1000/2000/5000).
- Optional Unlimited mode (stores all items returned by
thread/resume + live items).
UX
Settings: Settings -> Display & Sound (or similar)
- Toggle:
Unlimited chat history
- Number input:
Max items per thread (disabled when Unlimited is on)
- Presets: 200 / 500 / 1000 / 2000 / 5000
- Help text warning about performance/memory costs for large values.
Note: existing thread context menu already has “Sync from server”; after increasing scrollback, users can sync to pull additional older history.
Performance considerations
Increasing retention can increase memory/DOM/render cost. To mitigate:
- Virtualize the message list (
@tanstack/react-virtual is already in the repo and used elsewhere).
- Virtualize at the grouped-item level (tool groups + items), with ResizeObserver measurement like
GitDiffViewer.
Acceptance criteria
- Default remains last-200 behavior.
- Setting persists and applies to new and existing threads.
- Higher limits retain more items; Unlimited retains all items received.
- No major regressions in scroll/auto-scroll behavior.
- Tests cover retention logic (default/custom/unlimited) and settings normalization.
Problem
In long-running threads, older chat history becomes inaccessible in the UI: as a conversation grows, the beginning of the thread disappears from the scrollback.
This makes it hard to recover context in longer chats and power-user sessions.
Current behavior
Root cause (code)
The frontend unconditionally limits thread items via
prepareThreadItems():src/utils/threadItems.tshasMAX_ITEMS_PER_THREAD = 200.prepareThreadItems()slices to the last 200 items (normalized.slice(-MAX_ITEMS_PER_THREAD)).prepareThreadItems(...)during normal thread updates, so the cap applies continuously.Proposal
Add an app-wide setting to configure thread history scrollback retention:
thread/resume+ live items).UX
Settings:
Settings -> Display & Sound(or similar)Unlimited chat historyMax items per thread(disabled when Unlimited is on)Note: existing thread context menu already has “Sync from server”; after increasing scrollback, users can sync to pull additional older history.
Performance considerations
Increasing retention can increase memory/DOM/render cost. To mitigate:
@tanstack/react-virtualis already in the repo and used elsewhere).GitDiffViewer.Acceptance criteria