Repository navigation
perf(flow-chat): reuse turn indexes and summaries during streaming - #3851
Merged
Merged
Conversation
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.
Summary
Share batched Turn ordinal lookups and reuse Turn summaries across streamed body updates. The reader-owned cache retains scalar identity metadata and invalidates on Turn, catalog, partial-tail, or rendered-history structure changes.
Type and Areas
Type: Performance bug fix.
Areas: Web UI / FlowChat main and BTW conversations.
Motivation / Impact
Long resident conversations rebuilt full ordinal maps for every Turn in two complete summaries on each streamed text update. This quadratic work blocked the main WebView thread and made both the main and side conversation difficult to scroll. The summaries now share a batched lookup and keep stable array identities during body-only updates. Legacy catalog storage fallbacks also use indexed lookups.
Verification
After merging upstream/main at
d3ee3e5b1, the focused FlowChat suites passed 122 tests across 9 files. Frontend type checking, focused ESLint, capability generation checks, and diff whitespace checks also passed.Commands
Local native Windows Debug / Vite testing used the same synthetic 1200-Turn main + 400-Turn BTW history, native backend binary, viewport, and loopback SSE provider before and after the optimization. In the first matched unprofiled dual-stream samples:
All three optimized dual-stream repetitions showed the same improvement. 21 native state checks passed, covering reading anchors during generation, returning while generating or after completion, BTW collapse/return, separate drafts, and Monaco model/text/caret/selection/scroll/undo/redo/save retention. Static scrolling, 24 pane switches, and restart/reload comparisons were also exercised.
Reviewer Notes
Catalog ordinal precedence, sparse and deprecated storage indexes, provisional usage reports, partial-tail offsets, catalog-only history, and explicit history-window offsets retain their existing semantics. Scroll ownership, reading-anchor logic, editor lifecycle, and persisted shapes are unchanged.
Native measurements preceded the latest upstream/main merge; the merged tree was rechecked with the automated commands above. History was synthetic, with BTW history seeded into the renderer; live output used the native runtime/event chain with a local model fixture. Release builds and live remote scenarios were not tested. Occasional static long frames remain outside this change's scope.
Checklist