From 968a039ba81510cd6bb39bf19e96b59e44502140 Mon Sep 17 00:00:00 2001 From: Aaron Erickson Date: Thu, 3 Sep 2026 14:18:25 -0700 Subject: [PATCH 1/2] test(e2e): exercise model override startup path --- test/e2e-gateway-isolation.sh | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/test/e2e-gateway-isolation.sh b/test/e2e-gateway-isolation.sh index 20e6b1672cc..a160df5ba7c 100755 --- a/test/e2e-gateway-isolation.sh +++ b/test/e2e-gateway-isolation.sh @@ -569,23 +569,7 @@ fi info "27. NEMOCLAW_MODEL_OVERRIDE patches openclaw.json" OUT=$(docker run --rm --user root -e NEMOCLAW_MODEL_OVERRIDE="test/override-model" \ - --entrypoint "" "$IMAGE" bash -c ' - # Source the entrypoint function without running the full startup. Keep the - # extraction whitespace-tolerant and fail closed if the function cannot be - # found, instead of sourcing an empty snippet. - APPLY_MODEL_OVERRIDE_SNIPPET=$(sed -n "/^[[:space:]]*apply_model_override[[:space:]]*()[[:space:]]*{/,/^[[:space:]]*}[[:space:]]*$/p" /usr/local/bin/nemoclaw-start) - if [ -z "$APPLY_MODEL_OVERRIDE_SNIPPET" ]; then - echo "EXTRACT_FAIL apply_model_override" - exit 1 - fi - source /dev/stdin <<<"$APPLY_MODEL_OVERRIDE_SNIPPET" - # Keep this case scoped to the JSON rewrite. Permission normalization and - # owner dispatch are exercised by the dedicated cases below. - normalize_mutable_config_perms() { :; } - run_openclaw_config_as_owner() { "$@"; } - ensure_mutable_openclaw_config_hash() { :; } - export NEMOCLAW_MODEL_OVERRIDE="test/override-model" - apply_model_override + "$IMAGE" bash -c ' python3 -c " import json with open(\"/sandbox/.openclaw/openclaw.json\") as f: @@ -598,13 +582,19 @@ all_patched = all( for m in all_models ) if primary == \"test/override-model\" and all_models and all_patched: - print(\"OVERRIDE_OK\") + print(\"OVERRIDE_JSON_OK\") else: - print(f\"OVERRIDE_FAIL primary={primary} models={len(all_models)} all_patched={all_patched}\") + raise SystemExit(f\"OVERRIDE_FAIL primary={primary} models={len(all_models)} all_patched={all_patched}\") " + cd /sandbox/.openclaw + sha256sum -c .config-hash --status + test "$(stat -c "%a %U:%G" .)" = "2770 sandbox:sandbox" + test "$(stat -c "%a %U:%G" openclaw.json)" = "660 sandbox:sandbox" + test "$(stat -c "%a %U:%G" .config-hash)" = "660 sandbox:sandbox" + printf "OVERRIDE_OK\n" ' 2>&1 || true) if echo "$OUT" | grep -q "OVERRIDE_OK"; then - pass "NEMOCLAW_MODEL_OVERRIDE patches primary, id, and name" + pass "model override runs through owner dispatch with valid hash and mutable modes" else fail "model override did not patch correctly: $OUT" fi From 9adb50f50d2957f881955ca45414fffb86e07be7 Mon Sep 17 00:00:00 2001 From: Aaron Erickson Date: Thu, 3 Sep 2026 14:24:07 -0700 Subject: [PATCH 2/2] test(e2e): fail closed on override checks --- test/e2e-gateway-isolation.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/test/e2e-gateway-isolation.sh b/test/e2e-gateway-isolation.sh index a160df5ba7c..89b9c775361 100755 --- a/test/e2e-gateway-isolation.sh +++ b/test/e2e-gateway-isolation.sh @@ -570,6 +570,7 @@ fi info "27. NEMOCLAW_MODEL_OVERRIDE patches openclaw.json" OUT=$(docker run --rm --user root -e NEMOCLAW_MODEL_OVERRIDE="test/override-model" \ "$IMAGE" bash -c ' + set -e python3 -c " import json with open(\"/sandbox/.openclaw/openclaw.json\") as f: