Summary
In thold_functions.php (lines 3443-3512), the type 2 restoral logic uses < instead of >=:
// Type 0 restoral (correct):
if ($thold_data['thold_warning_fail_count'] >= $warning_trigger ...) {
// send restoral — only when warning was actually triggered
}
// Type 2 restoral (inverted):
if ($alertstat != 0 && $warning_failures < $warning_trigger ...) {
// sends restoral when count is BELOW trigger (never alerted)
}
The < vs >= inversion causes restorals to fire for thresholds that were never triggered, and silently suppresses them for thresholds that were.
Fix
Change < to >= for both $warning_failures and $failures comparisons in the type 2 restoral block.