When it stops being worth the hassle.
Basically, if it's to get cleaned up and donated to someone, then one that'll need no more than maybe $20 in parts - new inner tubes, brake pads and maybe a tire or 2. Hobby time is essentially free.
For myself, where the cost of the parts is more than about half of what I could buy a good condition equivalent for.