I'm trying to diagnose a really strange situation where certain emails, when submitted to the mailbox by Postfix, are not considered to be unseen by Dovecot.

During testing, I've shut down anything else on the server that might want to access the mailbox. I submit the email to the local postfix instance which then says it has delivered it to the mailbox:

Dec 23 09:51:35 ip-10-35-194-108 postfix/smtpd[3283]: connect from localhost[127.0.0.1]
Dec 23 09:51:35 ip-10-35-194-108 postfix/smtpd[3283]: 5A0BF40261: client=localhost[127.0.0.1]
Dec 23 09:51:35 ip-10-35-194-108 postfix/cleanup[3286]: 5A0BF40261: message-id=<20191223095135.5A0BF40261@servicedesk.linaro.org>
Dec 23 09:51:35 ip-10-35-194-108 postfix/smtpd[3283]: disconnect from localhost[127.0.0.1] ehlo=1 mail=1 rcpt=1 data=1 quit=1 commands=5
Dec 23 09:51:35 ip-10-35-194-108 postfix/qmgr[1660]: 5A0BF40261: from=<philip.colmer@linaro.org>, size=702, nrcpt=1 (queue active)
Dec 23 09:51:35 ip-10-35-194-108 postfix/local[3287]: 5A0BF40261: to=<local-it-support@localhost>, relay=local, delay=0.06, delays=0.04/0.02/0/0, dsn=2.0.0, status=sent (delivered to mailbox)
Dec 23 09:51:35 ip-10-35-194-108 postfix/qmgr[1660]: 5A0BF40261: removed

I then use this command to query the state of the mailbox:

sudo doveadm mailbox status -u local-it-support all INBOX

and get this response:

INBOX messages=142 recent=0 uidnext=5596 uidvalidity=1455577845 unseen=0 highestmodseq=1163 vsize=11315688 guid=2a997739f55ac2560d180000e171d23e firstsaved=1577094051

What can be happening that means that Dovecot doesn't treat a newly delivered message as unseen?

Installation details:
# 2.2.33.2 (d6601f4ec): /etc/dovecot/dovecot.conf
# Pigeonhole version 0.4.21 (92477967)
# OS: Linux 4.15.0-1041-aws x86_64 Ubuntu 18.04.3 LTS
auth_verbose = yes
auth_verbose_passwords = yes
disable_plaintext_auth = no
listen = 127.0.0.1
mail_location = mbox:~/mail:INBOX=/var/mail/%u
mail_privileged_group = mail
namespace inbox {
  inbox = yes
  location =
  mailbox Drafts {
    special_use = \Drafts
  }
  mailbox Junk {
    special_use = \Junk
  }
  mailbox Sent {
    special_use = \Sent
  }
  mailbox "Sent Messages" {
    special_use = \Sent
  }
  mailbox Trash {
    special_use = \Trash
  }
  prefix =
}
passdb {
  driver = pam
}
protocols = " imap"
ssl = no
ssl_cert = </etc/dovecot/private/dovecot.pem
ssl_client_ca_dir = /etc/ssl/certs
ssl_key =  # hidden, use -P to show it
userdb {
  driver = passwd
}

Note that we are not using SSL because Dovecot is only accessible locally within the server.

Thank you for any suggestions or comments.

Regards

Philip