Add /restart to reinitialize Codex and resume the current thread
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
Research direction
Start by reviewing the tested implementation on the feat/restart-session branch and trace the CLI/TUI slash-command, shutdown, relaunch, and thread-resume entry points it changes. Run the relevant tests from that branch and verify that /restart preserves the working directory and conversation, reinitializes MCP connections, and avoids replaying the original prompt or attachments.
Written by the indexing model from the issue text.
Description
What variant of Codex are you using?
CLI / TUI
What feature would you like to see?
Add a /restart slash command that performs the equivalent of:
- Running
/quitand completing the normal shutdown sequence. - Relaunching Codex in the same working directory.
- Resuming the current thread automatically.
Some MCP servers occasionally fail to initialize, load their tools, or begin working within an active Codex session. Even when the MCP configuration is correct, the only reliable recovery is often to:
- Quit Codex.
- Relaunch it from the same directory.
- Resume the same session manually.
After relaunching, the affected MCP tools load and work normally. This workaround requires several unnecessary steps just to restore the MCP tools.
The /restart command should:
- wait for normal session shutdown and cleanup;
- preserve the current working directory;
- resume the same thread and conversation context;
- reinitialize components normally initialized during startup, including MCP connections;
- avoid replaying the original prompt or attached images;
- avoid requiring the user to find and select the session manually.
This differs from /new, which starts a new conversation. /restart should preserve the current conversation while providing the same recovery behavior as quitting Codex, relaunching it, and resuming the session.
Additional information
A similar request was opened in #33370, but that discussion was clarified as requesting a fresh conversation context while retaining the existing process.
This proposal has the opposite session behavior: preserve the current thread and context while performing the equivalent of a clean quit and resume.
I have a tested implementation available on the feat/restart-session branch of my fork and would be happy to submit a pull request if the Codex team would like the contribution.
- Dominant language
- Rust
- Stars
- 125k
- Forks
- 19.5k
- Avg merge
- 1m
- Merged PRs (30d)
- 1k
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.
More from openai/codex
-
enhancement remote
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
bug CLI windows-os
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
macOS sandbox blocks hw.optional.arm64 sysctl, causing Flutter to misdetect Apple Silicon as x64 Openbug CLI sandbox
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug CLI TUI
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
-
CLI config enhancement skills
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
kwakseongjae/auto-hwp#319 ·
-
area:cli bug filter-quality good first issue priority:medium
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
bevyengine/bevy#25861 ·
-
comp-datalake
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
ClickHouse/ClickHouse#121222 ·
-
A-linter
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
oxc-project/oxc#26863 ·