Repository navigation
Open
Labels
bugSomething isn't workingsandboxIssues related to permissions or sandboxingtool-callsIssues related to tool calling
Description
What version of Codex is running?
codex-cli 0.66.0
What subscription do you have?
PRO
Which model were you using?
gpt-5.1-codex-max
What platform is your computer?
Linux 6.8.0-87-generic x86_64
What issue are you seeing?
When using --full-auto or --sandbox workspace-write flags with codex exec, commands hang indefinitely even for simple operations that complete in milliseconds without these flags.
Test results:
| Command | Result | Time |
|---|---|---|
codex exec "echo test" |
✅ Works | ~2s |
codex exec --json "echo test" |
✅ Works | ~2s |
codex exec --full-auto "echo test" |
❌ HANGS | >2min |
codex exec --sandbox workspace-write "echo test" |
❌ HANGS | >2min |
Symptoms:
- Command output shows successful completion in JSONL log
- Codex never returns control to caller
- Child processes remain orphaned in
S(sleeping) state exit_code: null, status: "in_progress"persists indefinitely
Note: This is separate from issue #7846 (process substitution). This bug occurs with the --full-auto/--sandbox flags themselves, even with simple commands like echo.
What steps can reproduce the bug?
Minimal reproduction:
# Step 1: This WORKS (no sandbox flags)
timeout 30s codex exec --dangerously-bypass-approvals-and-sandbox \
"Run: echo 'hello world'"
# Result: Completes in ~2-5 seconds
# Step 2: This HANGS (with --full-auto)
timeout 30s codex exec --dangerously-bypass-approvals-and-sandbox \
--full-auto "Run: echo 'hello world'"
# Result: Times out after 30s
# Step 3: This also HANGS (with --sandbox workspace-write)
timeout 30s codex exec --dangerously-bypass-approvals-and-sandbox \
--sandbox workspace-write "Run: echo 'hello world'"
# Result: Times out after 30s
# Step 4: Check for orphaned processes after timeout
pgrep -af 'codex|echo' | grep -v pgrepFull reproduction script:
#!/usr/bin/env bash
set -euo pipefail
echo "=== Test 1: Without --full-auto ==="
time timeout 20s codex exec --dangerously-bypass-approvals-and-sandbox \
"Run: echo test" 2>&1 | tail -3
echo "=== Test 2: With --full-auto (will hang) ==="
time timeout 20s codex exec --dangerously-bypass-approvals-and-sandbox \
--full-auto "Run: echo test" 2>&1 | tail -3
echo "Exit code: $?"What is the expected behavior?
- Commands with
--full-autoshould complete in similar time as without the flag (~2-5s for simple commands) - All child processes should be terminated when Codex exits
- No orphaned processes should remain after command completion
exit_codeshould be set to actual return value (0 for success)
Additional information
Root cause analysis:
The issue appears to be in process group management when sandbox mode is active:
- Missing
setpgid(0, 0)- Child processes not placed in own process group - Signal propagation - Signals sent only to direct child PID, not entire group
- Grandchild orphaning - Sandbox intermediate processes create orphans
- Pipe deadlock - Codex waits for EOF on pipes kept open by orphans
Related issues:
- Process substitution causes indefinite hang - orphaned grandchild processes not terminated #7846 - Process substitution hang (different trigger, same root cause)
- Missing child.wait() after start_kill() creates zombie processes and prevents directory cleanup #4726 - Missing child.wait() (closed)
- Agent Lacks Asynchronous Process Management, Causing Instability and Workflow Failures with Long-Running Tasks #3836 - Async process management
Workaround:
Remove --full-auto flag. Use --json alone if JSON output needed.
Reacted by sky jiang
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingsandboxIssues related to permissions or sandboxingtool-callsIssues related to tool calling
Activity
github-actions commentedon Dec 11, 2025
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
sayan-oai commentedon Dec 11, 2025
Hey @ghul0, thanks for reporting. Like #7846, I wasn't able to repro with Ubuntu 22,
bash, and Codex v0.66.In fact, I don't believe
codex exec --dangerously-bypass-approvals-and-sandbox --full-auto "Run: echo 'hello world'"even runs; Codex errors if you try to run with both--dangerously-bypass-approvals-and-sandboxand--full-auto. Let me know if you're seeing otherwise.Would you mind sharing the
thread-idof a session where you see this issue? You can get thethread-idvia the/feedbackcommand in the CLI. Thanks.ghul0 commentedon Dec 11, 2025
Isolated a minimal, single-function test that reliably reproduces this issue. The root cause appears to be asyncio.to_thread()
failing to complete in the exec --full-auto sandbox environment.
Minimal Test Case
Reproduction Steps
codex exec --full-auto "Run: python -m pytest /tmp/test_asyncio_hang.py -v"
Result: Hangs indefinitely, killed by timeout after 2min (set by codex on bash tool execution) (exit code 124)
codex exec "Run: python -m pytest /tmp/test_asyncio_hang.py -v"
Result: Completes in ~2s
codex --full-auto
Then type: Run: python -m pytest /tmp/test_asyncio_hang.py -v
Result: Completes in ~2s
Test Matrix
Analysis
The issue is specific to the combination of exec subcommand + --full-auto flag.
asyncio.to_thread() internally uses concurrent.futures.ThreadPoolExecutor to spawn worker threads. In the exec --full-auto sandbox
environment, these threads appear to never complete — consistent with the process group and signal propagation issues described in
this thread.
Notably, the same --full-auto flag works correctly in interactive mode, suggesting the bug lies in how exec mode sets up or tears
down the sandbox process environment.
Environment
etraut-openai commentedon Jan 19, 2026
@ghul0, are you still able to repro this problem? If so, please use the
/feedbackslash command to upload your logs and post the thread ID here.docs: 票4 根因確認——codex 沙箱卡死=已知 upstream bug #7852(pipe deadlock)
LouRohanNV commentedon Aug 6, 2026