Out of office: jcoffey-dev is traveling from November 1 to November 6. Responses to issues may be slow or delayed during this time, but I will be checking in.
To find a new message's thread, delivery read every stored message with
the same thread name (or, for messages without a subject, every
subject-less message) and compared their references. Anyone able to send
mail could make each delivery to an account slower than the last by
sending it many messages with one subject or none.
A new message is now compared with the newest 512 messages sharing its
thread name. A reply whose thread has no message among those starts a
new thread. Duplicate detection looks at the same messages.
Test: after 513 messages with one subject, a reply to the newest still
joins its thread, and a reply to the oldest (now outside the window)
starts a new one; on main it was still compared with all of them.