perf(console): keep long chat sessions responsive - #7176
Conversation
|
Hi @rayrayraykk, this is your 256th Pull Request. 🙌 Join Developer CommunityThanks so much for your contribution! We'd love to invite you to join the official QwenPaw developer group! You can find the Discord and DingTalk group links under the "Developer Community" section on our docs page: We truly appreciate your enthusiasm—and look forward to your future contributions! 😊 We'll review your PR soon. |
There was a problem hiding this comment.
Pull request overview
Improves Console rendering performance for long chat sessions by reducing work during streaming updates and scroll events, and by allowing the browser to skip layout/paint for offscreen message bubbles.
Changes:
- Optimizes the wheel scroll hot path by avoiding style resolution when elements cannot scroll, with a targeted regression test.
- Adds a long-chat configuration toggle to disable the vendor “navigator” user-message anchor scanning, plus coverage.
- Defers expensive Markdown parsing during streaming and applies
content-visibilitycontainment for offscreen bubbles, with CSS regression coverage.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| console/src/pages/Chat/messageScroll.ts | Reorders scrollability checks to avoid getComputedStyle work on non-scrollable ancestors. |
| console/src/pages/Chat/messageScroll.test.ts | Adds a regression test to ensure non-scrollable ancestors don’t trigger style resolution. |
| console/src/pages/Chat/longChatPerformance.ts | Introduces a long-chat performance config that disables user-message anchor measurement. |
| console/src/pages/Chat/longChatPerformance.test.ts | Verifies the long-chat performance configuration stays disabled. |
| console/src/pages/Chat/index.tsx | Wires the long-chat anchor configuration into the vendor bubble list theme options. |
| console/src/pages/Chat/index.module.test.ts | Adds regression assertions for containment/viewport-skipping CSS. |
| console/src/pages/Chat/index.module.less | Applies content-visibility: auto and contain-intrinsic-size to offscreen message bubbles. |
| console/src/pages/Chat/HostBubbles.tsx | Defers Markdown content updates during streaming and memoizes host message rendering. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: zhaozhuang <wb-zz895485@alibaba-inc.com>

Description
Improves Console responsiveness for long chat sessions, especially while an assistant response is streaming or the user scrolls through Markdown-heavy history.
The main sources of repeated work were:
This PR:
Related Issue: None
Security Considerations: None. The change is limited to Console rendering and scroll behavior; it does not alter authentication, persistence, or network boundaries.
Type of Change
Component(s) Affected
Checklist
pre-commit run --all-fileslocally and it passespytestor as relevant) and they passFor Channel Changes (DingTalk, Lark, QQ, Console, etc.)
./scripts/check-channels.sh(or./scripts/check-channels.sh --changed) and it passestests/contract/channels/test_<channel>_contract.py(REQUIRED)create_instance()with proper channel initializationtests/contract/channels/__init__.py)tests/unit/channels/test_<channel>.pyfor complex internal logicNot applicable: this changes the Console chat renderer, not a messaging channel implementation.
Testing
Focused checks also passed for the changed Console files. A card-registration contract test verifies that host card exports remain callable functions, as required by the SDK dispatcher. The existing large
Chat/index.tsxlint findings were not introduced or modified by this PR.Evidence
A local performance fixture was generated and loaded through the real chat history API:
GET /api/chats/<fixture-id>returned HTTP 200 with all 2,300 messages (approximately 0.15 seconds on the test machine).Backend deserialization and the production frontend build both completed successfully with the fixture shape used by the Console.
Additional Notes
User-message anchors remain enabled. Navigator mode is retained because it avoids the minimap variant’s per-bubble position calculation and observation path.