Git credential helper uses the wrong Python environment in Codex sandboxes
I hit this in a Codex-backed Modal sandbox while running git pull --ff-only. The Git credential helper crashed before it could authenticate:
ModuleNotFoundError: No module named 'pydantic'
Installing Pydantic into that interpreter exposed the same error for httpx. Both packages were already installed in the sandbox runtime's virtualenv. I have not hit this in OpenCode.
What I found
The helper runs python3 -m sandbox_runtime.credentials.git_credential_helper. In the failing shell, python3 resolves to /usr/local/bin/python3, which is a symlink to /opt/openinspect/python/bin/python.
Calling Python through that outside-venv symlink loses the virtualenv. These were the prefixes in the sandbox:
| Invocation | sys.prefix |
|---|---|
/usr/local/bin/python3 |
/opt/openinspect/python-downloads/cpython-3.12.12-linux-x86_64-gnu |
/opt/openinspect/python/bin/python |
/opt/openinspect/python |
The first invocation searches the base interpreter's packages instead of the runtime virtualenv. This makes Git authentication depend on which Python the agent's shell selects.
Proposed fix
Use /opt/openinspect/python/bin/python explicitly for the platform credential helper in:
packages/sandbox-images/install/filesystem.shpackages/sandbox-runtime/src/sandbox_runtime/gh-wrapper.shpackages/sandbox-runtime/src/sandbox_runtime/repository_sync.py
The startup path in repository_sync.py matters because it regenerates the Git helper and would undo an image-only fix.
I have this fix locally. A regression check with a dependency-free python3 first reproduced the Pydantic failure, then passed with the explicit runtime interpreter. All 51 targeted credential-helper and startup tests passed. No dependency additions or changes to the general Python symlinks were needed.