Skip to content

Thread-follow hardening: shrink re-lock, wheel/selection/pointerdown escape #432

Closed

Description

@omridevk

Parent: #397. Blocked by: the #397 fix (touches the same machine; land after it).

What to build

Hardening for the thread-follow machine, adopting the escape/asymmetry semantics use-stick-to-bottom and assistant-ui both converged on:

  1. Shrink vs growth asymmetry (use-stick-to-bottom): when content shrinks and the viewport is near-bottom, silently re-lock to bottom-following without scrolling; a collapsing panel must never move a reader. Growth chases only when genuinely pinned. Our onResized currently treats all resizes alike.
  2. Immediate escape hatches: escape the pin on wheel-up (deltaY < 0) immediately, before any scroll event lands; cancel pending follow intent on pointerdown on the scroll container (assistant-ui does this to stop a stale intent hijacking the next content growth); do not re-pin while text selection is active (users select streaming text).
  3. Content-shift vs user-scroll discrimination (assistant-ui): treat an upward scrollTop move as user intent only when scrollHeight is unchanged, so reflow above the viewport is never misread as a scroll-up.

Our machine already listens on wheel/touchmove/keydown; scrollbar-thumb drags and selection currently race the observers.

Acceptance criteria

  • Collapsing a card near the bottom re-locks without a visible scroll
  • Wheel-up during an active follow animation detaches instantly
  • Selecting text in a streaming message does not get yanked
  • Reflow above the viewport (content shrinking) does not detach a pinned viewport

Activity

  1. added
    ready-for-agent
    on Aug 11, 2026
  2. omridevk commented on Aug 11, 2026

    @omridevk
    ContributorAuthor

    Implemented on fix/397-transcript-repin (commit fbed913), on top of the #397 fix.

    • Shrink re-lock: a resize that shrinks scrollHeight while not dragging and near the new bottom re-enters following directly — state relabel only, no seek plan, so no visible scroll. Growth keeps Transcript re-pins to the bottom when content grows after the hold window #397 semantics.
    • Wheel-up instant escape: the wheel listener now issues scrollTo({top: current, behavior: 'instant'}) before dispatching wheelUp, hard-stopping any in-flight smooth-scroll animation, then the machine detaches as before.
    • Pointerdown intent cancel: already implemented pre-series (pointerDown → abandonSeek, covered by an existing test) — no change.
    • Selection guard: new pointerMove (only with a button held) mirrors the existing touch-drag concept into mouse drags — selection drags and scrollbar-thumb drags now enter dragging and block re-pins; pointerUp/pointercancel release through the shared onDragReleased. Bare taps deliberately do NOT detach (preserves the "tap that never moves keeps following" invariant).
    • Content-shift discrimination: already covered — draggedUp() requires unchanged scrollHeight before reading an upward move as user intent, and atBottom is always computed from absolute position, never delta. No change.

    Note: the shrink re-lock is the prime suspect in a follow-up yank reported during live testing (see the RCA comment on #397) — it may gain a "was already pinned before the shrink" guard.

  3. omridevk commented on Aug 11, 2026

    @omridevk
    ContributorAuthor

    The shrink re-lock added here is confirmed as the decision-point behind the near-bottom yank — full instrumented RCA posted on #397 (native scrollTop clamp from the auto-collapsing reasoning card is misread as "user at bottom"). The branch is being superseded by the use-stick-to-bottom port; the zero-movement follow-up (defer auto-close while detached) is tracked in the #397 RCA comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ready-for-agent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions