What issue are you seeing?
On Linux, apply_patch fails when editing files inside an Android repo tool managed subproject whose .git entry is a symlink to a directory under .repo/projects/....
The failure happens in Codex's sandboxed apply_patch path and produces an error like:
bwrap: Can't create file at /path/to/subproject/.git: Is a directory
Example Android repo layout:
workspace/
.repo/projects/<subproject>.git/
<subproject>/.git -> ../.repo/projects/<subproject>.git
Important detail: calling the apply_patch binary directly from the shell succeeds. The failure appears when the apply_patch tool is executed through Codex's Linux sandbox / bubblewrap path.
Environment observed on my side:
codex-cli 0.117.0
bubblewrap 0.6.1
Linux 6.8.0-106-generic x86_64 GNU/Linux
What steps can reproduce the bug?
- Use Linux and run Codex CLI in
workspace-write mode.
- Work inside a checkout managed by the Android
repo tool.
- Enter a subproject whose
.git is a symlink to a directory under .repo/projects/....
- Ask Codex to use
apply_patch on any file in that subproject.
- Observe the sandbox setup failure:
bwrap: Can't create file at .../.git: Is a directory
Minimal bwrap reproducer:
mkdir -p /tmp/repro/workspace/subproject /tmp/repro/workspace/gitdir
ln -s ../gitdir /tmp/repro/workspace/subproject/.git
bwrap --ro-bind / / --ro-bind /dev/null /tmp/repro/workspace/subproject/.git -- true
This reproduces:
bwrap: Can't create file at /tmp/repro/workspace/subproject/.git: Is a directory
What is the expected behavior?
apply_patch should not fail just because a protected path like .git is a symlink to a directory.
Codex should either:
- mask that protected path in a way compatible with
bwrap, or
- fall back to a different safe masking strategy for symlinked directory targets.
Additional information
This looks like a Linux sandbox bug rather than an Android repo project bug.
The likely root cause is in codex-rs/linux-sandbox/src/bwrap.rs:
append_read_only_subpath_args()
append_unreadable_root_args()
Today, symlinked protected paths are masked with:
--ro-bind /dev/null <symlink-path>
That works for symlinks to files, but not for symlinks to directories. When the symlink target is a directory, bubblewrap follows it and aborts with:
A likely fix is to branch on the resolved target type:
- symlink to file: keep using a file-style mask such as
/dev/null
- symlink to directory: use a directory-style read-only mask instead of
/dev/null
This is a realistic trigger for Android repo workspaces because subprojects commonly have:
subproject/.git -> ../.repo/projects/<subproject>.git
This is not specific to any one private codebase. It should affect any workspace managed by the Android repo tool where subprojects use the standard .git -> ../.repo/projects/... layout.
What issue are you seeing?
On Linux,
apply_patchfails when editing files inside an Androidrepotool managed subproject whose.gitentry is a symlink to a directory under.repo/projects/....The failure happens in Codex's sandboxed
apply_patchpath and produces an error like:Example Android
repolayout:Important detail: calling the
apply_patchbinary directly from the shell succeeds. The failure appears when theapply_patchtool is executed through Codex's Linux sandbox / bubblewrap path.Environment observed on my side:
What steps can reproduce the bug?
workspace-writemode.repotool..gitis a symlink to a directory under.repo/projects/....apply_patchon any file in that subproject.Minimal
bwrapreproducer:mkdir -p /tmp/repro/workspace/subproject /tmp/repro/workspace/gitdir ln -s ../gitdir /tmp/repro/workspace/subproject/.git bwrap --ro-bind / / --ro-bind /dev/null /tmp/repro/workspace/subproject/.git -- trueThis reproduces:
What is the expected behavior?
apply_patchshould not fail just because a protected path like.gitis a symlink to a directory.Codex should either:
bwrap, orAdditional information
This looks like a Linux sandbox bug rather than an Android
repoproject bug.The likely root cause is in
codex-rs/linux-sandbox/src/bwrap.rs:append_read_only_subpath_args()append_unreadable_root_args()Today, symlinked protected paths are masked with:
That works for symlinks to files, but not for symlinks to directories. When the symlink target is a directory,
bubblewrapfollows it and aborts with:A likely fix is to branch on the resolved target type:
/dev/null/dev/nullThis is a realistic trigger for Android
repoworkspaces because subprojects commonly have:This is not specific to any one private codebase. It should affect any workspace managed by the Android
repotool where subprojects use the standard.git -> ../.repo/projects/...layout.