You mention that the problem goes away when you lift all pressed keys. Looking at the file you linked, the variable is_moving
is true
when a key is pressed. So I don't know if the bug is in the code you listed above but rather inside one of the code blocks reached by is_moving.
Also I had a similar-ish problem in v3 and v3.0.2 where:
vel = move_and_slide(vel,Vector3(0,1,0), 0.05, 4, deg2rad(MAX_SLOPE_ANGLE)
worked in v3 but not v3.0.2 (the character wouldn't move). It was fixed by adding an extra variable to the function call:
vel = move_and_slide(vel,Vector3(0,1,0), true, 0.05, 4, deg2rad(MAX_SLOPE_ANGLE))
I don't know if it's related but it took me a while to find and so here it is just in case.