[JMAP] Sorting issue: Oldest emails appear at the top instead of newest (ignores isAscending: false) #2976
Unanswered
bartfaizoli76
asked this question in
Issue Triage
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Issue Description
I am using Bulwark Webmail (JMAP) as a client for Stalwart Mail Server. When opening heavily populated or migrated folders like Inbox or Sent, the oldest emails (from years ago) are displayed at the very top. It seems the JMAP Email/query is returning results based on insertion order (or an unindexed order) rather than the requested receivedAt date.
Expected Behavior
When a JMAP client requests Email/query with "sort": [{"property": "receivedAt", "isAscending": false}], the server should return the most recently received emails first.
Actual Behavior
The server returns the oldest emails first (e.g., from 2020), ignoring the descending sort order request for receivedAt.
Note: IMAP clients (like Roundcube) connected to the same server show the correct chronological order, indicating the data is intact but the JMAP search/sort index might be failing to sort correctly.
Reproduction Steps
Connect a JMAP client (like Bulwark Webmail) to Stalwart.
Navigate to a folder with a large history of emails (e.g., Inbox).
The client sends an Email/query requesting descending order.
Observe the returned email IDs in the response: the oldest emails are returned first.
Relevant Log Output
Stalwart Version
v0.15.x
Installation Method
Docker
Database Backend
RocksDB
Blob Storage
RocksDB
Search Engine
Internal
Directory Backend
Internal
Additional Context
Client software: Bulwark Webmail v1.4.12 (Next.js 16.1.6)
Proxy configuration: Nginx v1.26.3 handling SSL termination and CORS.
Troubleshooting done: I have already tried disabling "Conversation Grouping" in Bulwark Webmail settings, but the sorting remains incorrect for the Inbox and Sent folders.
IMAP works: The same backend serves IMAP correctly (tested with Roundcube), so this is strictly related to JMAP.
I acknowledge that:
traceand included relevant log output if applicable.Beta Was this translation helpful? Give feedback.
All reactions