fix(docker): widen chown prune to the entire hermes-agent path
PR #2470 introduces a `:ro` mount for the `hermes-agent-src` named volume on the WebUI side of `docker-compose.{two,three}-container.yml`. The WebUI's docker_init.bash unconditionally runs `chown_home_hermeswebui` which walks `/home/hermeswebui` with `find -exec chown -h {} +`, pruning only `/home/hermeswebui/.hermes/hermes-agent/.git/objects` (the narrow #2237 fix for macOS bind mounts). With the new `:ro` mount, every other file inside the hermes-agent subtree is also on a read-only filesystem. `chown` returns `EROFS`, `find -exec ... +` propagates the non-zero exit, and the wrapping `chown_home_hermeswebui || error_exit "..."` under `set -e` kills the container before the WebUI server can run. Verified locally: $ /usr/bin/find /tmp/ftest -exec false {} + $ echo $? 1 So `find` does propagate `-exec` command failures, which the existing `|| error_exit` then catches. The WebUI never writes to the agent source — `uv pip install /home/hermeswebui/.hermes/hermes-agent` is a pure read. So aligning ownership inside the agent subtree was always a nicety, not a requirement. Widen the prune to skip the entire `/home/hermeswebui/.hermes/hermes-agent` path. This also subsumes the original #2237 case (the `.git/objects` packs are inside the now-pruned subtree) without needing a separate carve-out. Test updates: - Renamed `test_home_chown_skips_hermes_agent_git_objects` → `test_home_chown_skips_hermes_agent_subtree`, and pinned the broader prune target (`-path ".../hermes-agent" -prune`). - Added `test_home_chown_helper_documents_readonly_mount_compat` so a future maintainer narrowing the prune back to `.git/objects` (and re-introducing the EROFS failure mode) trips a regression. Verified: - `tests/test_issue2237_docker_chown_git_objects.py` 4/4 pass. - `tests/test_docker_docs_and_readonly.py` 9/9 pass. - Full suite: 5738 passed, 0 failed. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
5cc8b6c654
commit
2d66263a6c
2 files changed
+40
-4
No files matched your search
+10
-1
@@ -185,8 +185,17 @@ chown_home_hermeswebui() {
|
||||
# macOS Docker bind mounts can expose hermes-agent git object packs as
|
||||
# read-only host files. The runtime only needs to read those existing objects;
|
||||
# requiring chown on them makes startup fail before WebUI can run (#2237).
|
||||
#
|
||||
# Multi-container compose (#2470) additionally mounts the entire
|
||||
# hermes-agent-src volume read-only on the WebUI side because the WebUI only
|
||||
# reads it for `uv pip install`. On a :ro mount, chown returns EROFS for any
|
||||
# file inside the subtree, which would propagate to `set -e` and kill startup
|
||||
# before the WebUI can run. Either way, the WebUI never writes to the agent
|
||||
# source — prune the entire hermes-agent path from the chown walk so a
|
||||
# read-only or partially-read-only mount doesn't break the rest of the home
|
||||
# ownership alignment.
|
||||
find /home/hermeswebui \
|
||||
-path "/home/hermeswebui/.hermes/hermes-agent/.git/objects" -prune \
|
||||
-path "/home/hermeswebui/.hermes/hermes-agent" -prune \
|
||||
-o -exec chown -h "${WANTED_UID}:${WANTED_GID}" {} +
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user