Skip to content
Source
Sign inSign up
pingdotgg/t3code

Pause live output follow while reading #3936

Closedlnieuwenhuis(GitHub profile, opens in a new tab)wants to merge 20 commits intomain fromrefs/pull/3936/headopened View on GitHub

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 auto-follow in chat timeline during manual scroll navigation

  • Adds manual navigation detection to MessagesTimeline via wheel, touch, keyboard, pointer, and minimap interactions; confirmed upward navigation disables auto-follow and shows the scroll-to-bottom pill.
  • Auto-follow resumes only when the user scrolls back to the bottom after confirmed manual navigation, using the new shouldResumeTimelineAutoFollow logic in timelineScrollAnchoring.ts.
  • Auto-follow state is tracked per-route and resets to enabled on route change via resolveTimelineAutoFollowEnabledForRoute.
  • LegendList maintainScrollAtEnd is disabled when auto-follow is off or a navigation probe is active, preventing the list from snapping back to the bottom during reading.
  • Behavioral Change: onIsAtEndChange now receives a structured { isAtEnd, manualNavigationReachedEnd } object instead of a plain boolean.
Macroscope summarized 7be9742.

Note

Medium Risk Scroll and follow behavior is intricate and user-facing; the onIsAtEndChange callback shape changed, though coverage is added in unit tests.

Overview Stops the chat timeline from pulling the viewport back to the live edge while the user reads older messages during streaming. LegendList maintainScrollAtEnd is now tied to an explicit autoFollowEnabled flag instead of staying on after the parent thought follow was off.

MessagesTimeline detects real navigation toward history (wheel, touch, keyboard, scrollbar drag, minimap jumps) via capture handlers and a short navigation probe, then calls onManualNavigation. Scroll handling reports { isAtEnd, manualNavigationReachedEnd } so ChatView only re-enables follow when shouldResumeTimelineAutoFollow agrees (e.g. user scrolled back down after detaching, not spurious “at end” during new-turn anchoring). Thread/route switches reset follow on by default through resolveTimelineAutoFollowEnabledForRoute.

The old ChatView scroll-node listeners on wheel/touch/pointerdown are removed in favor of this timeline-owned logic. resolveTimelineIsAtEnd now prefers isWithinMaintainScrollAtEndThreshold so “near end” maintenance does not count as the true live edge.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 7be974225c95dc8e9c05a82875b42709ceecfea1. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      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: 0931e55a-cabb-4340-86b5-8f0248343781

      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.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    3. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Needs human review

      This PR introduces a new user-facing feature that pauses live output auto-follow when the user scrolls up to read history. It adds substantial new logic for detecting user navigation intent across multiple input types (wheel, touch, keyboard, scrollbar) and modifies the timeline's auto-scroll behavior. New features with runtime behavior changes warrant human review.

      You can customize Macroscope's approvability policy. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. 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.
    5. Sorry for closing without warning, I thought this PR was stale and only saw @juliusmarminge self-requested a review an hour ago after I closed it. Hope this didn't fuck anyone's workflows.

    6. @juliusmarminge I think it's ready if you wanna merge it

    7. 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](https://www.cursor.com/dashboard/bugbot). Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 4c3da130ee2f421d9994f5616b606b889b45af1e. Configure [here](https://www.cursor.com/dashboard/bugbot).
    8. Independent reproduction supporting this PR — not a competing fix.

      I hit this in normal use and instrumented it before finding #3936. Recorded scrollTop / distanceFromEnd / scrollHeight / scroll-to-end-pill visibility every 100ms on stock main, scrolling with a real trackpad while a turn streamed.

      Session: 390 samples · 165s · scrollHeight 3394→4101 · max distance-from-end 890px · 4 snap-backs, every one with scrollHeight unchanged.

      The clearest event — sat still 692px up, content grew once, then thrown 842px to the live edge:

      153098ms  top=2466  dfe=692  h=3906  pill=0
      153198ms  top=2466  dfe=692  h=3906  pill=0
      153297ms  top=2466  dfe=692  h=3906  pill=0
      153435ms  top=2466  dfe=890  h=4104  pill=0   <- content grew, reader did not move
      153505ms  top=3308  dfe=48   h=4104  pill=0   <- +842px snap, h unchanged

      And one where an in-progress upward scroll was overridden mid-gesture:

      150396ms  top=2332  dfe=826  h=3906  pill=0
      150497ms  top=2377  dfe=782  h=3906  pill=0
      150597ms  top=2732  dfe=427  h=3906  pill=0   <- dragged down
      150697ms  top=3158  dfe=0    h=3906  pill=0   <- pinned to bottom

      Two things I think are useful for review:

      1. It corroborates the stated cause. At 890px out the reader is far beyond both Legend List's maintainScrollAtEndThreshold (default 0.1, ~75px here) and the onEndReachedThreshold band (default 0.5, ~374px). Neither threshold explains these snaps, which matches "end-maintenance remained enabled after manual navigation." Gating maintainScrollAtEnd off when auto-follow is disabled looks necessary — a fix that only detaches the timeline's own scroll mode leaves this path intact.

      2. pill=0 on all 390 samples, out to 890px. Live-follow never detached at all during the session.

      On that second point, one detail worth a quick look: on main the manual-navigation listeners are attached inside a single requestAnimationFrame that returns early if legendListRef.current?.getScrollableNode() is not ready on that one frame, with no retry and deps [activeThread?.id]. When it loses that race the thread gets no wheel/touchmove/pointerdown listeners at all for its lifetime, so live-follow can never detach — which is consistent with the pill=0 column, and with the intermittency reported in #4668.

      This PR appears to remove that failure mode structurally by replacing the imperative attach with onWheelCapture / onPointerDownCapture / onTouchMoveCapture / onKeyDownCapture on the list, since React binds those at render. Just flagging it as something concrete to confirm rather than a separate change to make.

      Happy to re-run the capture against this branch if that would help.

    9. Missed this sorry, slop'd it myself earlier today

Sign in to join this conversation.