hud-python icon indicating copy to clipboard operation
hud-python copied to clipboard

Harbor tasks can't start on Apple Silicon with DOCKER_DEFAULT_PLATFORM=linux/amd64: controller's bubblewrap 0.12 fails under emulation

Open ishan-nerlekar opened this issue 3 weeks ago • 0 comments

What were you doing?

Running Terminal-Bench 2.0 tasks locally through the Harbor adapter, to check that HUD grades them the same way Harbor does: harbor.adapt(<task>), then taskset.run(agent, runtime=DockerRuntime()) with an agent that runs the task's solution/solve.sh over SSH (the Oracle pattern from tests/integrations/harbor/test_controller.py). No model involved. macOS on Apple Silicon, Docker Desktop 29.9.2 (linux/arm64, kernel 7.0.14-linuxkit). Terminal-Bench images are amd64-only, so I set DOCKER_DEFAULT_PLATFORM=linux/amd64 as the Harbor docs advise on arm64 hosts (docs/v6/experimental/harbor.mdx; build.py suggests it too when a native build fails).

Public trace

None: every rollout failed during provisioning, before a session opened.

What happened?

Every rollout failed before serving (regex-log, reference solution and two others):

bwrap is installed but cannot create an isolated process namespace (direct exited with code 1: bwrap: Can't open
source /: Function not implemented; staged exited with code 1: unshare: unshare failed: Operation not permitted);
sessions will run WITHOUT isolation.
Error: isolation was required but bwrap cannot sandbox here: install bubblewrap and use a container runtime that
allows unprivileged user namespaces. Refusing to serve sessions that would silently run unisolated.
RuntimeError: Compose main service exited with code 1 before serving

I expected the reference solution to score 1.0, as it does under Harbor.

Cause, narrowed down outside HUD. The controller image is built FROM python:3.12-slim (Debian 13), and install.sh installs its bubblewrap, 0.12.0. Same sandbox probe as usable_bwrap(), with DockerRuntime's security options (seccomp=hud/eval/docker-seccomp.json, systempaths=unconfined, apparmor=unconfined):

Image bubblewrap linux/arm64 linux/amd64 (emulated)
debian:bookworm 0.8.0 OK OK
python:3.12-slim 0.12.0 OK Can't open source /: Function not implemented

Reproduction (any Apple Silicon Mac with Docker Desktop):

SECCOMP="$(python -c 'import hud, pathlib; print(pathlib.Path(hud.__file__).parent / "eval" / "docker-seccomp.json")')"
docker run --rm --platform linux/amd64 --security-opt "seccomp=$SECCOMP" --security-opt systempaths=unconfined \
  --security-opt apparmor=unconfined python:3.12-slim bash -c \
  'apt-get -qq update && apt-get -qq install -y bubblewrap >/dev/null; bwrap --unshare-user --unshare-pid --ro-bind / / -- /bin/true && echo OK'

bubblewrap 0.12.0 (commit c77dd38) opens bind sources with openat2, and its ENOSYS fallback is compiled in only when built with assume_kernel below 5.6. Under Docker Desktop's amd64 emulation, --debug-opt=force-openat-fallback fails with the same Function not implemented, so Debian's package has no fallback and openat2 isn't available to the emulated binary. User namespaces are fine (arm64 passes with the same options), so the error's advice to use a runtime "that allows unprivileged user namespaces" points the wrong way.

Workaround that worked. Without DOCKER_DEFAULT_PLATFORM, the controller builds natively (arm64), the task's amd64 root filesystem still runs, and grading matches Harbor exactly. Across 8 Terminal-Bench tasks, 39 of 39 graded runs gave Harbor's reward: references and 14 known-wrong solutions on the original tests (22 runs), and the same solutions on corrected tests for 6 tasks (17 runs, wrong solutions 0.0). So the adapter itself looks faithful; only the emulated controller fails. It likely won't help tasks whose verifier image only builds for amd64, which is when build.py tells users to set the variable.

Possible fixes, your call: build the controller stage for the Docker server's native platform even when the task image is amd64; or install a bubblewrap that has the openat2 fallback (or one older than 0.12) in the controller; or at least name emulation in the error, since the current message suggests a user-namespace problem.

hud version

0.6.23

ishan-nerlekar avatar Nov 11 '26 11:11 ishan-nerlekar