Skip to content

Pause live output follow while reading#3936

Open
lnieuwenhuis wants to merge 10 commits into
pingdotgg:mainfrom
lnieuwenhuis:codex/pause-stream-auto-scroll
Open

Pause live output follow while reading#3936
lnieuwenhuis wants to merge 10 commits into
pingdotgg:mainfrom
lnieuwenhuis:codex/pause-stream-auto-scroll

Conversation

@lnieuwenhuis

@lnieuwenhuis lnieuwenhuis commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Summary

  • stop following streamed output once the reader scrolls away from the live edge
  • preserve the current reading position while new output arrives
  • resume following when the reader returns to the bottom or uses the existing scroll-to-end control

Why

LegendList's internal end-maintenance remained enabled after manual navigation, so streamed layout and data updates could pull the viewport back down even after the timeline scroll mode had detached.

Closes #3925

Validation

  • vp test apps/web/src/components/chat/MessagesTimeline.test.tsx
  • vp check
  • vp run typecheck

Note

Pause live output follow in chat timeline while user navigates toward history

  • Introduces autoFollowEnabled state in ChatViewContent to control whether the message timeline auto-follows the live end; this replaces direct wheel/touch/pointer listener attachment on the scroll node.
  • MessagesTimeline gains an autoFollowEnabled prop and new capture-phase event handlers (wheel, touch, keyboard, pointer) that detect upward/history-directed input and mark a manual navigation session, disabling maintainScrollAtEnd on LegendList.
  • Auto-follow is re-enabled when the user scrolls back to the end, sends a message, switches threads, or calls scroll-to-end; it is disabled when the user navigates away from the end.
  • New utilities in MessagesTimeline.logic.ts standardize directional input detection, scroll-node end resolution, and manual navigation session tracking.
  • Behavioral Change: resolveTimelineIsAtEnd now gives highest precedence to isWithinMaintainScrollAtEndThreshold, changing how the live-edge is determined when that value is present.

Macroscope summarized 0e32afa.


Note

Medium Risk
Scroll and live-follow behavior is easy to regress across wheel, touch, keyboard, and streaming layout updates, though logic is extracted and covered by new unit tests.

Overview
Stops the chat timeline from snapping back to the live edge while the user reads older messages during streaming.

ChatView now tracks timelineAutoFollowEnabled and passes it to the timeline. Auto-follow turns off when the user navigates away from the bottom (via onManualNavigation) and turns back on when they reach the end, send a message, scroll to end, or switch threads. The old useEffect that listened for wheel/touch/pointer on the LegendList scroll node is removed.

MessagesTimeline wires capture-phase handlers (wheel, touch, keyboard, scrollbar pointer) that only treat input as “read history” when it moves toward older content and the list can actually scroll up. That calls onManualNavigation and turns off LegendList maintainScrollAtEnd when autoFollowEnabled is false (also briefly during keyboard-up navigation). Scroll handling uses new logic helpers to decide “at end” vs returning to the live edge after manual scroll.

MessagesTimeline.logic adds pure helpers for directional input, scroll overflow, DOM-based end detection, and prefers isWithinMaintainScrollAtEndThreshold over isNearEnd for live-edge visibility.

Reviewed by Cursor Bugbot for commit 0e32afa. Bugbot is set up for automated code reviews on this repo. Configure here.

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: d3e27fe9-7550-4ee1-9fd8-d99b22a785c9

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@github-actions github-actions Bot added size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Jul 13, 2026
@lnieuwenhuis lnieuwenhuis marked this pull request as ready for review July 13, 2026 11:50
Comment thread apps/web/src/components/chat/MessagesTimeline.logic.ts Outdated
Comment thread apps/web/src/components/chat/MessagesTimeline.logic.ts
@macroscopeapp

macroscopeapp Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

This PR introduces significant changes to how auto-scroll/auto-follow works in the chat timeline, including new event handlers to detect user navigation and pause auto-follow while reading. This represents a meaningful user-facing behavior change that warrants human review.

You can customize Macroscope's approvability policy. Learn more.

@github-actions github-actions Bot added size:L 100-499 changed lines (additions + deletions). and removed size:M 30-99 changed lines (additions + deletions). labels Jul 13, 2026
@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown

Caution

Review failed

An error occurred during the review process. Please try again later.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

Comment thread apps/web/src/components/chat/MessagesTimeline.logic.ts
Comment thread apps/web/src/components/chat/MessagesTimeline.logic.ts
Comment thread apps/web/src/components/chat/MessagesTimeline.tsx
Comment thread apps/web/src/components/chat/MessagesTimeline.tsx Outdated
Comment thread apps/web/src/components/chat/MessagesTimeline.tsx Outdated
Comment thread apps/web/src/components/chat/MessagesTimeline.tsx
Comment thread apps/web/src/components/chat/MessagesTimeline.tsx
Comment thread apps/web/src/components/chat/MessagesTimeline.logic.ts Outdated
Comment thread apps/web/src/components/chat/MessagesTimeline.tsx
Comment thread apps/web/src/components/chat/MessagesTimeline.tsx Outdated
Comment thread apps/web/src/components/chat/MessagesTimeline.tsx
Comment thread apps/web/src/components/chat/MessagesTimeline.logic.ts
Comment thread apps/web/src/components/chat/MessagesTimeline.tsx Outdated
Comment thread apps/web/src/components/chat/MessagesTimeline.tsx Outdated
Comment thread apps/web/src/components/chat/MessagesTimeline.tsx Outdated

@cursor cursor 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.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 3b93406. Configure here.

Comment thread apps/web/src/components/chat/MessagesTimeline.tsx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Stop auto-scrolling when the user reads earlier streamed output

1 participant