Build Mobile Apps using Codex/Codex and mobile foundations
Lesson 4 / 7 · 20 min · 0 / 5 exercises
Course contents
Concept · 5 hands-on exercises

Sandbox and approvals, and how Claude Code differs

Pick a permission mode on purpose: what the sandbox lets commands touch, when Codex stops to ask, and how that compares with Claude Code's approach.

Every coding agent has to answer one question many times a minute: is this action fine, or should a human decide? Codex answers it with two separate controls that work together. Understanding them is what lets you hand over a long task without either babysitting it or regretting it.

Control 1: the sandbox

The sandbox is enforced by your operating system, not by the model's good intentions. It decides which files commands can read or write and whether they can reach the network.

Sandbox modeWhat commands can do
read-onlyInspect files. Editing files or running commands needs your approval.
workspace-writeRead files, edit inside the workspace, and run routine local commands there. Network access and writes outside the workspace need approval. This is the default low-friction mode for local work.
danger-full-accessNo sandbox: no filesystem or network boundary at all.

Control 2: the approval policy

The approval policy decides what happens when Codex wants to go past the sandbox boundary. With on-request, it works freely inside the boundary and asks when it needs to cross it. With never, it never stops to ask; anything the sandbox blocks fails and the error goes back to the model. A third setting, approvals_reviewer, decides who answers the request: you (user, the default) or a reviewer agent (auto_review). The older untrusted policy is retired, and so is the --full-auto flag you'll still see in old tutorials.

The ChatGPT desktop app and the IDE extension wrap these into named modes under the composer. OpenAI's advice is to start most work in Ask for approval.

ModeSandbox + approvalsIn practice
Ask for approvalworkspace-write + on-request, you reviewWorks in the project, asks before editing outside it or using the internet
Approve for meworkspace-write + on-request, auto_reviewSame boundary; a reviewer agent handles requests and only escalates ones it judges potentially unsafe
Full accessdanger-full-access + neverUnrestricted access to the internet and any file on your computer
Custom (config.toml)Whatever your config or permission profile saysFor teams with their own profiles
Explore: What runs, what asks, in each Codex modeExercise 1 of 5
Mode

--sandbox read-only: Codex can look, and asks before editing files or running commands.

  • Read src/app/index.tsxRuns on its own
  • Edit src/app/index.tsxAsks you first
  • Run npx tsc --noEmit in the projectAsks you first
  • Run npx expo install expo-haptics (needs the network)Asks you first
  • Run git push --force origin mainAsks you first
1run on their own
4need your approval
0blocked

Illustrative. Under Approve for me, what counts as potentially unsafe is the reviewer's call, so treat the last row as the cautious case.

Move the controls and watch what changes.

Quick checkExercise 2 of 5

Compare Ask for approval with Approve for me in the explorer. What actually changes between them?

Mobile work crosses the boundary often

Expo projects hit the edge of the sandbox more than a typical web app. npx expo install and pod install download packages, eas build uploads your project to Expo's servers, and git push talks to GitHub. You have better tools than jumping to Full access when the prompts get repetitive:

  • Rules allow, prompt or forbid specific command prefixes outside the sandbox. Allowing npx expo install removes one repetitive prompt and keeps every other check.
  • Writable roots extend where Codex may write without removing the sandbox. codex --add-dir ../packages/ui lets it edit a sibling package in a monorepo.
  • Profiles keep a stricter or looser setup ready for specific jobs: codex --profile review loads ~/.codex/review.config.toml on top of your user config.
Fill the blanksExercise 3 of 5

Start a planning session on GPT-6.1 Sol that can read Tipjar but not change it, and that still asks before stepping outside the sandbox.

codex --model --sandbox --ask-for-approval
You make the callExercise 4 of 5

Release-week permissions

Tipjar ships to TestFlight on Friday. You're in Ask for approval mode and Codex is wiring up haptics, push and a paywall.

  1. Codex has asked six times in ten minutes to run npx expo install …. You're getting fatigued and starting to approve without reading.

How Claude Code differs

Course 1 taught Claude Code, which leans on per-tool permission rules that you grow over time: allow this command, ask about that one, deny another. Codex leads with an operating-system sandbox and a session-wide approval policy, then lets you carve out exceptions with rules. Both tools now offer some of each idea, so the difference is emphasis, not capability. Claude Code's habit is fine-grained permissions on a trusted machine; Codex's habit is a boundary you choose before the work starts.

If you're coming from Claude Code, Codex 0.167.2 has an /import command that brings over your setup, the current project and recent chats from Claude Code. Your CLAUDE.md conventions are worth carrying into AGENTS.md either way, since AGENTS.md is the file every surface of Codex reads.

Match them upExercise 5 of 5

Match each Tipjar job to the setting that fits it.

Pick one on the left, then its partner on the right.

The job
Setting
0 of 5 matched
Check your understanding
Q1. Approve for me is on, and Codex wants to run a command that needs the network. What happens?
Q2. Which pair of settings makes up OpenAI's “Full access” mode?
Q3. Why is a rule that allows the npx expo install prefix better than switching to Full access to stop repeated prompts?
· Work through the 5 remaining exercises above (stuck? each one can show you the answer).
· Score 100% on the quiz.
Vocabulary in this lesson

Plain-English definitions from the AI Coding Dictionary.