--add-dir does not grant write access on Ubuntu (workspace-write); writable_roots works
What version of Codex CLI is running?
codex-cli 0.117.0 and codex-cli 0.121.0
What subscription do you have?
Plus
Which model were you using?
gpt-5.4-mini (low)
What platform is your computer?
Linux 6.8.0-107-generic x86_64 x86_64
What terminal emulator and version are you using (if applicable)?
VSCode
What issue are you seeing?
--add-dir does not grant write access to the specified directory when using -s workspace-write.
Even though the directory is writable at the OS level, Codex cannot write to it.
However, configuring the same path via writable_roots in config.toml works as expected.
This suggests that --add-dir is not correctly applied to sandbox writable roots.
What steps can reproduce the bug?
- Ensure the directory is writable:
ls -ld /home/ibis/AI/CodexSkill
test -w /home/ibis/AI/CodexSkill && echo WRITABLE
- Start Codex with:
codex --add-dir /home/ibis/AI/CodexSkill -s workspace-write
- Ask Codex to create a file in that directory
Result:
- Write fails with sandbox permission error
- Writing to
/tmpsucceeds
- Add the same path to config:
[sandbox_workspace_write]
writable_roots = ["/home/ibis/AI/CodexSkill"]
- Restart Codex and repeat
Result:
- Writing succeeds
What is the expected behavior?
--add-dir should behave equivalently to adding the path to writable_roots,
and allow write access to the specified directory.
What is the actual behavior?
--add-dir does not grant write access, even though:
- The directory is writable at OS level
- The same path works via
writable_roots
Additional information
- The issue is not related to filesystem permissions (verified with
test -w) - The issue is not resolved by
--enable use_legacy_landlock /tmpremains writable in the same session- This appears to be a CLI-level issue where
--add-diris not properly propagated to sandbox configuration
3 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
I'm not able to repro. See https://github.com/openai/codex/pull/18459.
I found this issue while having the same problem on MacOS (Darwin, arm64) using the TypeScript SDK (
@openai/codex-sdk@0.130.0).Scenario: We run Codex inside git worktrees. The working directory is a worktree at e.g.
/Users/joe/.cate/worktrees/project/agent-abc, whose.gitfile points to the main repo's git dir at/Users/joe/dev/scratch/project/.git/worktrees/agent-abc. Git needs write access to the main.gitdirectory (specifically to createindex.lockunder.git/worktrees/<name>/) in order to commit.What we tried:
The SDK correctly translates
additionalDirectoriesinto--add-dirflags. We confirmed the CLI receives:Result: git commit fails inside the sandbox:
Switching
sandboxModetodanger-full-accessmakes the same commit succeed, confirming--add-dirisn't actually granting write access.What works (workaround):
Passing the same directory via
config→sandbox_workspace_write.writable_rootsinstead:This serializes to
--config sandbox_workspace_write.writable_roots=["/Users/joe/dev/scratch/project/.git"]and git commit succeeds inside the sandbox.