Brother Brnt dispenses some pearls of wisdom on this topic:
kenmore model 417..... made by frigidaire
you say you caught the machine filling and draining endlessly?
known frigidaire problem
you need a speed board, also called the motor control unit
and yup a bad speed board can do all sorts of flakey stuff
another symptom .... timer knob gets stuck at around the 5 o'clock position
another common problem i saw with these machines.... the tub can go out of balance bad enough to smash into the bottom of the timer.
Remove washer lid, closely examine the bottom of the timer and where that molex plug connects there, look to see if it looks squashed or out of place
but filling and running the drain pump forever is the speed board for sure
frigidaire blamed this on electrical interferance comming from other outside sources, they say they modified later boards to prevent this
this was like 10 years ago or so