Skip to content

CLI: resume can get stuck on Working after unclean disconnect/shutdown of an active turn #12382

Closed

Description

@gabrielbryk

What version of Codex CLI is running?

codex-cli 0.104.0

What subscription do you have?

ChatGPT Plus

Which model were you using?

Primarily gpt-5.3-codex

What platform is your computer?

Linux x86_64 (Ubuntu 25.10, kernel 6.17.0-14-generic)

What terminal emulator and version are you using (if applicable)?

zsh terminal on Linux

What issue are you seeing?

codex resume <thread-id> can get stuck on Working for long-lived threads after an unclean disconnect/shutdown (for example interrupt while a tool call is still running, then close/kill session and later resume).

This is thread-specific. Fresh/new sessions usually work.

MCPs do not seem to be the root cause:

  • Repro still occurs with MCPs disabled.
  • Re-enabling/disabling MCP does not eliminate recurrence.

What steps can reproduce the bug?

  1. Start a long-running turn in Codex (for example a command that requires repeated polling / write_stdin updates).
  2. Interrupt / terminate the Codex process uncleanly while that turn is still active (Ctrl+C / shutdown / disconnect).
  3. Run codex resume <same-thread-id>.
  4. Observe resume opening but staying stuck on Working with no progress.

What is the expected behavior?

Resume should recover cleanly from interrupted turns (or mark them aborted) and allow normal interaction, rather than remaining in a stale in-progress state.

What is the actual behavior?

The resumed thread often appears stuck in a stale in-progress state (Working) until manual JSONL repair.

Evidence (from local logs/session state)

Observed on 2026-02-20:

  • Thread file:

    • stored under ~/.codex/sessions/.../rollout-*.jsonl
    • size: ~300 MB
    • lines: ~73k
  • Tail boundary indicates incomplete turn:

    • last_task_started=2026-02-20T22:29:02.373Z
    • last_task_complete=2026-02-20T21:35:53.389Z
  • Log sequence shows unclean interruption/shutdown followed by resume + fallback warnings:

    • 2026-02-20T22:28:29Z interrupt received
    • 2026-02-20T22:28:30Z shutting down Codex instance
    • 2026-02-20T22:28:54Z resumed rollout successfully
    • repeated warnings: state db record_discrepancy: find_thread_path_by_id_str_in_subdir, falling_back

Workaround

I can recover by trimming session JSONL to the last event_msg task_complete boundary (with backup), then resume works again.

That workaround strongly suggests the resume path is not robust to interrupted in-flight turns.

Related issues

Possibly related to:

Request

Could Codex automatically harden resume against this pattern by detecting/recovering incomplete tails (e.g., task_started newer than task_complete) after unclean shutdown/disconnect?

Activity

  1. added
    bugSomething isn't working
    CLIIssues related to the Codex CLI
    on Feb 20, 2026
  2. github-actions commented on Feb 20, 2026

    @github-actions
    Contributor
  3. added
    TUIIssues related to the terminal user interface: text input, menus and dialogs, and terminal display
    and removed
    CLIIssues related to the Codex CLI
    on Feb 26, 2026
  4. etraut-openai commented on Oct 12, 2026

    @etraut-openai
    Contributor

    (response from codex)

    Closing as fixed: resumed history no longer reactivates a stale Working state (#12420), and cold resume marks unfinished turns interrupted when the thread is idle (#14125). Both fixes are included in CLI 0.162.1. Please reopen if an unclean disconnect still leaves a thread stuck.

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

    TUIIssues related to the terminal user interface: text input, menus and dialogs, and terminal displaybugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions