fix: bypass git safe.directory for agent-system submodule in VMs #1

Merged
hermes merged 2 commits from vm-cal/git-safe-directory into main 2026-08-26 10:47:09 +00:00
Owner

Review request. Bootstrap and validate now set safe.directory for the agent-system submodule in VM images; covered by tests/test_vm_setup.py.

Review request. Bootstrap and validate now set safe.directory for the agent-system submodule in VM images; covered by tests/test_vm_setup.py.
fix: bypass git safe.directory for agent-system submodule in VMs
Some checks failed
VM agent setup / validate (push) Has been cancelled
VM agent setup / validate (pull_request) Has been cancelled
df9d26a8ae
In containerized or multi-user VMs, the agent-system submodule directory
may be owned by a different user (e.g., root) than the invoking process.
When the global git config is read-only or lacks a safe.directory entry
for the submodule, git commands fail with 'detected dubious ownership'.

This breaks validate.sh (the VM gate) and causes bootstrap.sh to skip the
shared system install even when the submodule is at the exact clean pin.

Fix by injecting safe.directory via GIT_CONFIG_COUNT environment variables
at the top of validate.sh and bootstrap.sh. This propagates to all child
processes, including the shared-system submodule validation, without
needing to write to any git config file.

Tests updated:
- Verify submodule git commands use explicit -c safe.directory
- Prove commands fail without it when GIT_CONFIG_GLOBAL is /dev/null
- Preserve original gitconfig path in test environments where HOME is
  overridden to a temp directory

CHANGELOG.md updated.
fix: safely export git safe-directory configuration
Some checks failed
VM agent setup / validate (push) Has been cancelled
VM agent setup / validate (pull_request) Has been cancelled
759afb742d
hermes merged commit 349be6f9bc into main 2026-08-26 10:47:09 +00:00
Sign in to join this conversation.
No description provided.