From d48b0f17acfef9c77b5ea7a671dd05fd812de066 Mon Sep 17 00:00:00 2001 From: openhands Date: Thu, 12 Mar 2026 13:16:24 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20swap=20threshold=20=E2=80=94=20only=20P0?= =?UTF-8?q?=20if=20swap=20>3GB=20AND=20avail=20<2GB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit High swap with healthy available RAM is normal (dockerd pages out). Only alert when both swap is high and available RAM is low. --- factory/factory-poll.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/factory/factory-poll.sh b/factory/factory-poll.sh index fa1cd99..69c0fff 100755 --- a/factory/factory-poll.sh +++ b/factory/factory-poll.sh @@ -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)