diff --git a/agents/hermes/Dockerfile b/agents/hermes/Dockerfile index 8f871ad3775..6a4f90d13eb 100644 --- a/agents/hermes/Dockerfile +++ b/agents/hermes/Dockerfile @@ -69,6 +69,7 @@ ARG NEMOCLAW_MESSAGING_ALLOWED_IDS_B64=e30= ARG NEMOCLAW_DISCORD_GUILDS_B64=e30= ARG NEMOCLAW_TELEGRAM_CONFIG_B64=e30= ARG NEMOCLAW_BUILD_ID=default +ARG NEMOCLAW_DARWIN_VM_COMPAT=0 # Promote build-args to env vars for the config generation script. ENV NEMOCLAW_MODEL=${NEMOCLAW_MODEL} \ @@ -253,6 +254,16 @@ RUN sha256sum /sandbox/.hermes/config.yaml /sandbox/.hermes/.env \ && chmod 600 /sandbox/.hermes/.config-hash \ && chown sandbox:sandbox /sandbox/.hermes/.config-hash +# OpenShell's macOS VM backend currently remaps extracted rootfs ownership to +# the host uid/gid before startup. Hermes uses /sandbox as a read_write path, so +# that repair walks the trusted rc files too; keep this Darwin-only so Linux +# Docker-driver sandboxes retain the tighter default permissions. +RUN if [ "$NEMOCLAW_DARWIN_VM_COMPAT" = "1" ]; then \ + chmod -R a+rwX /sandbox/.hermes; \ + find /sandbox/.hermes -type d -exec chmod a+rwx {} +; \ + chmod a+rw /sandbox/.bashrc /sandbox/.profile; \ + fi + # start.sh handles privilege separation: runs as root initially, then drops # to 'gateway' user via gosu for the agent process. See start.sh. ENTRYPOINT ["/usr/local/bin/nemoclaw-start"] diff --git a/test/e2e/test-openshell-gateway-upgrade.sh b/test/e2e/test-openshell-gateway-upgrade.sh index 49b9d1f9fe3..70287505702 100755 --- a/test/e2e/test-openshell-gateway-upgrade.sh +++ b/test/e2e/test-openshell-gateway-upgrade.sh @@ -307,7 +307,13 @@ exercise_macos_vm_rootfs_permission_regression() { || fail "onboard does not enable macOS VM rootfs compatibility for Darwin sandbox builds" grep -q "chmod -R a+rwX /sandbox/.openclaw" Dockerfile \ || fail "Dockerfile does not relax OpenClaw state permissions for macOS VM rootfs remapping" - pass "macOS VM sandbox builds enable rootfs ownership compatibility" + grep -q "ARG NEMOCLAW_DARWIN_VM_COMPAT=0" agents/hermes/Dockerfile \ + || fail "Hermes Dockerfile is missing the macOS VM rootfs compatibility ARG" + grep -q "chmod -R a+rwX /sandbox/.hermes" agents/hermes/Dockerfile \ + || fail "Hermes Dockerfile does not relax Hermes state permissions for macOS VM rootfs remapping" + grep -q "chmod a+rw /sandbox/.bashrc /sandbox/.profile" agents/hermes/Dockerfile \ + || fail "Hermes Dockerfile does not relax trusted rc files for macOS VM ownership repair" + pass "macOS VM sandbox builds enable OpenClaw and Hermes rootfs ownership compatibility" } wait_for_survivor_ready() {