Allow gradle to run in sandbox

Resolved 💬 4 comments Opened Oct 15, 2025 by esafak Closed Apr 23, 2026
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

What version of Codex is running?

codex-cli 0.46.0

What subscription do you have?

Plus

Which model were you using?

gpt-5-codex

What platform is your computer?

Darwin 24.6.0 arm64 arm

What issue are you seeing?

codex does not want to use gradle due to its sandbox.

What steps can reproduce the bug?

Ask codex to use gradle

What is the expected behavior?

_No response_

Additional information

_No response_

View original on GitHub ↗

4 Comments

github-actions[bot] contributor · 10 months ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #5178

Powered by Codex Action

IRus · 9 months ago

I've added this into ~/.codex/config.toml to solve this issue:

sandbox_mode = "workspace-write"

[sandbox_workspace_write]
network_access = true
writable_roots = ["/Users/user/.gradle"]

Seems it's working for me

wcarmon · 7 months ago

You are my hero @IRus 🙏

on Linux, with gradle installed via sdkman, this worked: (small modification in writable_roots)

sandbox_mode = "workspace-write"

[sandbox_workspace_write]
network_access = true
writable_roots = [
  "/tmp/gradle-user-home",
  "/home/<my-user-name>/.gradle"
]
Glavo · 4 months ago

One solution is to require Codex to specify GRADLE_USER_HOME when executing Gradle in AGENTS.md:

## Gradle

- When invoking Gradle in this repository, always set `GRADLE_USER_HOME` to the workspace-local `.gradle-user-home` directory.
- Prefer commands such as `./gradlew -g .gradle-user-home ...` or the equivalent environment-variable-based configuration.