TUI UI deadlocks when switching agent threads while under high CPU+Memory pressure
What version of Codex CLI is running?
0.146.1.322 (stable)
What subscription do you have?
None; using AWS Bedrock (company paid)
Which model were you using?
gpt-5.6-sol
What platform is your computer?
Darwin 25.5.0 arm64 arm
What terminal emulator and version are you using (if applicable)?
Ghostty
Codex doctor report
{
"schemaVersion": 1,
"generatedAt": "1786305884s since unix epoch",
"overallStatus": "warning",
"codexVersion": "0.146.1",
"checks": {
"app_server.status": {
"id": "app_server.status",
"category": "app-server",
"status": "ok",
"summary": "background server is not running",
"details": {
"control socket": "/Users/daboross/.codex/app-server-control/app-server-control.sock",
"daemon state dir": "/Users/daboross/.codex/app-server-daemon",
"mode": "ephemeral",
"pid file": "/Users/daboross/.codex/app-server-daemon/app-server.pid (missing)",
"settings": "/Users/daboross/.codex/app-server-daemon/settings.json (missing)",
"status": "not running",
"update-loop pid file": "/Users/daboross/.codex/app-server-daemon/app-server-updater.pid (missing)"
},
"remediation": null,
"durationMs": 0
},
"auth.credentials": {
"id": "auth.credentials",
"category": "auth",
"status": "ok",
"summary": "OpenAI auth is not required for the active model provider",
"details": {
"auth file": "/Users/daboross/.codex/auth.json",
"auth storage mode": "File",
"model provider requires OpenAI auth": "false"
},
"remediation": null,
"durationMs": 0
},
"config.load": {
"id": "config.load",
"category": "config",
"status": "ok",
"summary": "config loaded",
"details": {
"CODEX_HOME": "/Users/daboross/.codex",
"config.toml": "/Users/daboross/.codex/config.toml",
"config.toml parse": "ok",
"cwd": "/Volumes/external-ssd/workplace/External/openai/codex",
"enabled feature flags": "shell_tool, unified_exec, shell_snapshot, code_mode_host, terminal_resize_reflow, sqlite, hooks, enable_request_compression, multi_agent, apps, tool_search_always_defer_mcp_tools, tool_suggest, plugins, in_app_browser, in_app_updates, browser_use, browser_use_full_cdp_access, browser_use_external, computer_use, remote_plugin, plugin_sharing, image_generation, resize_all_images, item_ids, skill_mcp_dependency_install, skill_search, mentions_v2, steer, guardian_approval, goals, collaboration_modes, tool_call_mcp_elicitation, auth_elicitation, personality, fast_mode, tui_app_server, prevent_idle_sleep, remote_compaction_v2",
"feature flag overrides": "prevent_idle_sleep=true, workspace_dependencies=false",
"feature flags enabled": "38",
"log dir": "/Users/daboross/.codex/log",
"mcp servers": "7",
"model": "openai.gpt-5.6-sol",
"model provider": "amazon-bedrock",
"sqlite home": "/Users/daboross/.codex"
},
"remediation": null,
"durationMs": 0
},
"git.environment": {
"id": "git.environment",
"category": "git",
"status": "ok",
"summary": "git version 2.50.1 (Apple Git-155)",
"details": {
".git entry": "directory",
"PATH git #1": "/usr/bin/git",
"PATH git entries": "1",
"git branch": "main",
"git build options": "git version 2.50.1 (Apple Git-155); cpu: arm64; no commit associated with this build; sizeof-long: 8; sizeof-size_t: 8; shell-path: /bin/sh; feature: fsmonitor--daemon; libcurl: 8.7.1; zlib: 1.2.12; SHA-1: SHA1_DC; SHA-256: SHA256_BLK",
"git exec path": "/Applications/Xcode.app/Contents/Developer/usr/libexec/git-core",
"git version": "git version 2.50.1 (Apple Git-155)",
"repo detected": "true",
"repo root": "/Volumes/external-ssd/workplace/External/openai/codex",
"selected git": "/usr/bin/git"
},
"remediation": null,
"durationMs": 45
},
"installation": {
"id": "installation",
"category": "install",
"status": "ok",
"summary": "installation looks consistent",
"details": {
"PATH codex #1": "/Users/daboross/.toolbox/bin/codex",
"current executable": "/Users/daboross/.toolbox/tools/codex/0.146.1.322/codex",
"install context": "other",
"managed by bun": "false",
"managed by npm": "false",
"managed by pnpm": "false",
"managed package root": "not set"
},
"remediation": null,
"durationMs": 6
},
"mcp.config": {
"id": "mcp.config",
"category": "mcp",
"status": "ok",
"summary": "MCP configuration is locally consistent",
"details": {
"configured servers": "7",
"disabled servers": "6",
"stdio servers": "7"
},
"remediation": null,
"durationMs": 0
},
"network.env": {
"id": "network.env",
"category": "network",
"status": "ok",
"summary": "network-related environment looks readable",
"details": {
"proxy env vars": "none"
},
"remediation": null,
"durationMs": 0
},
"network.provider_reachability": {
"id": "network.provider_reachability",
"category": "reachability",
"status": "ok",
"summary": "active provider has no HTTP endpoint to probe",
"details": {
"active provider endpoint": "none configured",
"reachability mode": "provider auth"
},
"remediation": null,
"durationMs": 0
},
"network.websocket_reachability": {
"id": "network.websocket_reachability",
"category": "websocket",
"status": "ok",
"summary": "Responses WebSocket is not enabled for the active provider",
"details": {
"model provider": "amazon-bedrock",
"provider name": "Amazon Bedrock",
"proxy env vars": "none",
"supports websockets": "false",
"wire API": "responses"
},
"remediation": null,
"durationMs": 0
},
"runtime.provenance": {
"id": "runtime.provenance",
"category": "runtime",
"status": "ok",
"summary": "running local build on macos-aarch64",
"details": {
"commit": "unknown",
"current executable": "/Users/daboross/.toolbox/tools/codex/0.146.1.322/codex",
"install method": "other",
"platform": "macos-aarch64",
"version": "0.146.1"
},
"remediation": null,
"durationMs": 0
},
"runtime.search": {
"id": "runtime.search",
"category": "search",
"status": "ok",
"summary": "search is OK (system)",
"details": {
"search command": "rg",
"search command readiness": "ripgrep 15.1.0",
"search provider": "system"
},
"remediation": null,
"durationMs": 7
},
"sandbox.helpers": {
"id": "sandbox.helpers",
"category": "sandbox",
"status": "ok",
"summary": "sandbox configuration is readable",
"details": {
"approval policy": "OnRequest",
"codex-linux-sandbox helper": "none",
"execve wrapper helper": "/Users/daboross/.codex/tmp/arg0/codex-arg0DKXGLw/codex-execve-wrapper",
"filesystem sandbox": "restricted",
"network sandbox": "restricted"
},
"remediation": null,
"durationMs": 0
},
"state.paths": {
"id": "state.paths",
"category": "state",
"status": "ok",
"summary": "state paths and databases are inspectable",
"details": {
"CODEX_HOME": "/Users/daboross/.codex (dir)",
"active rollout files": "5438 files, 12224998732 total bytes, 2248068 average bytes",
"archived rollout files": "0 files, 0 total bytes, 0 average bytes",
"goals DB": "/Users/daboross/.codex/goals_1.sqlite (file)",
"goals DB integrity": "ok",
"log DB": "/Users/daboross/.codex/logs_2.sqlite (file)",
"log DB integrity": "ok",
"log dir": "/Users/daboross/.codex/log (missing)",
"memories DB": "/Users/daboross/.codex/memories_1.sqlite (file)",
"memories DB integrity": "ok",
"sqlite home": "/Users/daboross/.codex (dir)",
"state DB": "/Users/daboross/.codex/state_5.sqlite (file)",
"state DB integrity": "ok",
"thread history DB": "/Users/daboross/.codex/thread_history_1.sqlite (missing)",
"thread history DB integrity": "skipped (missing)"
},
"remediation": null,
"durationMs": 4769
},
"state.rollout_db_parity": {
"id": "state.rollout_db_parity",
"category": "threads",
"status": "warning",
"summary": "rollout files and state DB thread inventory differ",
"details": {
"default model provider": "amazon-bedrock",
"rollout DB active files": "5438",
"rollout DB active rows": "5437",
"rollout DB archive mismatches": "0",
"rollout DB archived files": "0",
"rollout DB archived rows": "0",
"rollout DB duplicate DB paths": "0",
"rollout DB duplicate rollout thread ids": "0",
"rollout DB malformed file names": "0",
"rollout DB missing active rows": "1",
"rollout DB missing active sample": "/Users/daboross/.codex/sessions/2026/08/04/rollout-2026-08-04T22-38-32-019fd06e-37ce-7cb1-9496-fd8c537557a7.jsonl",
"rollout DB missing archived rows": "0",
"rollout DB model providers": "amazon-bedrock=5437",
"rollout DB rows": "5437",
"rollout DB scan cap reached": "false",
"rollout DB scan errors": "0",
"rollout DB sources": "subagent:thread_spawn=3128, subagent:other=1554, exec=354, cli=324, subagent:review=66, unknown=6, vscode=5",
"rollout DB stale rows": "0"
},
"issues": [
{
"severity": "warning",
"cause": "rollout files are missing from the state DB",
"measured": "1 active, 0 archived",
"expected": "every rollout file has a matching threads row",
"remedy": null,
"fields": []
}
],
"remediation": null,
"durationMs": 3338
},
"system.environment": {
"id": "system.environment",
"category": "system",
"status": "ok",
"summary": "OS language en-US",
"details": {
"EDITOR": "set",
"LANG": "en_US.UTF-8",
"VISUAL": "not set",
"os": "Mac OS 26.5.2 [64-bit]",
"os language": "en-US",
"os type": "Mac OS",
"os version": "26.5.2"
},
"remediation": null,
"durationMs": 3
},
"terminal.env": {
"id": "terminal.env",
"category": "terminal",
"status": "ok",
"summary": "terminal metadata was detected",
"details": {
"COLORTERM": "truecolor",
"TERMINFO": "/Applications/Ghostty.app/Contents/Resources/terminfo (dir)",
"TERM_PROGRAM": "ghostty",
"color output": "enabled",
"effective locale": "en_US.UTF-8",
"stderr is terminal": "true",
"stdin is terminal": "true",
"stdout is terminal": "true",
"terminal": "Ghostty",
"terminal size": "224x56",
"terminal version": "1.3.1"
},
"remediation": null,
"durationMs": 0
},
"terminal.title": {
"id": "terminal.title",
"category": "title",
"status": "ok",
"summary": "terminal title default",
"details": {
"terminal title activity": "true",
"terminal title items": "activity, project-name",
"terminal title project source": "git repo root",
"terminal title project value": "codex",
"terminal title source": "default"
},
"remediation": null,
"durationMs": 0
},
"updates.status": {
"id": "updates.status",
"category": "updates",
"status": "ok",
"summary": "update configuration is locally consistent",
"details": {
"check for update on startup": "false",
"latest version": "0.147.0",
"latest version status": "newer version is available",
"update action": "manual or unknown",
"version cache": [
"/Users/daboross/.codex/version.json",
"missing"
]
},
"remediation": null,
"durationMs": 160
}
}
}
What issue are you seeing?
When the system is under extreme CPU + memory pressure (2-3 parallel xcodebuild processes each all trying to consume all CPU cores, active processes swapping), the UI can hang.
I'm typically talking to the main agent, and I typically have many subagents open as well. First symptom: messages sent to the main agent are displayed in the UI, but responses back are not displayed (confirmed via jsonl inspection that the main agent does respond, but it does not show in the UI).
If I'm in that no-main-responses showing mode, and I do nothing, it will eventually recover.
If I'm in that no-main-responses showing mode, and I instead switch to another agent, then switch back to main (using /side and exiting /side also works), the UI freezes entirely.
When frozen, the UI seems to not process any input. It does not respond to Ctrl+Q, Ctrl+S, newlines, nor typed messages. It does not re-draw upon terminal resizing. The main agent continues to process new turns, but after the UI freezes, if I type input, even with <Enter> at the end, the main agent does not receive it as a message.
What steps can reproduce the bug?
- Start a codex TUI instance
- Ask it to start a sub-task and keep it open for you to talk to
- Find/download a project with a long (10+ minute) highly parallel compilation. Ensure you have enough system memory to support one compilation, but maybe not enough to support multiple without swapping
- Clone the project into multiple worktrees or directories
- Start compilation in multiple workspaces, continuing to add more until most application UIs become visibly laggy (browsers, terminal, etc. should be taking 0.5 seconds to respond to most UI input)
- Note: it's not entirely clear to me whether it is specifically CPU pressure, or if the multiple app compilations cause memory pressure and slowdown via swapping
- Rapidly swap between the main instance and sub-agent via
/agentsuntil UI. Alternatively, rapidly launch/side <some ask>conversations and exit them.
What is the expected behavior?
At all points, the TUI should be responsive. Under no circumstance should it stop processing user input - any continued input processing - even if delayed - is preferred to a complete freeze/deadlock.
Additional information
After experiencing this bug four or five times, I modified codex locally to hook in tokio-console for further diagnosis. I forked off of 79b4f03d35962b005b007a015113b38930711665 / rust-v0.146.1.
I got a codex instance to freeze, then had an LLM analyze it. It produced this timeline and inference:
Precise event timeline
| Time | Type | Event and significance |
| --- | --- | --- |
| 13:24:46.396552625 | Observation | Task 132, the top-level TUI event-loop task, received its last recorded wake. |
| 13:24:47.507392250 to 13:24:47.507410583 | Observation | Task 154, the in-process app-server facade worker, performed its final recorded poll. The broader capture records its wake/poll beginning around 13:24:47.507383. |
| 13:24:47.507399875 to 13:24:47.507419083 | Observation | Task 132 performed its final recorded poll. It ended approximately 8.5 microseconds after task 154's final poll ended. |
| About 13:24:47.508945 to 13:24:47.508983417 | Observation | Task 136, the frame-scheduler task, received and processed its final recorded redraw wake, then became idle. |
| After 13:24:47.508983417 | Observation | Lower in-process app-server tasks 141, 143, and 144 continued polling after the three UI-facing tasks stopped. |
| 13:30:09.395 | Observation | The parent rollout still recorded parent-owned reasoning, messages, and tool activity, rather than only child-process activity. |
| 13:56:57.064 | Observation | The parent rollout recorded a parent send_input call. |
| 13:57:01.105 | Observation | The parent rollout recorded a parent wait_agent call, the latest explicitly verified parent event. |
| 13:59:59.832506 | Observation | The target Codex process remained alive in state S+, using 0.5% CPU with 422,256 KiB RSS. |
Inference: The facade-first, TUI-next ordering is consistent with task 154 becoming pending on one of the awaited outward sends in the lossless-delivery path, followed by task 132 becoming pending on a facade request. The potentially blocked outward item is either a preceding Lagged marker or the lossless event itself.
Timing alone does not identify the awaited Rust future, queue occupancy, outward item, or pending request method. The deadlock hypothesis therefore depends on both the timing evidence, and source analysis.
3 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
Agreed this is a duplicate. I'm closing in favor of that issue, and I'll post my full template issue diagnosis/response as a comment on that issue.
If it is deemed this is worth having open as an alternate issue, feel free to open. LMK anything I can do that's useful.