[PR #22387] [MERGED] fix: add deterministic tiebreaker to all paginated chat queries #49695

Closed
opened 2026-04-30 01:59:55 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/22387
Author: @Classic298
Created: 3/8/2026
Status: Merged
Merged: 3/8/2026
Merged by: @tjbck

Base: devHead: fix/deterministic-chat-pagination


📝 Commits (1)

  • 7fcf0ce fix: add deterministic tiebreaker to all paginated chat queries

📊 Changes

1 file changed (+16 additions, -16 deletions)

View changed files

📝 backend/open_webui/models/chats.py (+16 -16)

📄 Description

Add Chat.id as a secondary sort key to all paginated chat queries that use offset/limit pagination. When multiple chats share the same updated_at timestamp, the database does not guarantee a stable order across page boundaries, causing chats to appear on multiple pages.

This produces duplicate keys in the Svelte sidebar each-block (each_key_duplicate error). Adding Chat.id as a tiebreaker ensures fully deterministic ordering.

Extends the fix from #22383 (which addressed get_chat_ids_by_model_id) to all remaining paginated chat queries.

Contributor License Agreement

By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.

Note

Deleting the CLA section will lead to immediate closure of your PR and it will not be merged in.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/open-webui/pull/22387 **Author:** [@Classic298](https://github.com/Classic298) **Created:** 3/8/2026 **Status:** ✅ Merged **Merged:** 3/8/2026 **Merged by:** [@tjbck](https://github.com/tjbck) **Base:** `dev` ← **Head:** `fix/deterministic-chat-pagination` --- ### 📝 Commits (1) - [`7fcf0ce`](https://github.com/open-webui/open-webui/commit/7fcf0cec4165ab5f6f68d7009ca2d95369bd1096) fix: add deterministic tiebreaker to all paginated chat queries ### 📊 Changes **1 file changed** (+16 additions, -16 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/models/chats.py` (+16 -16) </details> ### 📄 Description Add Chat.id as a secondary sort key to all paginated chat queries that use offset/limit pagination. When multiple chats share the same updated_at timestamp, the database does not guarantee a stable order across page boundaries, causing chats to appear on multiple pages. This produces duplicate keys in the Svelte sidebar each-block (each_key_duplicate error). Adding Chat.id as a tiebreaker ensures fully deterministic ordering. Extends the fix from #22383 (which addressed get_chat_ids_by_model_id) to all remaining paginated chat queries. ### Contributor License Agreement <!-- 🚨 DO NOT DELETE THE TEXT BELOW 🚨 Keep the "Contributor License Agreement" confirmation text intact. Deleting it will trigger the CLA-Bot to INVALIDATE your PR. --> By submitting this pull request, I confirm that I have read and fully agree to the [Contributor License Agreement (CLA)](https://github.com/open-webui/open-webui/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT), and I am providing my contributions under its terms. > [!NOTE] > Deleting the CLA section will lead to immediate closure of your PR and it will not be merged in. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-30 01:59:55 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#49695