From e032d4417914d7f1ddd669dd7a73f400d0ab06c6 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Tue, 21 Apr 2026 04:10:33 +0100 Subject: [PATCH] test: bound installer e2e agent turns --- scripts/docker/install-sh-e2e/run.sh | 53 ++++++++++++++++++++++++++- scripts/test-install-sh-e2e-docker.sh | 1 + 2 files changed, 53 insertions(+), 1 deletion(-) diff --git a/scripts/docker/install-sh-e2e/run.sh b/scripts/docker/install-sh-e2e/run.sh index 933e1f77e09..e27f45c8866 100755 --- a/scripts/docker/install-sh-e2e/run.sh +++ b/scripts/docker/install-sh-e2e/run.sh @@ -17,6 +17,7 @@ SKIP_PREVIOUS="${OPENCLAW_INSTALL_E2E_SKIP_PREVIOUS:-0}" OPENAI_API_KEY="${OPENAI_API_KEY:-}" ANTHROPIC_API_KEY="${ANTHROPIC_API_KEY:-}" ANTHROPIC_API_TOKEN="${ANTHROPIC_API_TOKEN:-}" +AGENT_TURN_TIMEOUT_SECONDS="${OPENCLAW_INSTALL_E2E_AGENT_TURN_TIMEOUT_SECONDS:-600}" # This image runs as a non-root user, so seed a user-local npm prefix before we # preinstall an older global version to exercise the upgrade path. @@ -194,12 +195,21 @@ run_agent_turn() { # Installer E2E validates install + onboard + embedded agent tooling. It does # not need a paired Gateway control-plane hop, which is flaky/non-deterministic # in the isolated container and already covered by gateway-specific lanes. - openclaw --profile "$profile" agent \ + set +e + timeout --kill-after=15s "${AGENT_TURN_TIMEOUT_SECONDS}s" \ + openclaw --profile "$profile" agent \ --local \ --session-id "$session_id" \ --message "$prompt" \ --thinking off \ --json >"$out_json" 2>&1 + local status="$?" + set -e + if [[ "$status" -ne 0 ]]; then + echo "ERROR: agent turn failed ($profile, status=$status, output=$out_json)" >&2 + dump_profile_debug "$profile" "$out_json" >&2 || true + return "$status" + fi node - <<'NODE' "$out_json" const fs = require("node:fs"); @@ -233,6 +243,47 @@ fs.writeFileSync(path, `${JSON.stringify(parsed, null, 2)}\n`, "utf8"); NODE } +dump_profile_debug() { + local profile="$1" + local turn_output="$2" + + echo "---- agent turn output ($profile) ----" + if [[ -f "$turn_output" ]]; then + tail -n 200 "$turn_output" + else + echo "missing: $turn_output" + fi + + echo "---- gateway log ($profile) ----" + if [[ -n "${GATEWAY_LOG:-}" && -f "$GATEWAY_LOG" ]]; then + tail -n 200 "$GATEWAY_LOG" + else + echo "missing: ${GATEWAY_LOG:-}" + fi + + echo "---- session transcript ($profile) ----" + if [[ -n "${SESSION_JSONL:-}" && -f "$SESSION_JSONL" ]]; then + tail -n 80 "$SESSION_JSONL" + else + echo "missing: ${SESSION_JSONL:-}" + if [[ -n "${SESSION_JSONL:-}" ]]; then + ls -la "$(dirname "$SESSION_JSONL")" 2>/dev/null || true + fi + fi + + echo "---- openclaw processes ($profile) ----" + for cmdline in /proc/[0-9]*/cmdline; do + [[ -r "$cmdline" ]] || continue + local pid + pid="$(basename "$(dirname "$cmdline")")" + local command + command="$(tr '\0' ' ' <"$cmdline" | sed 's/[[:space:]]*$//')" + if [[ "$command" == *openclaw* || "$command" == *node* ]]; then + echo "$pid $command" + fi + done +} + assert_agent_json_has_text() { local path="$1" node - <<'NODE' "$path" diff --git a/scripts/test-install-sh-e2e-docker.sh b/scripts/test-install-sh-e2e-docker.sh index 3eb078a6d5e..217e5ba6ee4 100755 --- a/scripts/test-install-sh-e2e-docker.sh +++ b/scripts/test-install-sh-e2e-docker.sh @@ -23,6 +23,7 @@ docker run --rm \ -e OPENCLAW_E2E_MODELS="$OPENCLAW_E2E_MODELS" \ -e OPENCLAW_INSTALL_E2E_PREVIOUS="${OPENCLAW_INSTALL_E2E_PREVIOUS:-}" \ -e OPENCLAW_INSTALL_E2E_SKIP_PREVIOUS="${OPENCLAW_INSTALL_E2E_SKIP_PREVIOUS:-0}" \ + -e OPENCLAW_INSTALL_E2E_AGENT_TURN_TIMEOUT_SECONDS="${OPENCLAW_INSTALL_E2E_AGENT_TURN_TIMEOUT_SECONDS:-600}" \ -e OPENCLAW_NO_ONBOARD=1 \ -e OPENAI_API_KEY \ -e ANTHROPIC_API_KEY \