Battery charging and discharging problem
The comparator and battery charger (LTC4071) are making decisions independently of each other.  The battery charger is looking for the battery to reach 4.0, 4.1, or 4.2V, depending on how you jumper the ADJ pin.  However that only sets the voltage limit, it never stops trying to charge the battery.  According to the data sheet page 10, "The LTC4071 does not have a discrete charge termination."  The usage scenario being that it always tries to put current into the battery and the battery limits its own current when the charger goes into voltage-limit mode, then the current slowly reduces to nearly zero as the battery gets really full, at which point it's receiving a "float" charge.  There is the HBO pin which shows when the battery is at voltage limit, but this isn't the same as the charger turning itself off.

Meanwhile the comparator is looking for the battery to reach 4.0V.  I'm not sure why it's oscillating but possibly you're overloading what the charger can pass through since the load is in parallel to the battery, and the charger has to provide for them both.  Or overloading the input source, whatever it is, solar panel or wall adapter?  Or the load is so huge that it is actually pulling down the small battery to below the low-battery threshold.  You don't state whether other parts of the circuit are also oscillating.

What you might want is a setup where the battery charger turns itself off when done and signals the load to turn on, and the load in turn signals the charger to start charging when it turns itself off.  Since your battery charger IC doesn't have an enable pin and doesn't turn itself off, you might have to rig something up with FETs to gate power into or out of the charger, or swap the charger IC to something more appropriate.  Is the goal to test battery cycle life, or specifically this circuit also?