fix: red-team.sh sudo strips FORK_URL before docker compose sees it (#729)

red-team.sh called bare `sudo docker compose up/down` which applies
env_reset and drops FORK_URL before anvil-entrypoint.sh can read it.
Change both calls to `sudo -E` so the caller's FORK_URL override is
propagated to docker-compose and into the anvil container.

Update ENVIRONMENT.md to reflect that a plain `FORK_URL=... bash
red-team.sh` invocation now works correctly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
openhands 2026-03-14 08:30:49 +00:00
parent 5b4e867c4b
commit 52ed8ef233
2 changed files with 6 additions and 4 deletions

View file

@ -63,11 +63,13 @@ cd "$REPO_ROOT"
sudo sh -c 'echo 3 > /proc/sys/vm/drop_caches' 2>/dev/null || true
# Tear down completely (volumes too — clean anvil state)
sudo docker compose down -v >/dev/null 2>&1 || true
sudo -E docker compose down -v >/dev/null 2>&1 || true
sleep 3
# Bring up
sudo docker compose up -d >/dev/null 2>&1 \
# -E preserves FORK_URL (and other env vars) across the sudo boundary so that
# anvil-entrypoint.sh honours the caller's FORK_URL override.
sudo -E docker compose up -d >/dev/null 2>&1 \
|| die "docker compose up -d failed"
# Wait for bootstrap to complete (max 120s)