mirror of
https://github.com/bitbaum/openclaw.git
synced 2026-12-04 05:47:24 +01:00
* fix(ci): accept plugin fixture capabilities * fix(ci): detect fixture capability consent support Probe candidate command help through the existing bounded E2E runners so positive fixtures accept capabilities only when that command supports it. Preserve historical packages, probe failures, argv, and child exit status; keep negative, no-op, and integrity-bound update coverage unapproved. Replace duplicated probes and source-string checks with executable compatibility regressions. Synchronize the RPC timeout test with real process readiness before advancing its unchanged 100 ms deadline, while retaining real process-group termination and cleanup. Co-authored-by: Vincent Koc <vincentkoc@ieee.org> * fix(ci): run Docker lanes from trusted harness Resolve package scripts and packaging tools from the trusted harness while keeping candidate source, artifacts, registry identity, and preflight on the frozen target. Remove candidate-script lane filtering and the duplicate live command wrapper; preserve source inputs in source-built Docker lanes. Prove the public scheduler boundary with distinct harness/target roots and poisoned candidate scripts. Synchronize scheduler timeout fixtures with real child readiness, retain real signals and kill grace, and handle empty QR build arguments on Bash 3. Co-authored-by: Vincent Koc <vincentkoc@ieee.org> * test(ci): retire superseded harness source assertions Keep the workflow trust and pnpm PATH guards, but remove checks for the old inline replacement and deleted duplicate live-script wrapper. The public scheduler regressions now prove those behaviors through distinct candidate/harness roots and quoted pinned pnpm commands. Co-authored-by: Vincent Koc <vincentkoc@ieee.org> * test(ci): cover multi-build source roots * fix(ci): select the harness toolchain before Docker lanes Start prepared pnpm commands in the trusted harness before Corepack resolves its package-manager pin. Preserve frozen candidate source and artifact identity, and resolve relative executable and cache paths before changing cwd. Keep quoted rerun environment values out of executable substitution. Cover different toolchain pins, shell-sensitive paths, and generated reruns through the public scheduler boundary. Co-authored-by: Vincent Koc <vincentkoc@ieee.org> --------- Co-authored-by: Peter Steinberger <steipete@gmail.com>
194 lines
8.1 KiB
Bash
Executable File
194 lines
8.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Installs a packed plugin with a real npm dependency, exposes its tool to a
|
|
# live OpenAI agent turn, and verifies the model received the dependency-made string.
|
|
set -euo pipefail
|
|
|
|
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
|
source "$ROOT_DIR/scripts/lib/openclaw-e2e-instance.sh"
|
|
source "$ROOT_DIR/scripts/lib/docker-e2e-image.sh"
|
|
source "$ROOT_DIR/scripts/lib/docker-e2e-package.sh"
|
|
|
|
IMAGE_NAME="$(docker_e2e_resolve_image "openclaw-live-plugin-tool-e2e" OPENCLAW_LIVE_PLUGIN_TOOL_E2E_IMAGE)"
|
|
DOCKER_TARGET="${OPENCLAW_LIVE_PLUGIN_TOOL_DOCKER_TARGET:-bare}"
|
|
HOST_BUILD="${OPENCLAW_LIVE_PLUGIN_TOOL_HOST_BUILD:-1}"
|
|
PACKAGE_TGZ="${OPENCLAW_CURRENT_PACKAGE_TGZ:-}"
|
|
PROFILE_FILE="${OPENCLAW_LIVE_PLUGIN_TOOL_PROFILE_FILE:-${OPENCLAW_TESTBOX_PROFILE_FILE:-$HOME/.openclaw-testbox-live.profile}}"
|
|
AGENT_TURN_TIMEOUT_SECONDS="$(openclaw_e2e_read_positive_int_env OPENCLAW_LIVE_PLUGIN_TOOL_TIMEOUT_SECONDS 300)"
|
|
AGENT_OUTPUT_MAX_BYTES="$(openclaw_e2e_read_positive_int_env OPENCLAW_LIVE_PLUGIN_TOOL_AGENT_OUTPUT_MAX_BYTES 1048576)"
|
|
AGENT_OUTPUT_DUMP_BYTES="$(openclaw_e2e_read_nonnegative_int_env OPENCLAW_LIVE_PLUGIN_TOOL_AGENT_OUTPUT_DUMP_BYTES 16384)"
|
|
SESSION_SCAN_MAX_ENTRIES="$(openclaw_e2e_read_positive_int_env OPENCLAW_LIVE_PLUGIN_TOOL_SESSION_SCAN_MAX_ENTRIES 50000)"
|
|
run_log=""
|
|
|
|
cleanup() {
|
|
if [ -n "${PACKAGE_TGZ:-}" ]; then
|
|
docker_e2e_cleanup_package_tgz "$PACKAGE_TGZ"
|
|
fi
|
|
if [ -n "${run_log:-}" ]; then
|
|
rm -f "$run_log"
|
|
fi
|
|
}
|
|
trap cleanup EXIT
|
|
|
|
if [ ! -f "$PROFILE_FILE" ] && [ -f "$HOME/.profile" ]; then
|
|
PROFILE_FILE="$HOME/.profile"
|
|
fi
|
|
|
|
docker_e2e_build_or_reuse "$IMAGE_NAME" live-plugin-tool "$ROOT_DIR/scripts/e2e/Dockerfile" "$ROOT_DIR" "$DOCKER_TARGET"
|
|
|
|
prepare_package_tgz() {
|
|
if [ -n "$PACKAGE_TGZ" ]; then
|
|
PACKAGE_TGZ="$(docker_e2e_prepare_package_tgz live-plugin-tool "$PACKAGE_TGZ")"
|
|
return 0
|
|
fi
|
|
if [ "$HOST_BUILD" = "0" ] && [ -z "${OPENCLAW_CURRENT_PACKAGE_TGZ:-}" ]; then
|
|
echo "OPENCLAW_LIVE_PLUGIN_TOOL_HOST_BUILD=0 requires OPENCLAW_CURRENT_PACKAGE_TGZ" >&2
|
|
exit 1
|
|
fi
|
|
PACKAGE_TGZ="$(docker_e2e_prepare_package_tgz live-plugin-tool)"
|
|
}
|
|
|
|
prepare_package_tgz
|
|
|
|
PROFILE_MOUNT=()
|
|
PROFILE_STATUS="none"
|
|
if [ -f "$PROFILE_FILE" ] && [ -r "$PROFILE_FILE" ]; then
|
|
set -a
|
|
# shellcheck disable=SC1090
|
|
source "$PROFILE_FILE"
|
|
set +a
|
|
PROFILE_MOUNT=(-v "$PROFILE_FILE":/home/appuser/.profile:ro)
|
|
PROFILE_STATUS="$PROFILE_FILE"
|
|
fi
|
|
AGENT_TURN_TIMEOUT_SECONDS="$(openclaw_e2e_read_positive_int_env OPENCLAW_LIVE_PLUGIN_TOOL_TIMEOUT_SECONDS "$AGENT_TURN_TIMEOUT_SECONDS")"
|
|
COMMAND_TIMEOUT="${OPENCLAW_E2E_COMMAND_TIMEOUT:-$((10#$AGENT_TURN_TIMEOUT_SECONDS + 60))s}"
|
|
|
|
docker_e2e_package_mount_args "$PACKAGE_TGZ"
|
|
run_log="$(docker_e2e_run_log live-plugin-tool)"
|
|
OPENCLAW_TEST_STATE_SCRIPT_B64="$(docker_e2e_test_state_shell_b64 live-plugin-tool empty)"
|
|
|
|
echo "Running live plugin tool Docker E2E..."
|
|
echo "Profile file: $PROFILE_STATUS"
|
|
if ! docker_e2e_run_with_harness \
|
|
-e COREPACK_ENABLE_DOWNLOAD_PROMPT=0 \
|
|
-e OPENAI_API_KEY \
|
|
-e OPENAI_BASE_URL \
|
|
-e OPENCLAW_LIVE_PLUGIN_TOOL_MODEL="${OPENCLAW_LIVE_PLUGIN_TOOL_MODEL:-openai/gpt-5.6-luna}" \
|
|
-e "OPENCLAW_LIVE_PLUGIN_TOOL_AGENT_OUTPUT_DUMP_BYTES=$AGENT_OUTPUT_DUMP_BYTES" \
|
|
-e "OPENCLAW_LIVE_PLUGIN_TOOL_AGENT_OUTPUT_MAX_BYTES=$AGENT_OUTPUT_MAX_BYTES" \
|
|
-e "OPENCLAW_LIVE_PLUGIN_TOOL_SESSION_SCAN_MAX_ENTRIES=$SESSION_SCAN_MAX_ENTRIES" \
|
|
-e "OPENCLAW_LIVE_PLUGIN_TOOL_TIMEOUT_SECONDS=$AGENT_TURN_TIMEOUT_SECONDS" \
|
|
-e "OPENCLAW_E2E_COMMAND_TIMEOUT=$COMMAND_TIMEOUT" \
|
|
-e "OPENCLAW_TEST_STATE_SCRIPT_B64=$OPENCLAW_TEST_STATE_SCRIPT_B64" \
|
|
"${DOCKER_E2E_PACKAGE_ARGS[@]}" \
|
|
"${PROFILE_MOUNT[@]}" \
|
|
-i "$IMAGE_NAME" bash -s >"$run_log" 2>&1 <<'EOF'; then
|
|
set -euo pipefail
|
|
|
|
source scripts/lib/openclaw-e2e-instance.sh
|
|
openclaw_e2e_eval_test_state_from_b64 "${OPENCLAW_TEST_STATE_SCRIPT_B64:?missing OPENCLAW_TEST_STATE_SCRIPT_B64}"
|
|
export NPM_CONFIG_PREFIX="$HOME/.npm-global"
|
|
export npm_config_prefix="$NPM_CONFIG_PREFIX"
|
|
export XDG_CACHE_HOME="${XDG_CACHE_HOME:-$HOME/.cache}"
|
|
export NPM_CONFIG_CACHE="${NPM_CONFIG_CACHE:-$XDG_CACHE_HOME/npm}"
|
|
export npm_config_cache="$NPM_CONFIG_CACHE"
|
|
export PATH="$NPM_CONFIG_PREFIX/bin:$PATH"
|
|
export OPENCLAW_AGENT_HARNESS_FALLBACK=none
|
|
|
|
for profile_path in "$HOME/.profile" /home/appuser/.profile; do
|
|
if [ -f "$profile_path" ] && [ -r "$profile_path" ]; then
|
|
set +e +u
|
|
source "$profile_path"
|
|
set -euo pipefail
|
|
break
|
|
fi
|
|
done
|
|
if [ -z "${OPENAI_API_KEY:-}" ]; then
|
|
echo "ERROR: OPENAI_API_KEY was not available after sourcing ~/.profile." >&2
|
|
exit 1
|
|
fi
|
|
export OPENAI_API_KEY
|
|
if [ -n "${OPENAI_BASE_URL:-}" ]; then
|
|
export OPENAI_BASE_URL
|
|
fi
|
|
|
|
MODEL_REF="${OPENCLAW_LIVE_PLUGIN_TOOL_MODEL:?missing OPENCLAW_LIVE_PLUGIN_TOOL_MODEL}"
|
|
PLUGIN_ID="e2e-slug-tool"
|
|
PLUGIN_NAME="@openclaw/e2e-slug-tool"
|
|
PLUGIN_VERSION="0.0.0-e2e.1"
|
|
TOOL_NAME="e2e_slug_probe"
|
|
SEED="OpenClaw E2E Plugin Tool $(date +%s)-$RANDOM"
|
|
EXPECTED_SLUG="$(printf '%s' "$SEED" | tr '[:upper:]' '[:lower:]' | sed -E 's/[^a-z0-9]+/-/g; s/^-+//; s/-+$//')"
|
|
export MODEL_REF PLUGIN_ID PLUGIN_NAME PLUGIN_VERSION TOOL_NAME SEED EXPECTED_SLUG
|
|
|
|
dump_debug_logs() {
|
|
local status="$1"
|
|
local agent_output_dump_bytes="${OPENCLAW_LIVE_PLUGIN_TOOL_AGENT_OUTPUT_DUMP_BYTES:-16384}"
|
|
echo "Live plugin tool scenario failed with exit code $status" >&2
|
|
if [ -f /tmp/openclaw-agent.json ]; then
|
|
echo "--- /tmp/openclaw-agent.json (last ${agent_output_dump_bytes} bytes) ---" >&2
|
|
tail -c "$agent_output_dump_bytes" /tmp/openclaw-agent.json >&2 || true
|
|
echo >&2
|
|
fi
|
|
openclaw_e2e_dump_logs \
|
|
/tmp/openclaw-install.log \
|
|
/tmp/openclaw-plugin-install.log \
|
|
/tmp/openclaw-plugin-enable.log \
|
|
/tmp/openclaw-plugins-list.json \
|
|
/tmp/openclaw-plugin-inspect.json \
|
|
/tmp/openclaw-live-plugin-tool-pack.log \
|
|
/tmp/openclaw-agent.err
|
|
}
|
|
trap 'status=$?; dump_debug_logs "$status"; exit "$status"' ERR
|
|
|
|
mkdir -p "$NPM_CONFIG_PREFIX" "$XDG_CACHE_HOME" "$NPM_CONFIG_CACHE"
|
|
chmod 700 "$XDG_CACHE_HOME" "$NPM_CONFIG_CACHE" || true
|
|
|
|
openclaw_e2e_install_package /tmp/openclaw-install.log
|
|
command -v openclaw >/dev/null
|
|
openclaw_e2e_enable_openclaw_cli_timeout
|
|
|
|
fixture_dir="$(mktemp -d /tmp/openclaw-live-plugin-tool.XXXXXX)"
|
|
plugin_dir="$fixture_dir/package"
|
|
mkdir -p "$plugin_dir"
|
|
node --disable-warning=ExperimentalWarning scripts/e2e/lib/live-plugin-tool/assertions.mjs write-fixture "$plugin_dir"
|
|
(cd "$plugin_dir" && npm pack --pack-destination "$fixture_dir" --silent) \
|
|
>/tmp/openclaw-live-plugin-tool-pack.log 2>&1
|
|
plugin_tgzs=()
|
|
while IFS= read -r packed_file; do
|
|
plugin_tgzs+=("$packed_file")
|
|
done < <(find "$fixture_dir" -maxdepth 1 -type f -name '*.tgz' | sort)
|
|
if [ "${#plugin_tgzs[@]}" -ne 1 ]; then
|
|
echo "Expected one packed fixture plugin tarball; found ${#plugin_tgzs[@]}." >&2
|
|
openclaw_e2e_dump_logs /tmp/openclaw-live-plugin-tool-pack.log
|
|
exit 1
|
|
fi
|
|
plugin_tgz="${plugin_tgzs[0]}"
|
|
|
|
echo "Installing fixture plugin from npm-pack: $plugin_tgz"
|
|
openclaw_e2e_fixture_plugin_command openclaw -- plugins install "npm-pack:$plugin_tgz" --force >/tmp/openclaw-plugin-install.log 2>&1
|
|
node --disable-warning=ExperimentalWarning scripts/e2e/lib/live-plugin-tool/assertions.mjs configure
|
|
openclaw plugins enable "$PLUGIN_ID" >/tmp/openclaw-plugin-enable.log 2>&1
|
|
openclaw plugins list --json >/tmp/openclaw-plugins-list.json
|
|
openclaw plugins inspect "$PLUGIN_ID" --runtime --json >/tmp/openclaw-plugin-inspect.json
|
|
node --disable-warning=ExperimentalWarning scripts/e2e/lib/live-plugin-tool/assertions.mjs assert-installed
|
|
|
|
echo "Running live OpenAI agent turn that must call $TOOL_NAME..."
|
|
openclaw agent --local \
|
|
--agent main \
|
|
--session-id live-plugin-tool \
|
|
--model "$MODEL_REF" \
|
|
--message "Call the tool named ${TOOL_NAME}. Reply with only the exact text returned by that tool. Do not compute, transform, or explain it." \
|
|
--thinking off \
|
|
--timeout "${OPENCLAW_LIVE_PLUGIN_TOOL_TIMEOUT_SECONDS:-300}" \
|
|
--json >/tmp/openclaw-agent.json 2>/tmp/openclaw-agent.err
|
|
|
|
node --disable-warning=ExperimentalWarning scripts/e2e/lib/live-plugin-tool/assertions.mjs assert-agent-turn
|
|
|
|
echo "Live plugin tool Docker E2E passed"
|
|
EOF
|
|
docker_e2e_print_log "$run_log"
|
|
exit 1
|
|
fi
|
|
|
|
echo "Live plugin tool Docker E2E passed"
|