[Refactor/Chore] Pagination skips rows with the same timestamp in 4 endpoints
Author: JHC56Created Oct 2, 2026Updated Oct 2, 2026
Labelsreview: medium
Self Checks
- I have read the Contributing Guide and Language Policy.
- This is only for refactors or chores; if you would like to ask a question, please head to Discussions.
- I have searched for existing issues search for existing issues, including closed ones.
- I confirm that I am using English to submit this report, otherwise it will be closed.
- 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
- Please do not modify this template :) and fill in all the required fields.
Description
Many reports about the same bug came in recently. I put the reports together here.
On PostgreSQL, created_at saves only whole seconds. Rows saved in the same second get the same created_at. The endpoints below sort only by created_at and use < / > for the next page. Rows with the same created_at as the cursor are skipped. Some endpoints also use id != cursor.id, but < already removes the cursor row, so id != cursor.id does not help.
Details (main @ 570552c)
| Issue | PR | Code | Condition |
|---|---|---|---|
| #43084 Conversation variables | #43087 | services/conversation_service.py:282 |
created_at > cursor.created_at |
| #43134 Console Logs chat messages | #43146 | controllers/console/app/message.py:479, :501 |
created_at < cursor.created_at, id != cursor.id |
| #43265 Workflow runs | #43266 | repositories/sqlalchemy_api_workflow_run_repository.py:270 |
created_at < cursor.created_at, id != cursor.id |
| #43335 Service API / web app message history | #43336 | services/message_service.py:156, :221 |
created_at < cursor.created_at, id != cursor.id |
Written with help from Claude Opus 5.5.
Motivation
Users lose rows with no error. One issue for all 4 endpoints makes the PRs easy to track.
Additional Context
#43335 was first reported in #35996. PR #37896 for #35996 was closed because of merge conflicts.
Source: langgenius/dify