I may have introduced this bug at some point with my fiddling around find_clear_spot... not sure.
But if an NPC finds itself on a field with an adjacent safe tile, and there is no safe path to melee attack its enemy, it will often move onto the safe tile only to use its next AP just moving back onto it. This is exploitable to make monsters do tons of damage to themselves without getting to counterattack.
It could be a bug in legacy BoE too.