TUI freezes during idle long wait while session continues and completes
What version of Codex CLI is running?
0.128.0
What subscription do you have?
Plus
Which model were you using?
_No response_
What platform is your computer?
Linux
What terminal emulator and version are you using (if applicable)?
alacritty
What issue are you seeing?
The Codex TUI can freeze during a long wait when there is no token streaming or assistant chatter.
The backend session continues running and can complete, but the visible TUI stops updating.
In my case, I intentionally prompted agents to avoid filler/status chatter during long waits. With that setup, the TUI animation stopped, but the task still completed in the background.
I had a local completion hook that sends a notification when the task finishes. That notification arrived even though the TUI was frozen. The old TUI process was still alive until manually killed:
PID 27495
~/.codex/bin/codex-0.128.0
state: Sl+
tty: pts/10
After completion, the session log contained task_complete, and the completion record had notified: true.
What steps can reproduce the bug?
- Start or resume a Codex CLI TUI session.
- Run a task that waits for a long time on background work.
- Prompt the agents not to emit periodic filler/status text while waiting.
- Leave TUI animations enabled so a frozen UI is visible.
- Wait through an idle period with little or no token streaming.
Observed result: the TUI can freeze while the backend session continues and eventually completes.
What is the expected behavior?
The TUI should remain responsive during long idle waits, or recover/repaint once backend events arrive. If the backend task completes, the TUI should visibly reflect completion without needing a second Codex session or manual process cleanup.
Additional information
Codex CLI helped identify a likely area to inspect: the TUI appears to rely on activity from streamed rollout/items or similar backend updates to keep the interface moving during long waits.
This issue was written with the assistance of Codex CLI.
5 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
If you're able to repro this, please
/feedbackand post session ID.109-tui-task-frame-heartbeat.patch
this codex-generated patch solves the issue I mentioned for me, which has not been encountered again in 0.128.0 or 0.129.0-alpha.3
I investigated the Windows PowerShell
Working...hang on currentmain.Environment
6d65686313 feat: make ToolExecutor an async trait (#22560)windows-pwsh-working-hang-fixcodex-cli 0.130.0codex-rs:cargo 1.93.0,rustc 1.93.0Summary
The original bounded-channel stdout-reader backpressure hypothesis no longer matches current
main: core session events use an unbounded channel, app-server-client treats command output deltas as best-effort, and rollout storage does not persistExecCommandOutputDelta.The most plausible remaining
Working...path is in the TUI active-thread routing queue. That queue made every active-thread notification effectively lossless by spawning a waiting send task when the per-thread channel was full. A largeCommandExecutionOutputDeltabacklog could therefore keepTurnCompletedbehind many best-effort output events, leaving the UI inWorking...until the backlog drained.Findings
codex-rs/core/src/exec.rs; unified exec reads process output into a broadcast/output buffer incodex-rs/core/src/unified_exec/process.rs.read_outputemitsExecCommandOutputDelta; unifiedasync_watcher.rsemits the same event after transcript append.TurnCompletedclears TUIWorking...throughChatWidget::handle_turn_completed_notification->on_task_complete/finalize_turn.codex-rs/app-server-client/src/lib.rsalready makesCommandExecutionOutputDeltabest-effort and preservesTurnCompleted,ItemCompleted, and transcript deltas.codex-rs/tui/src/app/thread_routing.rsdid not preserve that lossless/best-effort split for the active thread queue.%TEMP%\codex-pwsh-hang-reprowas read withGet-Content -Rawin about 36.5 ms; no direct PowerShell hang was observed.Local patch
I applied a small local patch:
codex-rs/tui/src/app/thread_routing.rs, active-thread queue overflow now drops known best-effort progress/output notifications instead of spawning waiting send tasks for them. This lets lossless events such asTurnCompletedbypass a command-output backlog.codex-rs/tui/src/app/tests.rs, I added a regression test that fills a capacity-1 active-thread queue with command output delta, queues another output delta, then queuesTurnCompleted; the expected next lossless event isTurnCompleted, andWorking...clears.codex-rs/app-server/src/in_process.rs, I aligned the lower-level in-process app-server must-deliver helper with app-server-client forTurnCompleted,ItemCompleted, assistant/plan/reasoning deltas, while keepingCommandExecutionOutputDeltabest-effort.Validation
Commands run:
Results:
Question
Would maintainers prefer a PR for the TUI active-thread queue best-effort drop fix first, or should a broader follow-up also make core
ExecCommandOutputDeltaemission explicitly best-effort even though the current core event channel is unbounded?I think this is addressed by https://github.com/openai/codex/pull/21870. If you see similar symptoms, please file a new bug report using
/feedback.