Codex hanging waiting for background script to finish executing (even though it seems to have)
Open 💬 6 comments Opened Mar 11, 2026 by 0xdevalias
💡 Likely answer: A maintainer (github-actions[bot], contributor)
responded on this thread — see the highlighted reply below.
What version of Codex CLI is running?
codex-cli 0.114.0
What subscription do you have?
ChatGPT Plus
Which model were you using?
gpt-5.4 high
What platform is your computer?
Darwin 23.6.0 x86_64 i386
What terminal emulator and version are you using (if applicable)?
iTerm2
What issue are you seeing?
While renaming some files, codex seemed to get stuck waiting for the rename script to finish. When I told it in a steer that the file seemed to be renamed, it seemed to keep hanging on processing that message rather than responding as well. Eventually I cancelled it and submitted this feedback:
• I am renaming the REDACTED lesson videos and guide PDFs in the unit lesson folders to the numbered archive pattern, preserving the [REDACTED-<id>] suffix on videos. After that I will verify the new names across the units.
• Ran while IFS= read -r -d '' target_file; do target_dir=$(dirname "$target_file"); base_name=$(basename "$target_file"); case "$base_name" in 'REDACTED Lesson '*'.mp4') lesson_num=$(printf '%s' "$base_name" | perl -ne 'print $1 if /
│ ^ REDACTED Lesson ([0-9]+) \[REDACTED-([0-9]+)\]\.mp4$/'); REDACTED_id=$(printf '%s' "$base_name" | perl -ne 'print $2 if /^REDACTED Lesson ([0-9]+) \[REDACTED-([0-9]+)\]\.mp4$/'); new_base="REDACTED - Lesson $lesson_num - 1 -
│ Lesson [REDACTED-$REDACTED_id].mp4" ;; 'Lesson '*'.pdf') lesson_num=$(printf '%s' "$base_name" | perl -ne 'print $1 if /^Lesson ([0-9]+) - .*\.pdf$/'); new_base="REDACTED - Lesson $lesson_num - 2 - Lesson Guide.pdf" ;; *)
│ … +2 lines
└ perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
… +676 lines
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
• The bulk rename is still just emitting locale warnings, not file errors. I am polling for completion and then I will verify the renamed REDACTED files across the unit folders.
• Model interrupted to submit steer instructions.
› It might be worth doing a file listing or similar, as I think a bunch of them (if not all) may have been renamed already
■ Conversation interrupted - tell the model what to do differently. Something went wrong? Hit `/feedback` to report the issue.
• Feedback uploaded. Please open an issue using the following URL:
https://github.com/openai/codex/issues/new?template=3-cli.yml&steps=Uploaded%20thread:%20019cd102-1737-7bf3-8737-78ec821482c6
Or mention your thread ID 019cd102-1737-7bf3-8737-78ec821482c6 in an existing issue.
What steps can reproduce the bug?
Uploaded thread: 019cd102-1737-7bf3-8737-78ec821482c6
What is the expected behavior?
The session to not hang while running the script / attempting to provide followup instructions.
Additional information
N/A
6 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
I am experiencing the exact same issue on Debian with Terminator.
In my case, the agent ran a background command (cargo clippy --manifest-path src-tauri/Cargo.toml --all-targets -- -D warnings). The command finished execution and printed a compilation error to the terminal. However, the agent failed to detect the completion and got stuck in an infinite loop, continuously logging Waited for background terminal. I had to manually interrupt the conversation.
Uploaded thread: 019cd87a-6be6-7662-8cec-0dfd3a6b6ee3
+
I have the same problem
Same issue, very annoying! Basically makes the agent not autonomous even though it suggests it's "watching". I have to babysit it all the time for sessions that are heavy on long compile time or test suite calls. There doesn't seem to be a way to make the call on the foreground anymore (thus blocking the agent, which automatically means it will act on it later). Seems to be a general issue either with GPT 5.4 and or the latest versions of Codex. I don't remember having this issue a few weeks ago with GPT 5.3 Codex.
Thread ID with additional feedback:
019cb669-5422-7ca0-b7bb-0229699c49bf.Up
[ItemParam] [input[659]] [invalid_enum_value] Invalid value: 'context_compaction'. Supported values are: 'additional_tools', 'apply_patch_call', 'apply_patch_call_output', 'code_interpreter_call', 'compaction', 'compaction_trigger', 'computer_call', 'computer_call_output', 'custom_tool_call', 'custom_tool_call_output', 'file_search_call', 'function_call', 'function_call_output', 'image_generation_call', 'item_reference', 'local_shell_call', 'local_shell_call_output', 'mcp_approval_request', 'mcp_approval_response', 'mcp_call', 'mcp_list_tools', 'message', 'reasoning', 'shell_call', 'shell_call_output', 'tool_search_call', 'tool_search_output', and 'web_search_call'.