Debugger not starting session

I’m trying to debug a STM32 project. And it was working, but then I had a hang and I terminated the debug session. After that debugging stopped working, at best the session finishes compiling a debug binary then stops. I tried without the debug pre-checks, the debug process buttons appear for a moment then disappear, I get no indication of error or anything.

Nothing I did could fix it. I tried reinstalling vscode, I tried removing the whole .platformio folder. I’m on windows with latest vscode and pio.

What I am experiencing is exactly as described in this first post. Through the cli the debugging session starts, but not in vscode.

edit: looking in the debug console I have this:

undefined'platformio' is not recognized as an internal or external command,  operable program or batch file.

Could this have anything to do with it? (I am using the built in core)

I also cleared out the assorted vscode caches.

Edit2:

Added the scripts folder to the system PATH, as described below:

And this worked.

However, I don’t understand why I needed to do this, and why debugging suddenly broke without me changing anything about my system?