Skip to content

fix(wework): smooth streaming message rendering - #1858

Merged
qdaxb merged 3 commits into
mainfrom
agent/smooth-wework-streaming
Jul 10, 2026
Merged

qdaxb merged 3 commits into
mainfrom
agent/smooth-wework-streaming

Conversation

@qdaxb

@qdaxb qdaxb commented Jul 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • buffer streaming assistant text on animation frames with an adaptive reserve to smooth bursty executor delivery
  • reduce repeated Markdown, intrinsic-height, composer, and workspace-panel rendering work
  • add focused tests and document the streaming performance diagnostics workflow in Chinese and English

Root cause

Executor deltas arrive in bursts with occasional network or IPC gaps. Rendering every burst directly made the visible cadence uneven, while repeated Markdown component creation, full streaming-height measurement, and unstable workspace/composer props amplified frontend work. Per-character DOM animation was evaluated and removed because it substantially increased style and paint work.

User impact

Streaming responses advance at a steadier visible cadence without limiting the underlying event rate. Final content still aligns immediately when the stream ends or content is replaced, and completed messages retain normal static Markdown DOM.

Validation

  • pre-push ESLint passed
  • pre-push TypeScript build passed
  • 144 Vitest files passed (1407 tests)
  • clean Web Inspector capture remained approximately 60 fps with negligible GC before the final reserve tuning

Summary by CodeRabbit

  • New Features

    • Improved streaming message rendering with smoother, frame-based text updates.
    • Preserved complete content immediately when streaming ends or content changes.
    • Improved handling of Unicode characters during streamed text updates.
  • Performance

    • Reduced unnecessary message layout measurements and UI rerenders.
    • Improved responsiveness across chat panels and composer interactions.
  • Documentation

    • Added English and Chinese guidance for diagnosing streaming performance issues.
  • Tests

    • Expanded coverage for streaming text, layout stability, Unicode boundaries, and final-content alignment.

@coderabbitai

coderabbitai Bot commented Jul 10, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e2a786f2-4b0b-49ba-95cd-e591a0716e80

📥 Commits

Reviewing files that changed from the base of the PR and between 8585163 and b1de74f.

📒 Files selected for processing (14)
  • docs/en/developer-guide/wework-performance-diagnostics.md
  • docs/zh/developer-guide/wework-performance-diagnostics.md
  • wework/src/components/chat/AssistantMarkdown.tsx
  • wework/src/components/chat/MessageList.test.tsx
  • wework/src/components/chat/messagePretextLayout.test.ts
  • wework/src/components/chat/messagePretextLayout.ts
  • wework/src/components/chat/useBufferedStreamingText.test.ts
  • wework/src/components/chat/useBufferedStreamingText.ts
  • wework/src/components/layout/BufferedChatInput.tsx
  • wework/src/components/layout/DesktopWorkbenchMain.tsx
  • wework/src/components/layout/useWorkbenchProjectWorkControls.ts
  • wework/src/components/layout/workspace-panels/BottomWorkspacePanel.tsx
  • wework/src/components/layout/workspace-panels/RightWorkspacePanel.tsx
  • wework/src/components/layout/workspace-panels/WorkspacePanelActions.tsx

📝 Walkthrough

Walkthrough

This PR adds buffered streaming markdown rendering, stable streaming-message height handling, cached layout measurement, and memoized workspace components, callbacks, and control objects. It also updates related tests and English and Chinese performance documentation.

Changes

Streaming rendering and performance

Layer / File(s) Summary
Buffered markdown rendering
wework/src/components/chat/useBufferedStreamingText.ts, wework/src/components/chat/AssistantMarkdown.tsx, wework/src/components/chat/*test.tsx, docs/*/developer-guide/wework-performance-diagnostics.md
Streaming text advances on animation frames with Unicode-safe prefix handling, tail draining, immediate replacement for non-append updates, memoized markdown renderers, and updated behavioral tests and diagnostics documentation.
Stable streaming message layout
wework/src/components/chat/messagePretextLayout.ts, wework/src/components/chat/messagePretextLayout.test.ts
Streaming messages return a fixed intrinsic height, while completed-message measurements use per-message and string-key caches that can be reset.
Memoized workspace components and controls
wework/src/components/layout/BufferedChatInput.tsx, wework/src/components/layout/useWorkbenchProjectWorkControls.ts, wework/src/components/layout/workspace-panels/*
Chat input, workspace panels, panel actions, and project work controls use memoized component or value boundaries.
Desktop workspace callback wiring
wework/src/components/layout/DesktopWorkbenchMain.tsx
Desktop workbench rendering uses memoized bottom-panel wiring, stable action callbacks, current message references, and shared composer and terminal handlers.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant AssistantMarkdown
  participant useBufferedStreamingText
  participant requestAnimationFrame
  participant Streamdown
  AssistantMarkdown->>useBufferedStreamingText: pass content and streaming state
  useBufferedStreamingText->>requestAnimationFrame: schedule text advancement
  requestAnimationFrame-->>useBufferedStreamingText: provide next buffered prefix
  useBufferedStreamingText-->>AssistantMarkdown: return display content
  AssistantMarkdown->>Streamdown: render buffered markdown
Loading

Possibly related PRs

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/smooth-wework-streaming

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@qdaxb
qdaxb marked this pull request as ready for review July 10, 2026 09:48
@qdaxb
qdaxb merged commit 446d4c2 into main Jul 10, 2026
9 of 11 checks passed
@qdaxb
qdaxb deleted the agent/smooth-wework-streaming branch July 10, 2026 09:48
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