I think this might be your issue. When your sprite flips directions part of it becomes stuck inside the wall. In your case, I think it’s the robots head.
I think one possible fix is making sure the sprite is centered including the collision mask and center points. So, when it flips it fills the same exact space.
The collision mask rarely needs to be an exact match to the image.