← Back to PRs

#20610: fix: reduce chat history render limit to improve performance Fixes #…

by anandsuraj open 2026-02-19 04:25 View on GitHub →
app: web-ui size: XS
...20588 The dashboard chat page was becoming unresponsive when sessions accumulated large message histories (200+ messages). This was caused by attempting to render all messages at once in the DOM. Changes: - Reduced CHAT_HISTORY_RENDER_LIMIT from 200 to 50 - This ensures the UI only renders the last 50 messages, significantly reducing DOM nodes and improving browser performance - Users can still scroll up to load more message history if needed The limit of 50 messages strikes a good balance between: - Showing enough context for the current conversation - Keeping DOM rendering performant - Preventing browser hangs and "Page Unresponsive" dialogs ## Summary Describe the problem and fix in 2–5 bullets: - Problem: Dashboard chat page becomes unresponsive when sessions accumulate large message histories (200+ messages) due to rendering all messages in the DOM at once - Why it matters: Large message counts cause UI lag, browser hangs, and "Page Unresponsive" dialogs, severely impacting user experience during long conversations - What changed: Reduced CHAT_HISTORY_RENDER_LIMIT from 200 to 50 to limit DOM nodes and improve rendering performance - What did NOT change (scope boundary): The message fetching logic remains unchanged - we still fetch all messages, just render only the last 50 in the DOM ## Change Type (select all) - [x] Bug fix - [ ] Feature - [ ] Refactor - [ ] Docs - [ ] Security hardening - [ ] Chore/infra ## Scope (select all touched areas) - [ ] Gateway / orchestration - [ ] Skills / tool execution - [ ] Auth / tokens - [ ] Memory / storage - [ ] Integrations - [ ] API / contracts - [x] UI / DX - [ ] CI/CD / infra ## Linked Issue/PR - Closes #20588 - Related # ## User-visible / Behavior Changes Users with large chat histories (>50 messages) will now see only the last 50 messages rendered in the UI, with older messages accessible via scroll-up. This significantly improves UI responsiveness. ## Security Impact (required) - New permissions/capabilities? (No) - Secrets/tokens handling changed? (No) - New/changed network calls? (No) - Command/tool execution surface changed? (No) - Data access scope changed? (No) - If any Yes, explain risk + mitigation: N/A ## Repro + Verification ### Environment - OS: macOS/Linux/Windows - Runtime/container: Node.js - Model/provider: N/A - Integration/channel (if any): Web UI - Relevant config (redacted): CHAT_HISTORY_RENDER_LIMIT = 50 ### Steps 1. Open the chat application 2. Create a conversation or load one with 200+ messages 3. Observe UI responsiveness and scroll behavior 4. Verify that the last 50 messages render smoothly 5. Scroll up to verify more message history can be loaded ### Expected - UI is responsive and doesn't lag - Chat scrolls smoothly without page unresponsive warnings - Last 50 messages display clearly - Older messages can be accessed by scrolling up ### Actual - (Before fix) Page becomes unresponsive with large message counts - (After fix) UI remains responsive with 50 message render limit ## Evidence - [x] Failing test/log before + passing after - [ ] Trace/log snippets - [ ] Screenshot/recording - [ ] Perf numbers (if relevant) ## Human Verification (required) What you personally verified (not just CI), and how: - Verified scenarios: Tested with 200+ message history, confirmed UI responsiveness improvement - Edge cases checked: Empty chat, single message, exactly 50 messages, 51+ messages all render correctly - What you did **not** verify: Mobile UI (needs separate testing), accessibility impact (should be tested) ## Compatibility / Migration - Backward compatible? (Yes - rendering limit change doesn't affect API or data storage) - Config/env changes? (No) - Migration needed? (No) - If yes, exact upgrade steps: N/A ## Failure Recovery (if this breaks) - How to disable/revert this change quickly: Revert to previous CHAT_HISTORY_RENDER_LIMIT value (200) and redeploy - Files/config to restore: ui/src/ui/views/chat.ts line 430 - Known bad symptoms reviewers should watch for: UI lag returning, page unresponsive warnings on large message counts ## Risks and Mitigations - Risk: Users with large chat histories might perceive loss of context if they expect all messages to be visible - Mitigation: System message indicates number of hidden messages, scroll-up loads more context as needed - Risk: Performance regression if limit is increased beyond 50 - Mitigation: Gradual testing with higher limits, monitor performance metrics

Most Similar PRs