fix: clear P0/P1 alerts after early send to prevent duplicate Matrix messages

After sending P0/P1 alerts immediately, reset the variables so they are
excluded from the final consolidated ALL_ALERTS send at the end of the
script.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
openhands 2026-03-19 09:23:47 +00:00
parent 5632138cc3
commit 1c93267193

View file

@ -145,6 +145,7 @@ fi
if [ -n "$P0_ALERTS" ]; then
matrix_send "supervisor" "🚨 Supervisor P0 alerts:
$(printf '%b' "$P0_ALERTS")" 2>/dev/null || true
P0_ALERTS="" # clear so it is not duplicated in the final consolidated send
fi
# =============================================================================
@ -194,6 +195,7 @@ fi
if [ -n "$P1_ALERTS" ]; then
matrix_send "supervisor" "⚠️ Supervisor P1 alerts:
$(printf '%b' "$P1_ALERTS")" 2>/dev/null || true
P1_ALERTS="" # clear so it is not duplicated in the final consolidated send
fi
# Emit infra metric