Skip to content

fix: render older session history when an event page splits a turn - #1212

Merged
harshil-2096 merged 2 commits into
mainfrom
govinda/age-2666-older-messages-in-session-not-login-in-chat
Oct 29, 2026
Merged

harshil-2096 merged 2 commits into
mainfrom
govinda/age-2666-older-messages-in-session-not-login-in-chat

Conversation

@govindavashishtha

@govindavashishtha govindavashishtha commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

On /sessions/:id, scrolling up fetched the older events page but never rendered it. Only the newest 100 events showed.

The events API pages by event count, so a page often ends in the middle of a turn. The newest page then starts with the turn's tail (including turn.done), and its turn.created is on the older page. The loader discarded that tail. When the older page arrived it had turn.created but no turn.done, so the turn was never committed. The Sessions browser view wasn't affected because it drains every page before rendering.

Fixes AGE-2666

Changes

  • SessionHistoryPagination gains an optional pendingItemsAsc. It holds the oldest turn's events whose turn.created is still on an older page.
  • fetchSessionEventsWindow puts the held events in front of the next older page, so the split turn is rebuilt whole. It returns the newly cut-off events instead of dropping them. Held events are discarded once there is no older history.
  • The initial-load stop rule is unchanged, so opening a session still fetches one page in the normal case.
  • A scroll-up that lands entirely inside a turn longer than the 10-page cap now keeps the cursor and the held events. Previously it set hasOlder: false and turned off scroll-up for good.
  • The pre-getTurn progress paint no longer publishes historyPagination. Before, a scroll-up during that window was overwritten by the final setSnapshot.
  • The three copies of the pagination object literal are replaced by one toHistoryPagination helper.

How was this tested?

  • New tests in packages/assistant-ui-runtime/test/convertTurnMessages.test.ts:
    • a turn split by the page boundary: the initial load makes one listEvents call, then each scroll-up adds the split turn and then the oldest turn, with text in order
    • a turn longer than the boundary page cap: a scroll-up inside it keeps the cursor and held events, and the next one completes the turn
  • pnpm typecheck and pnpm test (263 tests) in packages/assistant-ui-runtime
  • pnpm exec eslint --max-warnings=0 and Prettier on the changed files

Checklist

  • I have read the contributing guidelines
  • pnpm test, pnpm typecheck, lint and format pass for packages/assistant-ui-runtime (root pnpm build not run)
  • Tests added/updated where it makes sense
  • No hand-edits to generated code (packages/trueforge-sdk, python/trueforge_sdk, .github/fern/openapi/openapi.json, docs/openapi.json) — fork PRs omit SDK regen; maintainers regenerate after merge
  • Docs / .env.example updated if configuration or behavior changed (not needed)

Made with Cursor


Note

Medium Risk
Changes paginated session history assembly used on session chat reload and scroll-up; behavior is localized to assistant-ui-runtime but affects what messages users see when loading older turns.

Reviewed by Cursor Bugbot for commit 589335f. Bugbot is set up for automated code reviews on this repo. Configure here.

Hold the leading events of a turn whose turn.created is on an older page and re-join them with that page on scroll-up, instead of discarding them. Also stop the pre-getTurn progress paint from exposing pagination, so a scroll-up during load is not overwritten by the final snapshot.

Fixes AGE-2666

Co-authored-by: Cursor <cursoragent@cursor.com>
@changeset-bot

changeset-bot Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 1d90f28

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@truefoundry/trueforge-assistant-ui-runtime Patch
@truefoundry/trueforge-ui Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@harshil-2096
harshil-2096 merged commit ee31bcd into main Oct 29, 2026
16 checks passed
@harshil-2096
harshil-2096 deleted the govinda/age-2666-older-messages-in-session-not-login-in-chat branch October 29, 2026 03:57
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.

2 participants