Remote/SSH: Mac-sent turns add a visualization root and break Linux shell startup (bwrap missing .git)
Summary
Sending a message to an existing Linux conversation from the Mac app over Remote/SSH adds a visualization workspace root. Every shell command then fails during Bubblewrap setup. Sending the next message from the server-side terminal removes that extra root and restores shell execution, without changing files or permissions manually.
This is reproducible with either one client connected or both clients open. Chat still works when the shell is broken.
Environment
- Linux server: x86_64, kernel
7.0.0-31-generic; server PATH reportscodex-cli 0.153.4(the exact running app-server build has not been independently verified). - Mac app logs report release
26.901.51231; connected through the built-in SSH connection flow. - Remote bundled Visualize manifest:
1.0.29,bundledContentVariant=live-disabled, enabled in config. - Controlled tests used managed/restricted filesystem permissions,
workspace-write, approval policynever, and restricted network access. - Workspace is the user's home directory; the actual repository is beneath it. The visualization directory exists, but its
.gitchild does not. Paths below are sanitized.
Reproduction
- From the server terminal, send a message asking Codex to run
pwdandgit -C /home/USER/repos/PROJECT status --short. Both succeed; the workspace root is/home/USER. - Open the same conversation in the Mac app through Remote/SSH and send the same request. The incoming workspace roots now also include
/home/USER/.codex/visualizations/YYYY/MM/DD/THREAD_ID. pwdfails before shell startup:
bwrap: Can't mkdir /home/USER/.codex/visualizations/YYYY/MM/DD/THREAD_ID/.git: Read-only file system
- Retry
pwdwithin that Mac-origin turn: same failure. - Send a new message from the server terminal: the visualization root disappears and both commands succeed again. Closing the Mac is not necessary for this recovery.
Controlled results
Tests on September 7, 2026; times are UTC:
| Test | Time | Visualization root | Shell |
|---|---|---|---|
| Server only | 16:34:06 | Absent | Pass |
| Mac only | 16:42:33 | Present | Fail |
| Return to server | 16:44:23 | Absent | Pass |
| Both open, Mac sends | 16:46:23 | Present | Fail |
| Both open, server sends | 16:47:35 | Absent | Pass |
Read-only server-log inspection confirmed that incoming roots and the effective sandbox policy changed with the sending client. In a separate control, opening the Mac conversation during an active server-origin turn logged a resume at 16:49:21; shell checks before and afterward both passed. Attachment alone did not reproduce the failure in that test.
No config edits, plugin disabling, cache cleanup, service restarts, or sandbox bypasses were performed between these test passes. Repository status stayed unchanged.
Expected behavior / investigation
Sending from another client should not make an otherwise working session unable to launch commands. Any visualization output root should coexist safely with the protected .codex ancestor and protected child paths.
The client-dependent root change is observed. An isolated Linux test reproduced the same error and passed after reordering the nested writable bind before its metadata masks. Test results and code references are in the comment below. The actual Codex-generated Bubblewrap arguments remain uncaptured. Mac logs also repeatedly report Visualize installation requested with reason=missing, followed by success, after reconnects; its connection to this failure is unproven.
Possible fix direction: defer a nested writable root's metadata masks until after its writable bind, while preserving the ancestor protections elsewhere. This ordering passed the isolated experiment; no Codex patch has been implemented or validated. The handling of client-added visualization output paths should also be reviewed. Preserve the protections without requiring users to create dummy .git entries or disable sandboxing. A regression test should switch sending clients, verify shell startup, and assert that protected paths remain protected.
Related reports
- #37318: closest shell failure, but its trigger is a non-writable, non-repository cwd. This report adds a client-injected visualization root and a repeatable sender-switch control; it may share the underlying sandbox bug.
- #37570: closely related Remote/SSH permission restoration. Here the controlled failure follows the extra workspace root while sandbox mode and approval policy stay unchanged.
- #30485: related mobile permission restoration; the controlled reproduction above is Mac-to-Linux, not a claim of an independently verified mobile reproduction.
- #36234: related Visualize variant/registration report. #35211 and #38736 concern renderer-path and icon-network problems, not this shell-startup failure.
If this belongs under an existing issue, please link or merge it there; the new evidence is the repeatable Mac-sender/server-sender root transition.
An isolated test on the affected VPS with system Bubblewrap 0.11.1 reproduced the exact .git: Read-only file system error.
| Test | Result |
|---|---|
Home writable, .codex read-only |
Probe started |
| Nested metadata masks before nested writable bind | Exact reported error; probe did not start |
| Nested writable bind before its metadata masks | Probe started; output writable; ancestor and .git, .agents, .codex writes denied |
The test used temporary directories. Cleanup passed. It did not modify the running Codex sessions.
The likely cause is mount ordering. In rust-v0.153.4:
- permissions.rs:1530–1586 collects nested read-only paths into the broader writable root.
- bwrap.rs:542–610 processes roots shallowest first and applies each root's protections before binding the next root writable.
- bwrap.rs:1058–1104 uses tmpfs masks for missing metadata paths. Bubblewrap:1464–1474 tries to create the destination before mounting, which fails beneath the already read-only ancestor.
Moving the nested writable bind before its metadata masks resolved the isolated failure while retaining the tested protections. The existing nested-write test does not include a missing protected child inside the nested writable directory.
Both detected app-server candidates pointed to the 0.153.4-x86_64-unknown-linux-musl release executable, SHA-256 56ef98ab4032d317ab26e9b5e5a175650717351edb16ed9cde0cb6d1734d62da.
This experiment used reconstructed arguments and system Bubblewrap. The actual failing Codex arguments and binary-to-source mapping remain unverified; no Codex patch has been tested.
Confirming this on iOS Remote Control (not just Mac/SSH), and capturing the Bubblewrap arguments the report notes were still uncaptured.
Environment: Codex 0.154.0 (managed standalone install), Ubuntu 24.04, kernel 7.0.0-30-generic, system bubblewrap 0.9.0, sandbox_mode = "workspace-write", approval_policy = "on-request". Workspace is the user's home directory. Failure is independent of cwd — it reproduces with cwd /tmp as well.
Captured arguments
Obtained by straceing the app-server daemon (strace -f -e trace=execve -s 8192) while sending one pwd turn from the iOS app. Paths sanitized; payload and env snapshot trimmed.
--as-pid-1 --new-session --die-with-parent
--ro-bind / /
--dev /dev
--bind /tmp /tmp <-- bind FIRST
--perms 555 --tmpfs /tmp/.git
--remount-ro /tmp/.git
--perms 555 --tmpfs /tmp/.agents
--remount-ro /tmp/.agents
--perms 555 --tmpfs /tmp/.codex
--remount-ro /tmp/.codex
--ro-bind /tmp/codex-bwrap-synthetic-mount-targets-UID /tmp/codex-bwrap-synthetic-mount-targets-UID
--bind /home/USER /home/USER <-- bind FIRST
--perms 555 --tmpfs /home/USER/.git
--remount-ro /home/USER/.git
--perms 555 --tmpfs /home/USER/.agents
--remount-ro /home/USER/.agents
--ro-bind /home/USER/.codex /home/USER/.codex <-- CODEX_HOME read-only
--perms 555 --tmpfs /home/USER/.codex/visualizations/YYYY/MM/DD/THREAD_ID/.git <-- FAILS HERE
--remount-ro .../THREAD_ID/.git
--perms 555 --tmpfs .../THREAD_ID/.agents
--remount-ro .../THREAD_ID/.agents
--perms 555 --tmpfs .../THREAD_ID/.codex
--remount-ro .../THREAD_ID/.codex
--bind .../THREAD_ID .../THREAD_ID <-- writable bind, too late
--perms 555 --tmpfs .../THREAD_ID/.git <-- masks emitted a SECOND time
--remount-ro .../THREAD_ID/.git
--perms 555 --tmpfs .../THREAD_ID/.agents
--remount-ro .../THREAD_ID/.agents
--perms 555 --tmpfs .../THREAD_ID/.codex
--remount-ro .../THREAD_ID/.codex
--unshare-user --unshare-pid --unshare-ipc --unshare-net
--proc /proc --cap-drop ALL
This confirms the inferred cause directly. For /tmp and for the workspace root, --bind precedes the .git/.agents/.codex masks. For the visualization root the order is inverted, and because that path is nested under the read-only CODEX_HOME bind, bwrap cannot create the mount target:
bwrap: Can't mkdir /home/USER/.codex/visualizations/YYYY/MM/DD/THREAD_ID/.git: Read-only file system
One detail visible only in the capture: the three masks are emitted twice — once before the --bind and once after. The second set is correctly ordered. Only the first set is fatal, which suggests the masks are applied both when collecting nested read-only paths into the parent root and again when the nested root is processed on its own.
Minimal reproduction, no Codex involved
Replaying the mount arguments with /bin/true as the payload:
S=/home/USER/.codex/visualizations/YYYY/MM/DD/THREAD_ID
mkdir -p "$S"
/usr/bin/bwrap --as-pid-1 --new-session --die-with-parent \
--ro-bind / / --dev /dev --bind /tmp /tmp \
--bind /home/USER /home/USER \
--ro-bind /home/USER/.codex /home/USER/.codex \
--perms 555 --tmpfs "$S/.git" --remount-ro "$S/.git" \
--bind "$S" "$S" \
--unshare-user --unshare-pid --unshare-ipc --unshare-net \
--proc /proc --cap-drop ALL \
-- /bin/true
Fails with the exact error. Moving --bind "$S" "$S" above the --tmpfs line makes it succeed.
Workaround that holds
Creating the three metadata directories before the sandbox starts is sufficient — bwrap only needs to create a missing mount target, and mounts over an existing directory happily:
mkdir -p "$S/.git" "$S/.agents" "$S/.codex"
Verified against the replay above: fails without them, succeeds with them, and the tmpfs masks still apply (writes to .git/.agents/.codex are denied, the thread directory stays writable, and the CODEX_HOME ancestor stays read-only). Because the roots are per-thread rather than per-turn, seeding a thread once keeps it working.
Ruled out
For anyone else hitting this, none of these help:
visualizations_dirpointing outsideCODEX_HOME— not honored on the app-server path.sandbox_workspace_write.writable_rootsincluding the visualizations tree — moves the failing path up one level, still EROFS. It also breakscodex exec, which otherwise works.- Symlinking
CODEX_HOME/visualizationselsewhere — bwrap refuses to traverse symlinks when creating mount points (Can't mkdir parents ... No such file or directory). - AppArmor /
kernel.apparmor_restrict_unprivileged_userns. That is a separate issue on Ubuntu 24.04; once resolved, the bwrap capability probe succeeds and this ordering bug is what remains.
will fix
Additional reproduction: mobile-to-Linux worktree creation (Codex 0.157.0)
Thanks for taking this on. Adding another affected flow for regression coverage: mobile Remote worktree creation on Codex 0.157.0. It fails during Preparing workspace, before checkout:
bwrap: Can't mkdir /home/USER/.codex/worktrees/.git: Read-only file system
The running remote app-server executable is Codex CLI 0.157.0 on Linux x86_64. Global configuration specifies sandbox_mode = "danger-full-access", but the actual creation helper launches with an explicit managed/restricted permission profile and the shell label codex-workspace-write.
An execve trace of that actual mobile-triggered attempt shows:
- Write entries for
/home/USER,/home/USER/repos/PROJECT, the repository Git directory, and/home/USER/.codex/worktrees. - Read protection for
/home/USER/.codex. - The following relevant ordering in the generated Bubblewrap argv (unrelated arguments omitted):
--bind /home/USER /home/USER
--ro-bind /home/USER/.codex /home/USER/.codex
--perms 555 --tmpfs /home/USER/.codex/worktrees/.git
--remount-ro /home/USER/.codex/worktrees/.git
...
--bind /home/USER/.codex/worktrees /home/USER/.codex/worktrees
The metadata mount target is missing. Its creation is attempted beneath the already-read-only ancestor before the writable child bind. This explains the observed startup failure. The trace captures the resolved launch profile, not the original mobile RPC payload.
Minimal app-server reproduction
After initializing a standalone codex app-server --stdio connection, send command/exec with this request (replace paths with existing directories):
{
"id": 2,
"method": "command/exec",
"params": {
"command": ["/usr/bin/true"],
"cwd": "/home/USER/repos/PROJECT",
"sandboxPolicy": {
"type": "workspaceWrite",
"writableRoots": ["/home/USER/.codex/worktrees"]
},
"timeoutMs": 10000
}
}
This reproduced the exact error without running Git or modifying the existing repository.
Controls
- Temporary worktree creation without sandboxing: succeeds on the same disk and across disks, in both directions.
- Full-access app-server worktree creation: succeeds.
- Workspace-write sandbox with a temporary root directly under the home directory: succeeds.
- Temporary root under
.codexor.codex/worktrees: fails even with/usr/bin/true. - Temporary root outside
.codexon the other disk: succeeds. - Precreating an empty
.gitin a disposable test root only moves the failure to.agents.
All temporary repositories and directories were removed. No commits were created and no real repository configuration was changed.
The same regression coverage should include worktree creation under CODEX_HOME/worktrees, in addition to visualization roots. No Codex patch has been implemented or validated in this reproduction.
Another trigger path: Windows Codex Desktop → the new WSL: Ubuntu remote connection (no Mac/iOS involved).
- Windows primary runtime
26.1123.915.0, WSL2 Ubuntu 22.04,codex-cli 0.148.0in WSL, system bwrap0.6.1 - Project root
/home/USER,workspace-write,on-request - The desktop app adds
/home/USER/.codex/visualizations/YYYY/MM/DD/THREAD_IDas a writable root on every new thread, so the first command already fails:
bwrap: Can't mkdir /home/USER/.codex/visualizations/YYYY/MM/DD/THREAD_ID/.git: Read-only file system
A second WSL project rooted under /mnt/c/... (not containing CODEX_HOME) works fine with the same settings.
This started after the automatic migration to WSL remote connections (#62735): before the migration, CODEX_HOME was the Windows .codex through /mnt/c, outside the $HOME workspace, so the visualization root never landed under the read-only .codex mask. Now that WSL projects use a Linux-side ~/.codex, any desktop user with a WSL project rooted at $HOME will hit this.
I've been running into this bug myself, and spent some time digging through my installed skills and plugins and instructions only to realize it's a bug in Codex itself.
The switch happens only after the initial message. Start a new session from MacOS on a remote host with "Hello, World!", then ask "What is your current project root? What is your project writable directory?".
As workarounds Astra recommend restricting permissions for ~/.codex/visualizations via chmod 000 ~/.codex/visualizations (which I do not like), or using default :workspace profile.
Output from Astra:
The Mac desktop app recently started dropping the project root on ai-desktop during follow-up turns. I reproduced the failure with your networked-workspace permission profile and tested a change to the desktop client. The earliest build I verified failing on your machine was 26.1117.41037. I couldn’t identify the commit that introduced the regression.
Release timeline
| Date | Mac desktop build | What ai-desktop recorded |
|---|---|---|
| Nov 21, 2026 | 26.1111.71704 |
SwarmUI-VideoStages and the visualization directory were both writable on the first two turns. |
| Nov 23, 2026 | 26.1117.41037 |
One SwarmUI chat lost its project root on turn two. Another chat on the same build retained it. |
| Nov 25, 2026 | 26.1120.41243 |
The greeting chat lost SwarmUI-VideoStages on turn two. The Mac sent exactly one runtime workspace root, the visualization directory. |
All three cases used remote Codex 0.167.0 and the same named permission profile. A September report already documented Mac-over-SSH turns adding a visualization directory alongside the project. The November regression is the loss of the project root. Earlier SSH issue #43516
Source and commit history
The installed app’s build manifest identifies the desktop source directory as minirepo/codex/codex-apps/electron. I couldn’t find that source in the public openai/codex tree at the matching server tag. Public repository at rust-v0.167.0
The relevant public commit, 8a5306ff88, merged May 15 and introduced the runtimeWorkspaceRoots API. The Rust server treats an explicitly supplied list as a complete replacement. When the Mac sends only the visualization directory, the server drops the project root. The commit explains the server behavior. The November desktop change remains unidentified. Public commit · Server implementation at 0.167.0
Cause and tested fix
Before adding the visualization directory to a follow-up turn, the desktop client can read the current environment’s workspace roots. A condition skips that lookup for a custom profile such as networked-workspace, even though the profile extends :workspace. If the client’s cached root list is empty, the visualization directory becomes the entire outgoing list. I reproduced this using the request builder extracted from the installed app.
I changed one condition in a temporary copy so that custom profiles also use the existing root lookup when the client adds an optional writable directory. In tests, the patched builder:
- Preserved the project root when adding the visualization directory.
- Preserved both project roots in a multi-root workspace.
- Sent no root override when it couldn’t confirm the existing roots.
The tests used mocked server responses. I didn’t apply the patch to the installed app or change the ai-desktop configuration.
Workaround
The built-in :workspace profile is worth trying in a fresh remote chat. The unmodified desktop client preserved the project root with that profile in the same isolated test. A live remote chat still needs to confirm the result.
Switching to :workspace gives up the full network access and write access to ~/.cache/uv granted by networked-workspace. If you need those grants, I’d pursue the desktop client fix upstream and leave ~/.codex/visualizations at its original 0700 permissions.