If VUSB/VIN power goes away and returns while asleep, the PMIC will change it's charging rate to the default of 50mA. If you wake back up and power doesn't cycle again, I could see where it might get stuck at 50mA. There is an interrupt routine that refreshes the settings when the power cycles, but only if the unit is awake or booting up from reset. These are the commands that are refreshed.
PMIC power;
power.begin();
power.setInputCurrentLimit(900); // 900mA
power.setChargeCurrent(0,0,0,0,0,0); // 512mA
If you use Sleep stop mode which just halts the STM32, I suppose these commands would not be run on waking. I wonder if that's your issue. And if the rate is 50mA, the system will not stay charged as there is more current drain on the system than 50mA typically, even without any extra loads for sensors.
This is due to the digital filter on the Fuel Gauge. It doesn't do well with battery swaps or abrupt changes in battery SoC while the Fuel Gauge is sleeping. Upon wake, or battery swap, you can run this command to reset the filter:
FuelGauge().quickStart();
The Fuel Gauge readings do not currently affect the way the PMIC operates, but it might in the future. We have talked about building in user configurable support for Soft Power Down when system battery capacity is < 10 or 20%.
Perhaps it would be interesting to see more of the stats output for your situation as well. You can take a look at some code that spits out all of the STATs and FAULTs here: