Skip to content

Bug Report: Commands failed to run in sandbox in Codex CLI #4934

Closed

Description

@Icarus603

What version of Codex is running?

codex-cli 0.45.0

Which model were you using?

gpt-5-codex

What platform is your computer?

Darwin 24.6.0 arm64 arm

What steps can reproduce the bug?

This kind of errors occurred a lot: I asked codex to run "git add ." and it failed immediately and returned stuff like "failed in sandbox". But when I asked it to run it again and ask for my approval, it succeeded easily. Other kinds of commands failed like this too. Seems that Codex tends to run commands (bash/python etc.) in sandbox but not locally... Could you fix this and make it more robust?

What is the expected behavior?

The agent already lives in the terminal so it shouldn't be running things in sandbox. Codex CLI should just run the commands locally. (Donno if this is right...)

What do you see instead?

No response

Additional information

No response

Activity

  1. added
    bug
    on Oct 8, 2025
  2. dylan-hurd-oai commented on Oct 8, 2025

    @dylan-hurd-oai
    Contributor

    (Note: this comment was generated by Codex.)

    Thank you for reporting this! This appears to be a duplicate of #4928. We’ll track the issue there to keep discussion in one place. If you think this is an incorrect diagnosis, please reply here and we’ll revisit.

  3. ahernandezmiro commented on May 18, 2026

    @ahernandezmiro

    this is still happening to me on latest codex versions

  4. ffxsam commented on May 19, 2026

    @ffxsam

    This is incredibly annoying. pnpm type-check always hangs, and winds up creating a new .pnpm-store/ folder in my project folder due to pnpm running in some sort of sandbox.

  5. fblgit commented on May 21, 2026

    @fblgit

    when i git commit in another terminal, the codex sandbox stops working, the model goes for dirty-perl|python inline cmd edits instead of apply_patch due to sandbox failure: it doesnt recover.

  6. ffxsam commented on May 21, 2026

    @ffxsam

    Solution/workaround found. Create ~/.codex/rules/pnpm.rules and paste this into it:

    prefix_rule(
      pattern = ["pnpm"],
      decision = "allow",
      justification = "Allow all pnpm commands"
    )
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions