codex - ๐Ÿ’ก(How to fix) Fix Add /detach for active Codex CLI sessions

Official PRs (โ€ฆ)
ON THIS PAGE

Recommended Tools

ร—6

Utilities matched from this issueโ€™s tags and category โ€” try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful ยท Quick feedback

Loadingโ€ฆ

Root Cause

This would make long-running Codex CLI workflows much more robust without forcing users to manage terminal multiplexers. It fits naturally with Codex's existing session/resume model and would improve remote development workflows, where keeping an SSH terminal alive is often the weakest part of the loop.

Related to #3968, but this request is specifically about detaching an already-running interactive Codex session rather than starting arbitrary background terminal commands.

Code Example

/detach

---

Detached session: 019e...
Reattach with: codex resume 019e...
RAW_BUFFERClick to expand / collapse

What feature would you like to see?

Add a /detach command to active Codex CLI/TUI sessions so a running agent task can continue after the terminal UI exits, without requiring tmux or screen.

Problem

Many Codex tasks start interactively and only later become long-running: repo-wide reviews, refactors, test runs, migrations, or investigations on a remote VM. Today, once the task is running, the user generally has to keep the terminal open or rely on tmux/screen to avoid losing the live session.

This is especially painful over SSH, where disconnects or local terminal closes can interrupt the workflow.

Proposed UX

Inside an active Codex session:

/detach

Codex should keep the current run alive in the background, exit the TUI, and print something like:

Detached session: 019e...
Reattach with: codex resume 019e...

Reattaching should reconnect to the live session if it is still running, or open the completed session if it has already finished.

Expected behavior

  • /detach preserves the current session, working directory, config, auth context, and pending task state.
  • codex resume <session-id> can reattach to the live detached session.
  • Detached sessions appear in codex resume --all with a clear running/paused/completed state.
  • If Codex needs approval or user input while detached, it should pause safely and make that state visible when resumed.
  • Session output should remain available after detaching through normal resume/history behavior.

Why this matters

This would make long-running Codex CLI workflows much more robust without forcing users to manage terminal multiplexers. It fits naturally with Codex's existing session/resume model and would improve remote development workflows, where keeping an SSH terminal alive is often the weakest part of the loop.

Related to #3968, but this request is specifically about detaching an already-running interactive Codex session rather than starting arbitrary background terminal commands.

Vote matrix ยท Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loadingโ€ฆ

FAQ

Expected behavior

  • /detach preserves the current session, working directory, config, auth context, and pending task state.
  • codex resume <session-id> can reattach to the live detached session.
  • Detached sessions appear in codex resume --all with a clear running/paused/completed state.
  • If Codex needs approval or user input while detached, it should pause safely and make that state visible when resumed.
  • Session output should remain available after detaching through normal resume/history behavior.

Still need to ship something?

ร—6

Another batch ranked right after the header list โ€” different links, same matching logic.

Back to top recommendations

TRENDING

codex - ๐Ÿ’ก(How to fix) Fix Add /detach for active Codex CLI sessions