Repository navigation
feat(cli) Restart Codex after completing update flow - #9240
dylan-hurd-oai wants to merge 1 commit into
Conversation
|
@codex review this change, in particular consider edge cases across platforms |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 99af97cd7e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| fn restart_codex(restart_args: &[OsString]) -> anyhow::Result<()> { | ||
| let Some((command, args)) = restart_args.split_first() else { | ||
| anyhow::bail!("No command found to restart Codex"); | ||
| }; | ||
| std::process::Command::new(command).args(args).status()?; |
There was a problem hiding this comment.
Handle Windows .cmd/.bat shims when restarting
On Windows, global npm/bun installs typically expose codex as a .cmd shim. The update path already uses cmd /C specifically to resolve .CMD/.BAT via PATHEXT, but restart_codex directly calls Command::new(command) with the original argv[0]. If the user started Codex via the shim (common when CODEX_MANAGED_BY_NPM/_BUN is set), command will be codex and Command::new will not execute the .cmd shim, causing the restart to fail right after a successful update. Consider mirroring the Windows cmd /C handling here or otherwise resolving .cmd/.bat shims before invoking the restart.
Useful? React with 👍 / 👎.
|
Closing this pull request because it has had no updates for more than 14 days. If you plan to continue working on it, feel free to reopen or open a new PR. |
Motivation
Description
std::env::args_os()and carry it through the exit path.handle_app_exitandrun_update_actionto accept the capturedrestart_argsand propagate them when an update runs.restart_codexwhich relaunches the saved command (command + args) after a successful update and update the user-facing message to indicate an automatic restart.codex-rs/cli/src/main.rs.Testing
just fmtincodex-rssuccessfully.just fix -p codex-clito apply lints and fixes successfully.cargo test -p codex-cliand the test suite passed (all tests green).Codex Task