Skip to content

[Codex App][Remote SSH] Thread hydration blocks the app-server queue and causes an endless reconnect loop #36189

Description

@yufeinever

What version of the Codex App are you using (From "About Codex" dialog)?

26.721.11231.0; remote Codex CLI/app-server 0.146.0.

What subscription do you have?

ChatGPT subscription (exact tier not confirmed).

What platform is your computer?

Microsoft Windows NT 10.0.26200.0 x64; remote host is Linux 6.8.0-136-generic x86_64.

What issue are you seeing?

Codex Desktop Remote SSH can enter an endless reconnect loop when it automatically hydrates several existing threads. One slow thread/resume request occupies an app-server request slot for 50-65 seconds. Additional hydration and background requests fill all six in-flight slots, queued requests expire after 30 seconds, and the whole WebSocket eventually closes with code 1006.

This affects the entire remote host connection, not only the problematic thread. New threads cannot be created or sent while the queue is blocked. Normal SSH sessions remain stable, the managed remote app-server PID remains alive, and server CPU/memory are not saturated.

The affected session files were not exceptionally large by storage standards (approximately 2-20 MB), but some JSONL records were monolithic: individual records were approximately 1.2-1.64 MB. A 2.28 MB session with only 111 records contained one 1.26 MB record. This suggests that record shape and concurrent hydration, rather than only total session size, trigger the failure.

Representative redacted Desktop log sequence:

app_server_client_request_queue_rejected inFlightRequestCount=6
  method=plugin/list queueWaitMs=30003 reason=queue-expired

Request failed method=thread/resume durationMs=65397
  error="Codex app-server is not available"

app_server_connection.closed code=1006 transport=websocket
proxy_command_failed signal=SIGTERM operation=app_server_proxy

SIGTERM is logged after the WebSocket closes and appears to be cleanup, not the initial cause.

What steps can reproduce the bug?

  1. Configure Codex Desktop on Windows with a Remote SSH Linux project.
  2. Create several threads in that project, including threads containing large tool outputs or other large individual JSONL records.
  3. Leave Remote SSH auto-connect enabled and keep those threads active/unarchived.
  4. Restart Codex Desktop or reconnect the Remote SSH host so Desktop hydrates multiple threads.
  5. Observe several concurrent thread/resume calls. One or more resume calls take tens of seconds.
  6. Observe inFlightRequestCount=6, request queue expiration after 30 seconds, WebSocket close code 1006, and automatic reconnect.
  7. Try to create or send a new thread while this is happening. The new request is blocked behind hydration requests or fails when the app-server connection closes.

The same SSH route becomes responsive immediately after the recovery steps below, without changing the network.

What is the expected behavior?

  • A slow or malformed thread should only fail or delay that thread's hydration.
  • Interactive operations such as thread/start and turn/start should not be blocked behind bulk hydration.
  • Thread history should be streamed, paginated, or processed with bounded record sizes.
  • Remote reconnect should be bounded and should not repeatedly replay the same failing hydration workload.
  • The UI should identify the offending thread and offer a reversible recovery action.

Additional information

The effective recovery was:

  1. Identify the thread whose thread/resume is blocking the queue.
  2. Archive the offending large/abnormal thread or threads (reversible; do not delete them).
  3. Cancel their pending resume operations and clear queued hydration requests.
  4. Stop automatic reconnect instead of immediately replaying the same workload.
  5. Restart the managed remote daemon once to clear already in-flight server requests, then reconnect only after the offending threads are archived.

Recommended product behavior: after a hydration timeout or repeated queue saturation, show an Archive task and stop reconnecting recovery action. It should archive the identified thread, cancel pending hydration, clear the affected queue, and pause automatic reconnect until the user explicitly retries. Interactive requests should also receive priority over background hydration.

After applying the recovery above, request latency on the unchanged connection returned to approximately 1-350 ms, turn/start completed in approximately 122 ms, and the connection remained stable. Before recovery, even smaller threads took 25-31 seconds because they were queued behind the blocking resume.

Related but not duplicate:

This report is specifically about thread hydration/backpressure causing host-wide request starvation and a reconnect loop.

Metadata

Metadata

Assignees

No one assigned

    Labels

    appIssues related to the Codex desktop appapp-serverIssues involving app server protocol or interfacesbugSomething isn't workingconnectivityIssues involving networking or endpoint connectivity problems (disconnections)performanceremotesessionIssues involving session (thread) management, resuming, forking, naming, archivingwindows-osIssues related to Codex on Windows systems

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions