codex - 💡(How to fix) Fix Managed app-server daemon repeatedly resets remote-control WebSocket; direct app-server stays stable

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

The managed Codex app-server daemon appears to repeatedly replace or restart the remote-control app-server, disconnecting all attached Codex CLI/TUI clients with a WebSocket reset. Bypassing the managed daemon / pid-update-loop layer and running codex app-server --remote-control --listen unix:// directly under a user LaunchAgent has kept the same app-server process stable for more than 7 hours.

Error Message

remote app server at unix:///Users/<user>/.codex/app-server-control/app-server-control.sock transport failed: WebSocket protocol error: Connection reset without closing handshake

Root Cause

The managed Codex app-server daemon appears to repeatedly replace or restart the remote-control app-server, disconnecting all attached Codex CLI/TUI clients with a WebSocket reset. Bypassing the managed daemon / pid-update-loop layer and running codex app-server --remote-control --listen unix:// directly under a user LaunchAgent has kept the same app-server process stable for more than 7 hours.

Fix Action

Fix / Workaround

Observations Before Workaround

Workaround That Stabilized It

Current stable state after the workaround:

Code Example

remote app server at `unix:///Users/<user>/.codex/app-server-control/app-server-control.sock`
transport failed: WebSocket protocol error: Connection reset without closing handshake

---

2026-05-21T15:56:04.702327Z WARN codex_tui::app::app_server_events:
app-server event stream disconnected: remote app server at `unix:///Users/<user>/.codex/app-server-control/app-server-control.sock`
transport failed: WebSocket protocol error: Connection reset without closing handshake

2026-05-21T16:06:50.608800Z WARN codex_tui::app::app_server_events:
app-server event stream disconnected: remote app server at `unix:///Users/<user>/.codex/app-server-control/app-server-control.sock`
transport failed: WebSocket protocol error: Connection reset without closing handshake

2026-05-21T16:12:51.902492Z WARN codex_tui::app::app_server_events:
app-server event stream disconnected: remote app server at `unix:///Users/<user>/.codex/app-server-control/app-server-control.sock`
transport failed: WebSocket protocol error: Connection reset without closing handshake

---

codex app-server daemon pid-update-loop
codex app-server --remote-control --listen unix://

---

2026-05-21 23:16:21 CST repair_start reason=stale_or_missing_app_server_pid:62317
2026-05-21 23:27:14 CST repair_start reason=stale_or_missing_app_server_pid:78671
2026-05-21 23:35:51 CST repair_start reason=stale_or_missing_app_server_pid:80766
2026-05-21 23:47:13 CST repair_start reason=stale_or_missing_app_server_pid:89321
2026-05-21 23:49:55 CST repair_start reason=stale_or_missing_app_server_pid:96332
2026-05-22 00:01:18 CST repair_start reason=stale_or_missing_app_server_pid:6497

---

codex app-server --remote-control --listen unix://

---

PID: 18272
PPID: 1
Start time: Fri May 22 00:14:52 2026
Elapsed: more than 7 hours
Command: codex app-server --remote-control --listen unix://

---

{"status":"running","socketPath":"/Users/<user>/.codex/app-server-control/app-server-control.sock","cliVersion":"0.132.0","appServerVersion":"0.132.0"}
RAW_BUFFERClick to expand / collapse

Summary

The managed Codex app-server daemon appears to repeatedly replace or restart the remote-control app-server, disconnecting all attached Codex CLI/TUI clients with a WebSocket reset. Bypassing the managed daemon / pid-update-loop layer and running codex app-server --remote-control --listen unix:// directly under a user LaunchAgent has kept the same app-server process stable for more than 7 hours.

Environment

  • Codex CLI: codex-cli 0.132.0
  • Platform: macOS 26.4.1 build 25E253
  • Kernel: Darwin 25.4.0 arm64
  • App-server socket: unix:///Users/<user>/.codex/app-server-control/app-server-control.sock
  • Remote-control app-server command: codex app-server --remote-control --listen unix://

Symptom

Multiple active Codex CLI/TUI sessions were disconnected at the same time with:

remote app server at `unix:///Users/<user>/.codex/app-server-control/app-server-control.sock`
transport failed: WebSocket protocol error: Connection reset without closing handshake

The relevant log entries included:

2026-05-21T15:56:04.702327Z WARN codex_tui::app::app_server_events:
app-server event stream disconnected: remote app server at `unix:///Users/<user>/.codex/app-server-control/app-server-control.sock`
transport failed: WebSocket protocol error: Connection reset without closing handshake

2026-05-21T16:06:50.608800Z WARN codex_tui::app::app_server_events:
app-server event stream disconnected: remote app server at `unix:///Users/<user>/.codex/app-server-control/app-server-control.sock`
transport failed: WebSocket protocol error: Connection reset without closing handshake

2026-05-21T16:12:51.902492Z WARN codex_tui::app::app_server_events:
app-server event stream disconnected: remote app server at `unix:///Users/<user>/.codex/app-server-control/app-server-control.sock`
transport failed: WebSocket protocol error: Connection reset without closing handshake

The disconnects affected multiple CLI/TUI clients simultaneously, which points to the shared app-server process rather than a single client session.

Observations Before Workaround

While the issue was happening, the managed daemon process was present:

codex app-server daemon pid-update-loop
codex app-server --remote-control --listen unix://

The app-server PID changed repeatedly. A local watchdog observed stale or missing app-server PID files and repaired the server repeatedly. Examples:

2026-05-21 23:16:21 CST repair_start reason=stale_or_missing_app_server_pid:62317
2026-05-21 23:27:14 CST repair_start reason=stale_or_missing_app_server_pid:78671
2026-05-21 23:35:51 CST repair_start reason=stale_or_missing_app_server_pid:80766
2026-05-21 23:47:13 CST repair_start reason=stale_or_missing_app_server_pid:89321
2026-05-21 23:49:55 CST repair_start reason=stale_or_missing_app_server_pid:96332
2026-05-22 00:01:18 CST repair_start reason=stale_or_missing_app_server_pid:6497

In one concrete case:

  • The app-server PID changed to 11510, started at 2026-05-22 00:06:50 CST.
  • That matched the client-side disconnect at 2026-05-21T16:06:50Z / local 2026-05-22 00:06:50 CST.
  • The parent process at the time was the managed pid-update-loop, not the custom watchdog.

Workaround That Stabilized It

I stopped using the managed daemon / pid-update-loop path and instead ran the remote-control app-server directly under a user LaunchAgent:

codex app-server --remote-control --listen unix://

Current stable state after the workaround:

PID: 18272
PPID: 1
Start time: Fri May 22 00:14:52 2026
Elapsed: more than 7 hours
Command: codex app-server --remote-control --listen unix://

Health check:

{"status":"running","socketPath":"/Users/<user>/.codex/app-server-control/app-server-control.sock","cliVersion":"0.132.0","appServerVersion":"0.132.0"}

After switching to the direct LaunchAgent:

  • codex app-server daemon pid-update-loop is no longer running.
  • The app-server PID has remained unchanged for more than 7 hours.
  • There have been no new Connection reset without closing handshake entries after the cutover.
  • Multiple CLI/TUI sessions have remained attached.

Expected Behavior

The managed app-server daemon should not restart or replace the app-server process during active remote-control / CLI/TUI sessions. If a restart is necessary, clients should be reconnected cleanly or the daemon should preserve active event streams.

Actual Behavior

When the managed daemon / pid-update-loop path was active, all connected clients were periodically disconnected by a WebSocket reset. Running the same app-server command directly without pid-update-loop has been stable.

Suspected Area

The issue appears to be in the managed local app-server daemon lifecycle, especially codex app-server daemon pid-update-loop, rather than in the app-server protocol itself or in a single CLI/TUI client.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

codex - 💡(How to fix) Fix Managed app-server daemon repeatedly resets remote-control WebSocket; direct app-server stays stable