What SMTP response code should the server send to report that the Message-ID
field duplicates one already seen?
RFC 5322, §3.6.4 “Identification Fields” states:
The "Message-ID:" field provides a unique message identifier that refers to a particular version of a particular message. The uniqueness of the message identifier is guaranteed by the host that generates it […].
So it is a violation of that directive for a message to declare a Message-ID value that has already been seen on a message with different content. This implies that an SMTP server may reject a message on that basis.
Note: The intent is not to remember every value ever seen; that would be onerous to design and expensive to operate. Rather, the intent is to use those values we happen to record to detect some proportion of incoming requests that violate the above directive, and reject them early on that basis.
The set of codes described in RFC 5321 §4.2 “SMTP replies” describes some conditions where fields are the cause of a rejection (e.g. “mailbox not allowed”, reply code 553).
What should be the response code for the condition “Message-ID value already seen”?
The MTA agent can not and must not reject a mail for delivery based on its Message-ID.
Doing that would require the MTA to know (and remember) all the system-wide used Message-ID, which obviously is prohibitive both on CPU, memory and disk requirements.
In short, the MTA must accept mails with duplicate Message-ID, leaving the (optional) subsequent de-deplication work for later processing (eg: by the IMAP server or mail client).