Skip to content

Forced tool approval on rm command causes codex exec --dangerously-bypass-approvals-and-sandbox to stall forever #4565

Closed

Description

@dimfeld

What version of Codex is running?

codex-cli 0.42.0

Which model were you using?

gpt5-codex high

What platform is your computer?

Darwin 25.0.0 arm64 arm

What steps can reproduce the bug?

codex exec --json --dangerously-bypass-approvals-and-sandbox "remove README.md"

I then see the JSON output below and it hangs forever. Note that it also hangs without the --json flag, just you have less visibility that way.

What is the expected behavior?

Ideally tool calls are allowed, even the "dangerous" ones, when I use the "dangerous" flag. At least, it doesn't hang forever.

What do you see instead?

{"model":"gpt-5-codex","reasoning effort":"none","approval":"never","workdir":"/Users/dimfeld/Documents/cc/code","provider":"openai","sandbox":"danger-full-access","reasoning summaries":"auto"}
{"prompt":"remove README.md"}
{"id":"0","msg":{"type":"task_started","model_context_window":272000}}
{"id":"0","msg":{"type":"token_count","info":null,"rate_limits":{"primary":{"used_percent":1.0,"window_minutes":299,"resets_in_seconds":17719},"secondary":{"used_percent":3.0,"window_minutes":10079,"resets_in_seconds":562632}}}}
{"id":"0","msg":{"type":"agent_reasoning_section_break"}}
{"id":"0","msg":{"type":"agent_reasoning","text":"**Removing README.md file**"}}
{"id":"0","msg":{"type":"exec_approval_request","call_id":"call_xUmcDRt5Tpmm6hsvbAkJZcor","command":["bash","-lc","rm -f README.md"],"cwd":"/Users/dimfeld/Documents/cc/code"}}

And then it waits forever and you have to ctrl-c.

Additional information

No response

Activity

  1. added
    bug
    on Oct 1, 2025
  2. dimfeld commented on Oct 3, 2025

    @dimfeld
    Author

    Yeah, dupe of #4351

  3. added
    sandbox
    exec
    on Nov 14, 2025
  4. etraut-openai commented on Jan 10, 2026

    @etraut-openai
    Contributor

    Closing old issue.

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

    bugexecsandbox

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions