Skip to content

CLI: /restart into the updated executable and resume the current session #52807

Open

Description

@cristph

What variant of Codex are you using?

CLI / TUI, installed through npm, running in Warp on macOS (Apple Silicon, zsh). Installed package checked for this report: @openai/codex 0.162.1.

What feature would you like to see?

Add a native /restart command that cleanly exits the current CLI runtime, launches the currently installed executable, and automatically resumes the same conversation in the same terminal pane.

Use case and current workflow

I keep Codex sessions open in Warp while upgrading the npm package. Updating the package on disk does not switch an already-running session to the new executable. I then have to exit each session, launch Codex again from the correct directory, and resume the matching conversation.

The desired sequence is:

  1. Update the installed Codex package using the existing update mechanism, for example from another terminal.
  2. In an existing Codex session, run /restart.
  3. Complete the normal shutdown/cleanup sequence, then launch the updated CLI with the equivalent of codex resume <current-session-id>.
  4. Continue the same conversation in the existing Warp pane.

A per-session command is sufficient. The first implementation does not need to update packages itself or broadcast restarts to other terminals.

Expected behavior and acceptance criteria

  • Load the installed version: after upgrading from version A to B, restarting an A session must run B. Re-entering a TUI loop inside the old executable would not satisfy this requirement.
  • Resume the exact conversation: retain its session/thread ID and persisted history, without opening a picker, creating a new conversation, or selecting another session via --last.
  • Preserve the terminal and launch context: keep the same terminal pane and working directory; carry relevant launch/profile overrides through normal resume behavior. Do not replay the original prompt or image attachments.
  • Exit cleanly: use the normal /exit shutdown path, including its handling of an active turn, and allow session persistence and terminal cleanup to finish before relaunching.
  • Remain a native CLI operation: no tmux migration, external PTY supervisor, or shell wrapper should be required. Other open terminals and unrelated sessions should remain usable.
  • Handle relaunch failure clearly: report an actionable error and the exact manual resume command. Avoid repeatedly relaunching or rerunning an update command.

Additional information

Source observations

In the inspected 0.162.1 CLI exit/update implementation, handle_app_exit prints exit information and optionally runs the update action. A successful package update prints “Update ran successfully! Please restart Codex.” and returns.

This suggests keeping the change around the existing exit/resume lifecycle. The important requirement is an executable handoff after cleanup, resolving the updated installation entrypoint rather than retaining a replaced or version-specific old binary path. The implementation choice is left to maintainers.

Restarting only the shared app-server daemon is a different operation: this request concerns the foreground CLI executable and its current conversation. Shared-daemon handling should follow normal startup compatibility behavior without forcibly interrupting unrelated sessions.

Related discussions and overlap

Suggested validation

Exercise an A-to-B package upgrade followed by restart/resume; verify the running version, exact session ID, history, working directory, and terminal usability. Also cover relevant launch overrides, startup-prompt non-replay, clean shutdown, and an unavailable relaunch target. A Unix executable handoff and Windows npm launcher behavior should both be considered for a cross-platform implementation.

The installed package version and cited source were inspected. No real upgrade/restart experiment or local build/test was performed for this report; the above are proposed acceptance checks.

This is a feature/design request under the current contribution policy. @etraut-openai, could you help assess whether this fits the CLI lifecycle direction or route it to the appropriate maintainer?

Activity

  1. added
    enhancement
    CLI
    session
    on Oct 10, 2026
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

    CLIenhancementsession

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions