The Codex Sandbox Network Block: How To Deploy Anyway

Why Codex says it can't reach the internet when you ask it to deploy, what the Codex sandbox network setting does, the macOS catch, and the safer one-step fix.
The OxyPages Team · · 8 min read
You asked Codex to put the site online. It ran the build, zipped the folder, tried to send it, and then told you something like "network access is restricted in this environment" or simply sat there until the request timed out.
The build worked. The upload didn't. That split is the clue.
Codex runs your commands inside a sandbox, and by default the sandbox has no internet. Anything that stays on your machine works fine. Anything that has to reach a server, like installing packages or sending a build to a host, hits the wall. So the deploy failed because of the Codex sandbox network setting. Your host and your code are probably fine.
There are three ways through it, and the one most guides lead with is the one I'd use last. This post walks through all three, the macOS issue that can make the obvious fix do nothing, and the one line you can add to your project's AGENTS.md file so Codex asks instead of giving up.
TL;DR: Codex on your own machine (the CLI, the desktop app and the IDE extension) runs commands in a workspace-write sandbox with network access turned off by default, according to OpenAI's Codex docs. Building usually works offline; deploying never does. The safest fix is to approve the single deploy command when Codex asks, which its default Auto setup does for commands that need the network. The broader fix is network_access = true under [sandbox_workspace_write] in config.toml, but an open GitHub issue reports that setting is ignored on macOS. Avoid full access mode just to send one file.
Why Does The Codex Sandbox Network Block Your Deploy?
Because the sandbox ships with networking switched off. OpenAI's Codex docs say it plainly: "By default, the agent runs with network access turned off," and the default workspace-write mode "keeps network access turned off unless you enable it in your configuration."
OpenAI's Codex docs on approvals, sandboxing and network access
That's a reasonable default. An agent that can run any command and reach any server can also send your files somewhere you didn't intend. Keeping it offline means the worst a confused agent can do is break things on your own disk.
The cost is that deploying is, by definition, sending files to a server. So it's the one step that can never work in the default sandbox.
This post is about Codex running on your computer. Codex in the cloud uses its own environment settings, which I haven't covered here.
Which Steps Need The Network?
Only the steps that talk to another computer. Here's how a typical deploy breaks down:
| Step | Needs the network? | What happens in the default sandbox |
|---|---|---|
npm install | Yes, it downloads packages | Fails or asks for approval |
npm run build | Usually no | Works, unless the build fetches fonts or data from the web |
| Zipping the output folder | No | Works |
Sending the build to a host (curl, a host's CLI) | Yes | Fails or asks for approval |
git push to trigger a host's build | Yes | Fails or asks for approval |
| Opening the live link to check it | Yes | Fails, so check it in your own browser |
That table also explains the most confusing version of the problem. If you installed packages yourself earlier, everything Codex does looks fine right up to the last step. Nothing is wrong with the deploy. It's simply the first step that needed the outside world.
Three Ways To Let The Deploy Through

You can approve one command, turn the network on for the whole sandbox, or switch the sandbox off. In order of how much I trust each one:
- Approve the single deploy command when Codex asks. Network for one command, once.
- Turn on network access for the
workspace-writesandbox inconfig.toml. Network for every command, every session. - Run in full access mode. No sandbox at all. Don't, for this.
Option 1: Approve The One Command
This is my pick. In Codex's default Auto setup, the docs say it asks for approval before running commands that need network access. You see the exact command, you say yes, and only that command gets out.
For a deploy, that command is short and readable. You can check where it's sending your files before you approve it, which is the whole point.
Two things stop this from working. If your approval_policy is set to never, Codex won't ask; it just fails. Set it back to on-request. And if you're running Codex non-interactively, there's nobody there to approve, so use option 2 for that job only.
Codex also supports rules that allow a specific command prefix to run outside the sandbox, which saves you approving the same deploy every time. Its docs cover the syntax.
Option 2: Turn On Network In config.toml
This is the switch most guides give you. Add this to ~/.codex/config.toml:
sandbox_mode = "workspace-write"
[sandbox_workspace_write]
network_access = true
For one session only, pass it on the command line instead:
codex -c 'sandbox_workspace_write.network_access=true'
It works where it works, and it's convenient. The trade-off is that every command can now reach the internet, including install scripts inside packages you've never read. I'd use it for a session where you're installing and deploying a lot, then turn it off.
Option 3: Full Access Mode
Codex has a --sandbox danger-full-access mode and a --yolo flag that skips approvals too. The docs call the second one "not recommended", and I agree. It removes the file boundaries along with the network one, to fix a problem that only needed one command to go out.
The macOS Catch: When The Setting Is Ignored
On a Mac, option 2 may do nothing at all. An open issue on Codex's GitHub repository, number 10390, reports that network_access = true is "silently ignored" by the macOS sandbox, so outbound requests still time out.
It was first reported on 2 February 2026 and was still open when I checked on 8 November 2026, with other people reporting the same thing for package managers and build tools. No fix from the Codex team shows on the issue yet.
If you're on macOS and the setting doesn't seem to change anything, that's probably why. Don't spend an hour on your config. Use option 1, which doesn't depend on that setting. The workaround in the issue is full access mode plus an environment variable, which is option 3 with extra steps.
Check codex --version and the issue itself before you plan around any of this. Codex updates often, and this may be fixed by the time you read it.
Walkthrough: A Book Launch Page Built In Codex
Say Codex built you an Astro landing page for a book launch: a cover, a short blurb, a list of reading dates and a link to the publisher's shop. It's all static, so the build writes plain files to dist/.
Here's how the deploy should go with the default sandbox and option 1. I'm working from Codex's documented approval flow here; I haven't recorded this exact run myself.
- You ask: "Build this and deploy it."
- Codex runs
npm run build. It works offline and writesdist/. - Codex zips the contents of
dist/. Also offline, also fine. - Codex tries the deploy command, a single
curlthat sends the zip to your host. The sandbox blocks it. - Codex asks you to approve that command. You read the address it's sending to and approve it.
- The host replies with a live link. If it's a no-account deploy, you also get a claim link and an expiry time.
The same request works from any agent that can run a shell command. Some hosts take a zipped build with no account at all, and how no-account deploys and claim links work compares the ones that do. If step 6 gives you a link that's blank or broken, that's a different problem with a different fix: finding out why an AI-built site isn't working.
Tell Codex Ahead Of Time
You can save step 5 from being a surprise. Codex reads an AGENTS.md file at the root of your project, so add one line to its Deploying section: "The deploy command needs network access. If the sandbox blocks it, ask me to approve it." The AGENTS.md post linked at the top has the rest of the Deploying section, ready to paste.
What The Sandbox Isn't Stopping
Once the network is sorted, two failures still look like it but aren't.
The host refuses the upload. If the agent sends your project folder instead of the build output, a static host will turn it away. OxyPages, for example, never builds a no-account deploy and refuses source code with a needs_build error, telling the agent to run the build and send the output folder instead.
The app needs a server. If your project has api/ routes or renders pages on a server, sending its build to a static host gives you a site with missing parts. That needs a host that runs code, such as Vercel, Netlify or Cloudflare Workers.
What To Do Next
Next time Codex says it can't reach the internet during a deploy, don't touch the config first. Check that your approval policy is on-request, ask Codex to run the deploy again, and approve that one command when it asks.
If you deploy often and you're not on a Mac, turn on network_access for the sessions where you need it. Add the approval line to your AGENTS.md so the next session doesn't trip over the same step.
To try it with a host that needs no account, send your build and get a live link plus a claim link.
FAQ
Is Network Access Off By Default In Codex?
Yes, for Codex on your own computer. The default workspace-write sandbox keeps network access off unless you turn it on in config.toml. In the default Auto setup, Codex asks for approval before running a command that needs the network.
How Do I Enable Network Access In The Codex CLI?
Add network_access = true under a [sandbox_workspace_write] heading in ~/.codex/config.toml, or pass -c 'sandbox_workspace_write.network_access=true' for a single session. On macOS, an open GitHub issue reports the setting is ignored, so approving the command may be the only route that works.
Is It Safe To Turn On The Codex Sandbox Network Setting?
It's safe enough for a session you're watching, but it lets every command reach the internet, not just your deploy. Approving the one deploy command keeps the rest of the sandbox offline, which is why I prefer it.
Why Does npm install Fail In Codex When The Build Works?
Because installing downloads packages, and building usually doesn't. With network access off, anything that has to fetch from the internet fails or waits for your approval, while steps that only read your own files carry on as normal.