From 2a741450b97d7298de6debd4a0bb20b625d72bdd Mon Sep 17 00:00:00 2001 From: Julie Yaunches Date: Thu, 21 May 2026 22:50:21 -0400 Subject: [PATCH 1/2] test: match openclaw argv gateway fallback --- test/e2e/test-issue-2478-crash-loop-recovery.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/e2e/test-issue-2478-crash-loop-recovery.sh b/test/e2e/test-issue-2478-crash-loop-recovery.sh index eef0a287145..0135c651516 100755 --- a/test/e2e/test-issue-2478-crash-loop-recovery.sh +++ b/test/e2e/test-issue-2478-crash-loop-recovery.sh @@ -107,7 +107,9 @@ sandbox_exec() { # `openclaw gateway run`, some re-title as `openclaw-gateway`, and current # 2026.5.x builds can show only `openclaw` in pgrep/ps even after the gateway # is ready. Prefer explicit gateway argv/title matches, then fall back to the -# oldest live `openclaw` process when gateway.log proves it reached ready. +# oldest live `openclaw` argv process when gateway.log proves it reached ready. +# The fallback matches argv as well as comm because hosted Linux ps can show the +# process comm as `node` even when pgrep reports argv as plain `openclaw`. gateway_pid() { local script script=$( @@ -117,7 +119,9 @@ pid="$(ps -eo pid=,comm=,args= 2>/dev/null | awk ' $2 == "openclaw-gateway" || $0 ~ /openclaw[[:space:]]+gateway([[:space:]]|$)/ || $0 ~ /openclaw-gateway/ { print $1 } ' | sort -n | head -n 1)" if [ -z "$pid" ] && grep -Eq "\[gateway\] (ready|http server listening)" /tmp/gateway.log 2>/dev/null; then - pid="$(ps -eo pid=,comm=,args= 2>/dev/null | awk '$2 == "openclaw" { print $1 }' | sort -n | head -n 1)" + pid="$(ps -eo pid=,comm=,args= 2>/dev/null | awk ' + $2 == "openclaw" || $0 ~ /(^|[[:space:]])openclaw([[:space:]]|$)/ { print $1 } + ' | sort -n | head -n 1)" fi printf "%s\n" "$pid" SH From e2306cdf686994e870bb3d99e40c8f76317cb9d3 Mon Sep 17 00:00:00 2001 From: Julie Yaunches Date: Thu, 21 May 2026 23:01:41 -0400 Subject: [PATCH 2/2] test: use pgrep for ready gateway fallback --- test/e2e/test-issue-2478-crash-loop-recovery.sh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/test/e2e/test-issue-2478-crash-loop-recovery.sh b/test/e2e/test-issue-2478-crash-loop-recovery.sh index 0135c651516..e19a0b7d99a 100755 --- a/test/e2e/test-issue-2478-crash-loop-recovery.sh +++ b/test/e2e/test-issue-2478-crash-loop-recovery.sh @@ -108,8 +108,8 @@ sandbox_exec() { # 2026.5.x builds can show only `openclaw` in pgrep/ps even after the gateway # is ready. Prefer explicit gateway argv/title matches, then fall back to the # oldest live `openclaw` argv process when gateway.log proves it reached ready. -# The fallback matches argv as well as comm because hosted Linux ps can show the -# process comm as `node` even when pgrep reports argv as plain `openclaw`. +# The fallback uses pgrep because hosted Linux diagnostics show pgrep can see +# `311 openclaw` even when the ps columns used above still miss the process. gateway_pid() { local script script=$( @@ -119,9 +119,7 @@ pid="$(ps -eo pid=,comm=,args= 2>/dev/null | awk ' $2 == "openclaw-gateway" || $0 ~ /openclaw[[:space:]]+gateway([[:space:]]|$)/ || $0 ~ /openclaw-gateway/ { print $1 } ' | sort -n | head -n 1)" if [ -z "$pid" ] && grep -Eq "\[gateway\] (ready|http server listening)" /tmp/gateway.log 2>/dev/null; then - pid="$(ps -eo pid=,comm=,args= 2>/dev/null | awk ' - $2 == "openclaw" || $0 ~ /(^|[[:space:]])openclaw([[:space:]]|$)/ { print $1 } - ' | sort -n | head -n 1)" + pid="$(pgrep -fo '[o]penclaw' 2>/dev/null || true)" fi printf "%s\n" "$pid" SH