You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Chat message pagination drops visible rows when reported messages sit in the Firestore page #12709
GET /v2/messages (and the other get_messages callers) can return fewer than limit visible messages even when older visible messages still exist, and the next offset can advance past rows the client never saw.
Evidence
In backend/database/chat.pyget_messages:
Firestore applies .limit(limit).offset(offset) on the raw newest-first stream.
Python then skips any row with reported is True.
So a reported row in the middle of a raw page steals a slot from a later visible message. Example newest-first stream [visible-a, reported, visible-b, visible-c] with limit=2 returns only [visible-a]; visible-b is never fetched on that page. Callers that stop after one page (mobile loads offset 0 once) or treat len < limit as EOF never see those messages.
The same failure class is already acknowledged elsewhere in this file:
get_cache_aligned_messages over-fetches raw rows specifically because filtering after limit drops visible history.
get_messages_reconcile_page uses a bounded scan budget so reported rows do not consume page capacity.
Offset pagination on get_messages itself still does the broken limit-then-filter path.
Call sites
/v2/messages, /v2/desktop/messages, MCP get_chat_messages, and related helpers all go through this function with limit/offset.
Activity