Skip to content

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

@dimfeld

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingexecIssues related to the `codex exec` subcommandsandboxIssues related to permissions or sandboxing

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions