Thanks for your continuous effort, Mr Midgley.
Here to add some more info about other users affected.
We created an MS support case 3-4 weeks ago, attaching the code you gave, and still haven't found a solution.
I've seen some peers mention their affected tools, and to point it out, we use Roundcube.
There isn't any modification to the open source code, as we use it to power our Webmail built in a CRM.
Can confirm this Subscribe failed issue is affecting our clients using Oauth2, and it all started around the same time this post emerged and some other people noticed this issue.
As some people of this post have experienced, it is annoying that inside the same client using O365, there are users having the "Subscribe Failed" issue and others, with the same tenant and IMAP settings, continuing their lives fine, with all their folders showing or if they just have selected ones.
This annoys users because they haven't done anything different from their peer.
The affected users are only able to see the Inbox folder.
We are in constant communication with the MS Support team (even tho it bothers us a bit that there is silence for some long days), and it looks like we are moving things finally, as they asked us to record and reproduce the issue while this tool is enabled, linked here (https://aka.ms/SaRA-Assisted). Still waiting a response.
We saw the test connectivity URL you gave (https://testconnectivity.microsoft.com/tests/o365) and tried doing some diagnostics, but still it looks like the affected users are all fine, except they aren't.
Hope my comment can show that this is big enough for MS to move things ASAP.
Best regards,
~Arnau