Skip to content

fix(site/src/pages/AgentsPage): suppress sticky prompt updates during streaming#26076

Open
tracyjohnsonux wants to merge 1 commit into
mainfrom
fix/sticky-prompt-streaming-overlap
Open

fix(site/src/pages/AgentsPage): suppress sticky prompt updates during streaming#26076
tracyjohnsonux wants to merge 1 commit into
mainfrom
fix/sticky-prompt-streaming-overlap

Conversation

@tracyjohnsonux
Copy link
Copy Markdown
Contributor

@tracyjohnsonux tracyjohnsonux commented Jun 4, 2026

Split out from #25324, which originally combined the prompt history popover with stability fixes for the sticky pinned user prompt. This PR contains only the streaming-related overlap fix.

Problem

While the agent is actively streaming, the pinned sticky user prompt would bounce and visually overlap the streaming transcript. The content ResizeObserver on the chat scroller fires on every streamed token, which re-runs the sticky update() against ongoing layout changes from the agent output.

This was most obvious on mobile, where every touch (or the device's own momentum scrolling) triggered scroll events while streaming was already shifting layout, so the pinned prompt visibly fought the user's scroll position. Reported by @mattvollmer.

Fix

Track the latest hasActiveStream value on StickyUserMessage via a ref so the ResizeObserver (created once in a [] effect) can read it without recreating the observer. Skip the resize-driven update path while streaming is active. When streaming ends, run a single catch-up update() so the pinned bubble settles at its correct height after the suppressed updates.

Scope

Intentionally narrow:

  • StickyUserMessage gains a hasActiveStream prop, threaded from ConversationTimeline.
  • A hasActiveStreamRef mirrors that value into the persistent observer.
  • The content ResizeObserver early-returns while hasActiveStreamRef.current is true.
  • A second useLayoutEffect keyed on hasActiveStream runs one trailing updateFnRef.current?.() on the streaming-to-idle transition.
  • One emdash in an adjacent comment is replaced with a comma to satisfy make lint/emdash.

The prompt history popover, scroll-lock helper, and data-user-message-id sentinel attribute remain in #25324.

Generated by Coder Agents on behalf of @tracyjohnsonux

… streaming

The pinned sticky user prompt would bounce or overlap with the
transcript while the agent was actively streaming. The content
ResizeObserver fired on every streamed token, re-running the sticky
update() and shifting the pinned bubble against ongoing layout changes.

Track the latest hasActiveStream value via a ref and skip the resize
update path while it is true. When streaming ends, run a single
catch-up update so the pinned bubble settles at its correct height
after the suppressed updates.

> Generated by Coder Agents on behalf of @tracyjohnsonux
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