Skip to content

perf(flow-chat): smooth large history session rendering#953

Merged
limityan merged 1 commit into
GCWing:mainfrom
limityan:yanzhn/fix-large-session-rendering
May 29, 2026
Merged

perf(flow-chat): smooth large history session rendering#953
limityan merged 1 commit into
GCWing:mainfrom
limityan:yanzhn/fix-large-session-rendering

Conversation

@limityan
Copy link
Copy Markdown
Collaborator

Summary

  • Render completed historical model-round groups progressively: first 80 groups, then 80 more every 16ms; streaming rounds stay fully rendered and already-rendered rounds do not shrink when streaming completes.
  • Fix restored TodoWrite duplicate React keys when legacy/truncated todo ids collide.
  • Replace internal session-view truncation markers with user-facing preview text across restored tool cards and copy/export paths.
  • Fix the usage-report Tooltip ref warning by making the file label ref-forwarding.

Performance / Diagnostic Data

  • Problem logs showed large historical session opens producing 156 and 263 duplicate-key warnings keyed by [truncated for session view]; the stack traced to TodoWriteDisplay.
  • Initial render work for completed historical rounds is now bounded from N groups to 80 groups on the first render, with the rest appended in 80-group chunks. For a 263-group class of case, first-render group work is capped at 80 instead of 263, a 69.6% reduction in initial group render volume.
  • Local debug logs after the duplicate-key/truncation-path fixes showed duplicate-key warnings reduced to 0 and legacy truncation marker logs reduced to 0. This PR also fixes the remaining usage-card ref warning with focused test coverage.
  • This PR does not claim cold-start or interactive_shell_ready improvement; perf(startup): continue reducing desktop startup and interactive shell readiness time #949 remains open for that follow-up optimization.

Risks

  • Very large historical sessions reveal older groups progressively instead of all in one synchronous render. The history loader is visible while this happens; copy/export still reads from the full session state rather than only visible groups.
  • The session preview compaction marker text changes from an internal placeholder to user-facing preview text. The compaction behavior itself is unchanged.

Verification

  • pnpm run lint:web
  • pnpm run type-check:web
  • pnpm --dir src/web-ui run test:run
  • cargo check -p bitfun-desktop
  • cargo test -p bitfun-desktop
  • git diff --cached --check

Refs #949

@limityan limityan merged commit 3a6e6e2 into GCWing:main May 29, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant