Skip to content

CLI hangs indefinitely on session resume when ssh got disconnected during a long running command #12515

Open

Description

@georgkapellerEET

Title: Codex hang when SSH session closes during active tool call

Date: 2026-02-22
Environment:

  • Codex CLI: 0.104.0
  • OS: Linux aarch64 (Debian bookworm, kernel 6.12.47+rpt-rpi-v8)
  • Shell: bash 5.2.15
  • Workspace: /mnt/device1/firmware

Observed behavior:
A long-running tool command was dispatched, entered running state, then the SSH session
closed shortly after. Likely, the rollout never received normal completion for that command and the agent remained in a waiting/stalled state until resumed/interrupted, which leads to a state that, when the session is resumed, it will stay in 'Working' indefinitely. See more details in the protocol

Evidence:

  1. Command dispatch:
  • rollout file: /home/pi/.codex/sessions/2026/02/22/rollout-2026-02-22T04-05-49-019c834f-
    7a6c-7df0-9316-b1d3513a5d20.jsonl
  • line 607: service.restartall command
  • line 609: “Process running with session ID 59574”
  1. SSH close near same time:
  • Feb 22 18:20:33 local: pam_unix(sshd:session): session closed for user pi
  • captured in /tmp/openai-hang-debug-20260222-2148/02b-ssh-filtered-with-close.txt
  1. Related non-graceful task warning:
  • codex-tui.log contains: “task ... didn't complete gracefully after 100ms”
  • extracted in /tmp/openai-hang-debug-20260222-2148/03-codex-warnings.txt

Hypothesis:
Race condition between tool/process execution state and transport/session teardown (SSH/
PTY), leaving the engine waiting for a completion event that never arrives.

Attached artifacts:

  • /tmp/openai-hang-debug-20260222-2148.tar.gz
  • sha256: 3bf646afa2b15401f77b291a2ff26750108fc89e554de43c49b44703ce8d5e15

Activity

  1. added
    bugSomething isn't working
    CLIIssues related to the Codex CLI
    tool-callsIssues related to tool calling
    on Feb 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtool-callsIssues related to tool calling

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions