Interactive CLI hangs on multi-command / branching turns

Open 💬 3 comments Opened Apr 3, 2026 by zainepils
💡 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.118.0

What subscription do you have?

Plus

Which model were you using?

gpt-5.3-codex

What platform is your computer?

Darwin 25.2.0 arm64 arm

What terminal emulator and version are you using (if applicable)?

Terminal.app

What issue are you seeing?

Interactive Codex CLI hangs or becomes extremely slow on longer or more agentic turns. Small bounded tasks often work, but once a turn becomes multi-command, branching, retry-heavy, background-terminal heavy, or longer-lived, the interactive session often gets stuck on Working... or degrades into retries / waits / reconnect-like behavior.

This reproduces across multiple machines:

  • Ubuntu homelab server
  • macOS laptop
  • Windows 11 machine

At the same time, codex exec works reliably on the same environments, including command execution and summarization. This makes it look specific to the interactive CLI/TUI orchestration path rather than the underlying model/account or basic shell execution.

What steps can reproduce the bug?

  1. Start a fresh interactive Codex CLI session.
  1. Run a small bounded prompt like this:

Run exactly this command and nothing else:
pwd
Then reply only with the result.

This often works.

  1. Then run a more complex / broader prompt, for example:

Check whether the gateway daemon is running. If stopped, restart it. Inspect config. Check logs. If pairing is required, generate a new pairing code. After fixing, test by attempting to add a simple cron job.

  1. Observe behavior:
  • Codex runs some commands successfully
  • then expands scope, uses help commands, background waits, retries, or timeouts
  • then gets stuck on Working...

Another repro example is a simple local file task like:

find my ytwhisper app and replace the old one in Applications with this one

Instead of checking a few likely paths and finishing quickly, interactive Codex may do multiple redundant searches (find, rg, mdfind, background waits), take several minutes, and remain on Working...

Important comparison:

  • codex exec "reply only with hello" works
  • codex exec --dangerously-bypass-approvals-and-sandbox "run pwd and reply only with the result" works
  • codex exec --dangerously-bypass-approvals-and-sandbox with a real docker/log command plus summary also works

So the problem appears much more specific to interactive mode.

What is the expected behavior?

Interactive Codex should be able to perform multi-command, complex CLI workflows reliably.

Expected behavior:

  • complete bounded but non-trivial tasks in reasonable time
  • not get stuck indefinitely on Working... after commands have already succeeded
  • not enter retry / wait / background-terminal loops when a command fails or when partial output is available
  • behave consistently with the fact that the same work succeeds in codex exec

Additional information

Versions tested

  • Stable: codex-cli 0.118.0
  • Prerelease tested as well: 0.119.0-alpha.4

Updating to the prerelease did not resolve the issue.

Environments affected

  • Ubuntu homelab server
  • macOS laptop
  • Windows 11 machine

Because the issue reproduces across multiple OSes, it seems unlikely to be only a single-host problem.

Things already tried

  • upgraded from stable 0.118.0
  • tested prerelease 0.119.0-alpha.4
  • no meaningful improvement for the interactive hang issue

Ubuntu-specific environment fixes tried

These were real host issues, but did not fully solve the interactive instability:

  1. Cleared corrupted local Codex state after a disk-full incident (auth.json and models_cache.json became 0-byte files and caused parse errors like EOF while parsing a value at line 1 column 0)
  2. Freed disk space after root hit 100%
  3. Disabled IPv6, which improved some longer-lived tasks on Ubuntu
  4. Installed missing tools in a target container (ripgrep)
  5. Diagnosed bubblewrap / AppArmor sandbox issues on Ubuntu (bwrap: loopback: Failed RTM_NEWADDR: Operation not permitted and AppArmor denies for net_admin / setpcap)
  6. Bypassed sandbox with --dangerously-bypass-approvals-and-sandbox

Those Linux-specific issues do not explain why the same higher-level interactive symptom also appears on macOS.

Strong evidence this is interactive-mode specific

Works:
codex exec "reply only with hello"

Works:
codex exec --dangerously-bypass-approvals-and-sandbox "run pwd and reply only with the result"

Also works:

  • a real docker/log command with summary via codex exec --dangerously-bypass-approvals-and-sandbox

Fails / degrades:

  • interactive Codex on multi-command troubleshooting prompts
  • branching prompts
  • broader search / replacement tasks
  • turns involving retries, waits, background terminals, or timeout wrappers

Current workaround

Use:
codex exec --dangerously-bypass-approvals-and-sandbox "..."

This is workable, but it is not a replacement for the intended interactive agent workflow.

View original on GitHub ↗

3 Comments

github-actions[bot] contributor · 4 months ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #16649
  • #16168
  • #16166
  • #15454
  • #15990

Powered by Codex Action

etraut-openai contributor · 4 months ago

I'm not able to repro the problem as specified. You will likely need to do more analysis on your side if you're able to repro this consistently. You could clone this repo and ask Codex to help you diagnose the problem or identify additional clues.

It might also help if you used /feedback after a repro. Upload your logs and session details and include the thread ID here.

mahdikayvan · 3 months ago

@zainepils Hey — I saw your issue, and it looked very close to the exact pain I’m trying to solve.

I’m building AgaveCore, and I’d like to let a few early people use it for free while I shape it into something stronger.

AgaveCore helps when a coding agent starts to drift, forget important progress, or gives you an output you do not fully trust.

In practice, it works through two habits:

  • tell the agent to remember-progress or remember-this when something important should not be lost
  • use consult-brain when the current task needs more grounded feedback on what to do next

Over time, as useful journals, decisions, and failures pile up, the product should help the agent make sharper decisions and take better actions with less drift.

The point is simple: make the agent more reliable when the output actually matters.

It runs locally, keeps its own isolated memory, and the current pilot path does not require replacing your normal setup or depending on internal tmux/login machinery.

I’m keeping this very small for now. I only want a few people who already use coding agents in real work, especially in local/CLI workflows, and can tell me honestly where it helps and where it still falls short.

If you’re open to it, I’d really value having you in the first pilot wave.

The ask is small:

  1. install it once
  2. use remember-progress or remember-this during one real coding task
  3. use consult-brain on that same task when trust or direction matters
  4. file either feedback or a bug

If you help shape it early with real feedback, I plan to reward early contributors with extended access once the product is more polished.

If you want in, I’ll send the exact steps.

Cheers,
Mads.