fix: swap threshold — only P0 if swap >3GB AND avail <2GB

High swap with healthy available RAM is normal (dockerd pages out).
Only alert when both swap is high and available RAM is low.
This commit is contained in:
openhands 2026-03-12 13:16:24 +00:00
parent 19ef44f5b9
commit d48b0f17ac

View file

@ -60,7 +60,7 @@ status "P0: checking memory"
AVAIL_MB=$(free -m | awk '/Mem:/{print $7}')
SWAP_USED_MB=$(free -m | awk '/Swap:/{print $3}')
if [ "${AVAIL_MB:-9999}" -lt 500 ] || [ "${SWAP_USED_MB:-0}" -gt 3000 ]; then
if [ "${AVAIL_MB:-9999}" -lt 500 ] || { [ "${SWAP_USED_MB:-0}" -gt 3000 ] && [ "${AVAIL_MB:-9999}" -lt 2000 ]; }; then
flog "MEMORY CRISIS: avail=${AVAIL_MB}MB swap_used=${SWAP_USED_MB}MB — auto-fixing"
# Kill stale claude processes (>3h old)