chat history pagination: paged load instead of full-session fetch
Backend:
- PgSessionStore.get_meta — light session head (sessions row + COUNT),
  no message payload
- PgSessionStore.get_history_page — page of display history (archive ∪
  hot UNION), newest-first page, oldest-first result, limit+1 peek for
  has_more; each message stamped metadata.display_index (ROW_NUMBER-1
  over the full display history) so client ids stay stable across
  paged loads; dangling-tool-call repair keeps real ranks by
  sequence-number lookup
- GET /sessions/{id}/meta and GET /sessions/{id}/messages/history
  (before_seq cursor, limit ≤200)

Webclient:
- loadSession/reloadSession fetch meta + newest 200-item page
  (Promise.all), archive state from the page itself
- buildMessageList ids (h_*) and rawIndices use the global
  display_index — feedback keys and search-jump stay stable when
  history is paged
- scroll-up loads older pages through the same history endpoint
  (archive table alone misses sessions whose threshold never moved)
- search-jump pulls pages until the target index is covered (bounded)

Tests: store unit tests (ranks, has_more peek, placeholder shift) +
vitest updates; full pytest 1231 passed, vitest 94 passed.
1 parent 921cd33 commit e888c3ef7adfa8d0b884ae60d500a708ea496d2d
@Eugene Sukhodolskiy Eugene Sukhodolskiy authored 6 hours ago
Showing 12 changed files
View
navi/api/routes/sessions.py
View
navi/core/pg_session_store.py
View
tests/unit/core/test_pg_session_store.py
View
webclient/dist/assets/index-BEctUJ4R.js 0 → 100644
Not supported
View
webclient/dist/assets/index-CFZ4CERY.js 100644 → 0
Not supported
View
webclient/dist/assets/index-CVywHeX3.css 100644 → 0
View
webclient/dist/assets/index-CfD2dcHA.css 0 → 100644
View
webclient/dist/index.html
View
webclient/dist/sw.js
View
webclient/src/api/index.js
View
webclient/src/stores/chat.js
View
webclient/tests/unit/stores/chat.test.js