fix(hub): support macOS Codex Desktop restart#912
Open
nj-zhangrui-arvin wants to merge 1 commit into
Open
Conversation
The Codex Desktop restart route already supports a Windows PowerShell script, but macOS installations can have Codex.app available without any Restart-CodexDesktop.ps1 file or pwsh. In that case the web restart control reports a missing script even though the desktop app is installed. This adds a native macOS path that detects Codex.app, reports running state via pgrep, and restarts the app with osascript plus open when no custom restart script is configured. Existing configured scripts and Windows behavior stay unchanged. Constraint: macOS users may not have PowerShell installed for the Codex Desktop restart control. Rejected: Require HAPI_CODEX_RESTART_SCRIPT on macOS | preserves the current failure mode for default installs. Confidence: medium Scope-risk: narrow Directive: Keep configured restart scripts higher priority than native macOS fallback so operators can override local app behavior. Tested: bun test hub/src/web/routes/codexDesktop.test.ts Tested: tsc -p hub/tsconfig.json --noEmit Not-tested: Manual click of restart button, to avoid restarting the active Codex desktop session during development.
There was a problem hiding this comment.
Findings
- None.
Summary
- Review mode: initial. No issues found in the modified lines. Residual risk: macOS restart behavior is only covered at helper-argument level here; native
open/osascriptbehavior is not exercised in this environment.
Testing
- Not run (automation):
bunis not available in this environment.tsc -p hub/tsconfig.json --noEmitalso could not complete because dependencies/types are not installed locally.
HAPI Bot
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.
Summary
Codex.apppaths or thecodexlauncherpgrep -x Codexosascript+openwhen no custom restart script is configuredWhy
The restart endpoint currently defaults to
Restart-CodexDesktop.ps1and PowerShell. On macOS default installs, Codex Desktop can be installed and runnable while the restart route still fails because there is no.ps1script orpwshavailable.This PR adds a macOS fallback only when
HAPI_CODEX_RESTART_SCRIPTis not configured. Operators who already provide a custom script keep that path.Related note: I found #886 already covers imported Codex sessions missing machine binding, so this PR intentionally stays scoped to the separate macOS restart failure.
Tests
bun test hub/src/web/routes/codexDesktop.test.tstsc -p hub/tsconfig.json --noEmitAI assistance disclosure
Prepared with assistance from OpenAI Codex.