In the event that the sensor happens to be too close to the magnet:
Was your sensor facing forward (as in my photo above)? If so, then the magnet will slide under it.
If the sensor is facing backwards, then the sensor will attempt to slide under the magnet or brute force push it off.
My method worked for years with no issues like yours. There may be one small but significant difference in implementation.