fix(workspace): chown /workspace when root-owned bind mount (#13) - #47
Merged
Conversation
…ned (#13) On Docker Desktop (macOS/Windows), host-path bind mounts often appear root-owned inside the container. The previous entrypoint only chowned /workspace top-level, so agents (uid 1000) still couldn't write to /workspace/repo/* — git clone, pip install, and file edits failed with EACCES and fell back to /tmp. Detect the root-owned-contents case by sampling the first entry; if it's root-owned, recursively chown the tree. On normal Linux Docker with matching uids this is a no-op, so the fast-startup path is preserved for the common case. Part B of the issue (private-repo initial_prompt clone) was addressed by PR #20. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
HongmingWang-Rabbit
marked this pull request as ready for review
April 14, 2026 14:30
Contributor
Author
|
Gates 1-7 pass:
Merging. |
4 tasks
molecule-ai Bot
pushed a commit
that referenced
this pull request
Apr 21, 2026
fix(workspace): chown /workspace when root-owned bind mount (#13)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #13 (Part A — chown). Part B (private-repo initial_prompt clone) was already addressed by PR #20.
Problem
On Docker Desktop (macOS / Windows), host-path bind mounts commonly appear root-owned inside the container because the host uid doesn't map cleanly. Agents run as uid=1000, so git clone, pip install, and file edits under
/workspace/repo/*fail with EACCES — Hermes Dev Lead saw this today and had to fall back to/tmp/hermes-work+ emit a patch file.The previous entrypoint chowned only the
/workspacetop-level, which wasn't enough: contents stayed root-owned.Approach
In
workspace-template/entrypoint.sh, after the existing top-level chown, sample the first entry inside/workspace. If it's root-owned, assume the whole tree came in via a root-owned bind mount and do a fullchown -R agent:agent /workspace. Otherwise skip — on normal Linux Docker with matching uids this stays a no-op, preserving the existing fast-startup path.The block runs in the existing root branch of the entrypoint, before the
exec gosu agenthandoff to the agent user, so no Dockerfile changes are needed.Test plan
bash -n workspace-template/entrypoint.shpassesshellcheckclean on new lines (pre-existing SC2164 on line 81 is unrelated)docker build+docker run -v <root-owned-dir>:/workspace→ agent can write to/workspace/repo/*🤖 Generated with Claude Code