Skip to content

[Bug]: Older message history fails to load in long-running conversations #4232

Description

@turingcat

Module

Conversation & Sessions

Platform

macOS (Apple Silicon)

AionUi Version

2.2.1

Bug Description

When a conversation is actively running (agent turn in progress), scrolling up to load older message history can silently stop working, and switching back to the conversation after a turn completes can lose the "load more history" state and/or cause an unwanted jump/scroll.

Steps to Reproduce

  1. Open a conversation whose running turn folds many tool calls into a small number of summary/plan cards (so the rendered content is shorter than the visible viewport, even though many older DB pages exist).
  2. Because the content doesn't overflow the scroller, no scrollbar appears, so the scroll-triggered "load older page" handler never fires — older history becomes permanently unreachable for that view.
  3. Separately: scroll up to load an older page (setting hasMoreBefore/oldestCursor), then let a pending turn complete. The completion reconciliation reloads the newest page and resets pagination as if it were a fresh mount, discarding the already-loaded oldestCursor/hasMoreBefore state.
  4. Separately: while an older page is prepended to the message list, useAutoScroll compared only messages.length to decide "a new message arrived," so a prepended history page (which also grows the length) could be misidentified as a new tail message.

Expected Behavior

  • Older message pages should remain loadable via scroll even when a running turn's rendered content is shorter than the viewport.
  • Loading an older page's pagination state (oldestCursor/hasMoreBefore) should survive a newest-page reconciliation triggered by turn completion.
  • Auto-scroll/auto-follow should only react to genuinely new tail messages, not to older history being prepended.

Actual Behavior

  • Scroll-triggered older-page loading can never trigger when the viewport isn't overflowing, silently hiding older history.
  • Reconciling the newest page after turn completion resets oldestCursor/hasMoreBefore, losing previously loaded pagination progress.
  • useAutoScroll can misidentify a prepended older page as a new message due to comparing only list length.

Additional Context

Fix and regression tests are included in the linked PR.

Activity

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions