openai / openai/codex

Ctrl+C can leave session locked with stale active writer, preventing resume

Open
#43,374 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

app-server bug CLI
Dominant language
Rust
Stars
125k
Forks
19.4k
PR merge metrics
PR metrics pending

Description

Summary

Pressing Ctrl+C while using Codex CLI can leave the current session stuck as having an active writer. After restarting Codex and trying to resume the same session, resume fails with an already has an active writer error.

Environment

  • Codex CLI: 0.153.4
  • Platform: Linux

Steps to reproduce

  1. Start codex.
  2. Work in a session normally.
  3. Press Ctrl+C while Codex is running/working.
  4. Start Codex again.
  5. Attempt to resume the previous session.
  6. Resume fails because the thread is reported as already having an active writer.

Actual behavior

thread/resume failed during TUI bootstrap: thread/resume failed: thread <thread-id> already has an active writer (code -32600)

The previous Codex process has already exited, but the writer ownership appears to remain stale, so the session cannot be resumed normally.

Expected behavior

Ctrl+C should cleanly release the thread writer/ownership before exiting, or stale writer ownership should be detected and recovered automatically when resuming.

A session should not become unusable simply because the previous Codex process was interrupted with Ctrl+C.

Suggested fix

Either:

  • gracefully release the active writer on SIGINT, or
  • detect that the previous writer no longer exists and reclaim the session on resume.

This has happened repeatedly and is easy to trigger accidentally in a terminal.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Linux Ctrl+C flow in Codex CLI, then trace thread writer ownership during SIGINT and session resume. The work is done when interrupting a session no longer leaves it unusable, either by releasing ownership before exit or reclaiming stale ownership during resume, with a regression check for the reported error.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.