Prompt and gracefully restart Codex during account switches#13
Open
thatdaveguy1 wants to merge 1 commit intoLampese:mainfrom
Open
Prompt and gracefully restart Codex during account switches#13thatdaveguy1 wants to merge 1 commit intoLampese:mainfrom
thatdaveguy1 wants to merge 1 commit intoLampese:mainfrom
Conversation
Detect running Codex desktop app and CLI processes before switching accounts. If foreground processes are found, prompt the user via a native Tauri dialog and restart Codex after writing the new auth.json. Process detection: - Classify processes as DesktopApp, Cli, or Background using CodexProcessKind - Match the Electron GUI at /MacOS/Codex (capital C), not just lowercase codex - Ignore codex app-server processes (managed by the app bundle, often orphaned) - Never stop background IDE extension processes (Antigravity, VSCode, ChatGPT) Stop/restart logic: - macOS: SIGKILL the GUI PID (Codex ignores AppleScript quit and SIGTERM), poll until /MacOS/Codex is gone, then `open -a Codex` - Windows: taskkill /IM Codex.exe /F, poll, then `start Codex` - CLI processes: SIGTERM with 3s timeout on Unix, taskkill on Windows Frontend: - Use Tauri native `ask()` dialog instead of unreliable `window.confirm()` - Only count foreground processes for the restart prompt (exclude background) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
d4850ef to
9a2e41d
Compare
Owner
|
Is it really possible to reopen and restore the previous session and work? It seems there's no relevant logic in the code. I designed this feature because switching accounts could have side effects if your Codex is working. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Account switching currently force-stops Codex-related processes without an explicit user confirmation step. That can be surprising and can interrupt active work more harshly than necessary.
This PR changes the switch flow so users confirm the restart and the backend attempts a graceful close and reopen instead of using an unconditional force-kill path.
What changed
src/App.tsxwhen Codex appears to be runningprocess.rsaccount.rsto coordinate the stop and restart sequenceReviewer notes
Verification
cargo checkinsrc-tauripasses on this branch