Since #4927 is merged core can get into busy loop if it gets a new account with UIDNEXT=3 but no message with UID=2. This happens because tests reuse accounts.
E.g. if you run pytest -s tests/test_1_online.py::test_qr_join_chat, there are actually two tests tests/test_1_online.py::test_qr_join_chat[0] and tests/test_1_online.py::test_qr_join_chat[1] and the second to run gets into busy loop skipping IDLE because UIDNEXT is 3 while stored UIDNEXT is 1.
This does not prevent any tests from passing, but the client never idles properly and would waste bandwidth if this happens on a real client.
fetch_new_messages advances stored UIDNEXT here:
https://github.com/deltachat/deltachat-core-rust/blob/4e21917c0e8bb250ff74bd213ee290210b4e2f81/src/imap.rs#L877-L881
If there are no messages, UIDNEXT is not advanced at all because largest_uid_without_errors is the UID of the largest message that exists.
If current stored UIDNEXT is 1, we fetch 1:*, get no messages and should advance UIDNEXT to 3 if we previously got 3 from STATUS. Not sure currently how to do it best, probably save largest known UIDNEXT into session object and advance stored UIDNEXT at least to this value after fetch.