Skip to content
PidebugWeb6 files · +642 −292

Fix chat autoscroll jitter and inner scroll during streaming (Excel add-in)

Session from pi-for-excel-sessions on Hugging Face by thomasmustier · MIT · condensed by Coders Talk

2h 03msession
0interventions
GOAL

Diagnose and fix jittery autoscroll in the Pi for Excel sidebar during streaming, then extend auto-follow behaviour to expanded thinking/tool blocks so users don't have to manually scroll to keep up with streamed content.

  1. Prompt · +0
    When streaming, new rows appearing cause the view to jerk up then down. Also the last line during streaming is partly hidden above the input box — please investigate.
  2. Agent did · +0m
    Traced autoscroll logic in pi-sidebar.ts/tabs.css: it watched content height (.pi-messages__inner) but not viewport height (.pi-messages), causing jitter when footer widgets resized the viewport. Fixed by observing both.
  3. Prompt · +11m
    Yes please tune the auto-follow disengage/re-engage thresholds, then open a PR following the poll-review-merge process, and refactor if there's a better approach.
  4. Agent did · +11m
    Created an isolated worktree, tuned disengage/re-engage thresholds (50px/10px → 32px/20px), added shared scroll-to-bottom helpers, opened PR #397, waited on Codex review, merged after checks passed, cleaned up worktree.
  5. Prompt · +54m
    Inside thinking and tool blocks, we should think about good UX/consistent behaviour — currently opening a thinking or tool block during streaming never follows the stream.
  6. Agent did · +54m
    Diagnosed capped-height inner scroll areas (thinking-block markdown-block, .pi-tool-card__body--open) that don't auto-follow. Implemented an rAF loop with a distance-from-bottom heuristic to auto-scroll expanded inner panes, opened PR #401, merged after CI passed.
  7. Fail · +1h 34m
    Developer reported the fix doesn't actually work: if the thinking block is expanded when streaming starts, it doesn't follow down.
  8. Agent did · +1h 35m
    Root-caused the distance heuristic: token batches could grow >30px per frame, wrongly triggering the 'user scrolled up' disengage logic. Reworked to per-element scroll listeners that only detach on real scroll events, applied it live on main, then discussed holistic UX for outer vs inner scroll coupling.
  9. Prompt · +1h 49m
    Please write up a GitHub issue with full context on the inner-scroll UX problem and design thinking.
  10. Agent did · +1h 49m
    Filed issue #406, then implemented it in a fresh worktree by porting the scroll-listener approach onto main, opened PR #408, addressed a Codex review comment about listener registry reset, resolved a merge conflict via rebase, resolved a review thread blocking merge, and merged as commit a30f00d.
  11. Outcome · +2h 3m
    3 PRs merged (#397, #401, #408) plus issue #406 documenting the UX design; final scroll-listener based inner auto-follow fix landed on main.
VERDICT

Next time I'd ask for the holistic design pass (outer vs inner scroll UX) up front instead of shipping a quick distance-heuristic fix first — that first attempt (#401) looked fine in CI but didn't actually work in practice, and I only caught it by testing manually. The fix that actually worked was switching from a distance-from-bottom heuristic to real per-element scroll listeners, which is what should have been done from the start.

I tried this · 0

Discussion · 0

How Builds work