I used to detect this situation in KP's Lua AI via Spring.GetUnitVelocity being zeroes.
However, recently, Spring behavior changed, and units bumping into walls now wriggle in place, with an instant velocity that can sometimes be as high as the top speed.
This is annoying, because it prevents AI from detecting that the units are not doing anything and should be given a new order.
How to fix?
I thought about checking that a rounded sliding mean value of position remains constant, but that would be overly complicated.