Skip to content

fix(wework): stop streaming scroll jitter - #2425

Merged
qdaxb merged 4 commits into
mainfrom
fix/wework-stream-scroll-jitter
Aug 4, 2026
Merged

qdaxb merged 4 commits into
mainfrom
fix/wework-stream-scroll-jitter

Conversation

@qdaxb

@qdaxb qdaxb commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • keep chat scroll position under the outer scroll area's ownership while virtual rows resize
  • reproduce near-bottom upward scrolling during chunked streaming in the real Tauri desktop E2E
  • sample anchor geometry, DOM mutations, and real scroll events to gate against visible jitter and competing programmatic scroll writes
  • document the new desktop E2E controls in Chinese and English

Root cause

TanStack Virtual adjusted scrollTop when the active streaming row changed size, while ScrollableMessageArea independently restored the user viewport anchor. Both controllers wrote the same scroll container during streaming.

Verification

  • Before the fix, the real Tauri E2E consistently recorded 4 programmatic scroll events after the user stopped scrolling.
  • After the fix, the same scenario recorded 0px anchor movement, 0 direction reversals, and 0 programmatic scroll events across 22 stability samples.
  • pnpm --filter wework test — 269 files, 2689 tests passed
  • pnpm --filter wework exec vitest run src/components/chat/MessageList.virtualization.test.tsx — 9 tests passed
  • Prettier, ESLint, and TypeScript passed for changed Wework files
  • pnpm --filter wework e2e:desktop:streaming-text passed after merging the latest main
  • isolated pnpm --filter wework ai:verify session reached the complete desktop workbench and was stopped cleanly

E2E evidence

wework/test-results/desktop-e2e/2026-08-04T17-51-29-489Z-34562

Summary by CodeRabbit

  • Bug Fixes

    • Improved streaming-message scrolling so user-positioned content remains stable while new text arrives.
    • Prevented automatic scroll adjustments after users manually scroll.
    • Improved handling of dynamic message sizes without unexpected viewport movement.
  • Documentation

    • Expanded desktop streaming-text automation guidance with scroll stability, user interaction, and completion-state checks.

@coderabbitai

coderabbitai Bot commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 9768b72f-60fd-4067-bfd9-c1bd6b210e20

📥 Commits

Reviewing files that changed from the base of the PR and between 2789022 and ce4fc67.

📒 Files selected for processing (1)
  • wework/src/e2e/automation.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • wework/src/e2e/automation.ts

📝 Walkthrough

Walkthrough

The change adds desktop scroll-stability sampling and bottom-relative user scrolling. It disables virtualizer scroll adjustment during item-size changes. It strengthens the streaming-text E2E scenario and updates its English and Chinese documentation.

Changes

Streaming scroll stability

Layer / File(s) Summary
Desktop scroll automation
wework/src/e2e/automation.ts
Adds scrollFromBottomAsUser and scroll-stability sampling with frame, mutation, anchor, and scroll-event tracking.
Virtualizer scroll adjustment guard
wework/src/components/chat/MessageList.tsx, wework/src/components/chat/MessageList.virtualization.test.tsx
Disables scroll-position adjustment outside the virtualizer when item sizes change. Tests track virtualizer instances and verify the behavior.
Streaming scenario validation
wework/e2e/desktop/scenarios/streaming-text.scenario.mjs, docs/en/wework/developer-guide/wework-e2e-automation.md, docs/zh/wework/developer-guide/wework-e2e-automation.md
Uses delayed 48-character chunks, fixed-distance user scrolling, and stability assertions for the anchor, DOM, and scroll events. Documentation describes the updated checks.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant StreamingScenario
  participant DesktopAutomation
  participant MessageListVirtualizer
  StreamingScenario->>DesktopAutomation: Start scroll-stability sampling
  StreamingScenario->>DesktopAutomation: Scroll upward from the bottom
  StreamingScenario->>MessageListVirtualizer: Stream delayed response chunks
  MessageListVirtualizer-->>StreamingScenario: Avoid scroll adjustment on size changes
  DesktopAutomation-->>StreamingScenario: Return anchor and scroll-event samples
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the Wework streaming scroll jitter fix, which matches the main objective of the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/wework-stream-scroll-jitter

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 August 4, 2026 17:59

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@wework/src/e2e/automation.ts`:
- Around line 893-903: Validate options.durationMs in the
startScrollStabilitySampling case before starting sampling, requiring a finite
positive number and rejecting invalid values with an error. Preserve the 1,000
ms default when durationMs is omitted, and ensure only the validated duration
reaches the sampling interval/completion logic.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 16031cfb-532f-44e6-864a-db553bfbaa13

📥 Commits

Reviewing files that changed from the base of the PR and between 20eb31e and 2789022.

📒 Files selected for processing (6)
  • docs/en/wework/developer-guide/wework-e2e-automation.md
  • docs/zh/wework/developer-guide/wework-e2e-automation.md
  • wework/e2e/desktop/scenarios/streaming-text.scenario.mjs
  • wework/src/components/chat/MessageList.tsx
  • wework/src/components/chat/MessageList.virtualization.test.tsx
  • wework/src/e2e/automation.ts

Comment thread wework/src/e2e/automation.ts Resolved
@qdaxb
qdaxb added this pull request to the merge queue Aug 4, 2026
Merged via the queue into main with commit 3d41c34 Aug 4, 2026
45 checks passed
@qdaxb
qdaxb deleted the fix/wework-stream-scroll-jitter branch August 4, 2026 18:54
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