It must be very very short. I tried both on PC with mechanical keyboard and on laptop and I got the same result (random mix, but usually long space). I read your comment that it must be very short and I tap as fast as I could and still got same result that seems random.
I think the solution will be to expend time to something like:
- Less then 1s hold --> short space
- more then 1s hold --> long space
Because right now it's feels like it's below 0.1s so just few frames or there is some bug that doesn't register when you release a keyboard and press again.
I really don't know what is an issue, but I ask my teammates and they have the same issues on different devices, so I'm pretty sure that an issue is in the code or in implementation.