I have encountered an issue with the filament runout sensor code that is causing false positives, and it seems to be related to the retraction amount of the standby extruder.
Normally when printing the counter monitors the extrusion amount and counts up from 0mm to about 7mm and resets to 0 and back up to 7 and so on. This is because the avg distance between poles on the magnetic encoder wheel is about 7mm so it senses the pole switch and resets the counter at about the 7mm mark. The runout threshold was set to 20mm, so if the counter made it to 20mm without detecting a pole change then there is no filament movement (either strip out or no filament) and it knows to stop the print.
I noticed the counter would occasionally start counting at 16mm instead of 0mm and would cause a false positive because it could be 7mm to change the pole but only 4mm to trigger the runout sensor. I was getting frequent false positives because of this.
I changed the runout threshold to 24mm which is the 16mm it randomly starts counting at, +7mm to the next pole on the encoder, +1mm for a small safety factor. I have not had a false postive since changing this.
I have attached a doc showing the terminal output during one of these false positives, as well as the g code that triggers this.