As soon as I had a written contract! I emailed a resignation letter to my boss and head-of-department that evening, in order to get the clock ticking on my (three month) notice period immediately, and then followed-up with a meeting invitation to them both for first thing the following morning to talk about it (at which I carefully stressed the “it’s not you, it’s me” of it: pointing out the things that I was getting from my new position that I couldn’t ever be given by my current one, focussing on the things I love and will miss about my current role, and so on).