Ctrl+C can leave session locked with stale active writer, preventing resume
Nobody has claimed this yet.
- 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
- Start
codex. - Work in a session normally.
- Press
Ctrl+Cwhile Codex is running/working. - Start Codex again.
- Attempt to resume the previous session.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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