Standalone installer on macOS misclassifies npm installs under /usr/local as Homebrew and selects the wrong uninstall command
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 88/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
調査の方向性
まず scripts/install/install.sh の classify_existing_codex() と handle_conflicting_install() から始め、次に scripts/install/test_install_sh.py のインストーラーのケースを読みます。最初に Python のインストーラーテストを実行し、Darwin における npm と Homebrew の分類を再現して現在の失敗を確認します。回帰テストが /usr/local 配下の npm launcher をカバーし、正当な Homebrew の検出を維持し、実際の package manager を呼び出さずに選択されたアンインストールコマンドを検証すれば、変更は完了입니다。
索引モデルが issue の本文から書いたものです。
説明
Summary
The standalone CLI installer incorrectly identifies an npm-managed Codex executable under /usr/local/bin as Homebrew-managed on macOS. If a user accepts the offer to remove the previous installation, it selects brew uninstall --cask codex instead of npm uninstall -g @openai/codex.
This affects a normal npm global-install layout on macOS, particularly Intel Macs using the default /usr/local prefix. It can leave the old npm installation in place after migration, or attempt to uninstall a separate Homebrew installation if one exists.
Version / environment
Source reviewed: main at 065e18b. Verified the installer functions in an isolated Linux shell with the macOS branch selected (os=darwin), an npm-style symlink, and mocked package managers. A full native macOS install was not run.
Reproduction
On a macOS machine where command -v codex resolves to /usr/local/bin/codex and that symlink points to the npm package's bin/codex.js:
- Start the standalone installer.
- Observe its existing-install detection. No uninstallation is needed to reproduce the incorrect detection.
Alternatively, in a checkout of the pinned revision, run this non-destructive function-level reproduction with the npm installation present:
eval "$(sed -n '/^classify_existing_codex() {$/,/^}$/p' scripts/install/install.sh)"
os=darwin
BIN_PATH="$HOME/.local/bin/codex"
classify_existing_codex /usr/local/bin/codex
Expected: npm (or an unknown classification if ownership cannot be established).
Actual: brew.
The isolated test used a real symlink to a fixture with the Node shebang and mocked the user's acceptance and both uninstall commands. Observed output:
existing: /usr/local/bin/codex
shebang: #!/usr/bin/env node
OS branch: linux
Detected existing npm-managed Codex at /usr/local/bin/codex
Running: npm uninstall -g @openai/codex
mock npm: uninstall -g @openai/codex
OS branch: darwin
Detected existing brew-managed Codex at /usr/local/bin/codex
Running: brew uninstall --cask codex
mock brew: uninstall --cask codex
No real package was uninstalled.
Root cause
classify_existing_codex(), install.sh:1003–1034 returns brew for any path under /usr/local/* or /opt/homebrew/* on Darwin, before checking the Node shebang or actual package ownership. The directory prefix is not unique to Homebrew.
handle_conflicting_install(), install.sh:1106–1131 then chooses the uninstall command based on that classification.
Suggested fix
Resolve the existing executable's symlink and establish package-manager ownership before offering an uninstall. In particular, recognize a verified npm Codex launcher before the Homebrew heuristic, and require positive Homebrew cask ownership evidence instead of a shared directory prefix. For ambiguous ownership, warn about PATH conflicts without offering an automatic uninstall.
Add a regression case to scripts/install/test_install_sh.py: Darwin + npm launcher at a shared prefix must not yield brew; genuine Homebrew installs should still be recognized. Mock uninstall commands and assert the chosen command.
Related but distinct: #61010 concerned a native mise wrapper incorrectly detected by a whole-file shebang search; this report concerns the earlier unconditional Darwin prefix classification, which remains in the current source. #24035 concerns self-update dispatch on Linux rather than the standalone installer's uninstall selection.
- 主要言語
- Rust
- スター
- 136k
- フォーク
- 21.6k
- 平均マージ
- 1分
- マージ済み PR(30日)
- 999
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
openai/codex のほかの issue
-
bug CLI subagent
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
bug CLI exec subagent
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
bug CLI subagent
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
Bug: codex exec --json silently drops SendMessage, FollowupTask, InterruptAgent, and ListAgents collab_tool_call items対応中かも @akhil9tiet が今日担当しました。 オープンbug CLI exec subagent
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
openai/codex#64533 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
WebSocket client ignores x-codex-turn-state in codex.response.metadata対応中かも @akhil9tiet が今日担当しました。 オープンbug CLI connectivity
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
openai/codex#64479 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
似ている issue
-
nightly-cleanup
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
max-sixty/worktrunk#4939 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[Flaky Test] tests::signer::v0::miner_recovers_when_broadcast_block_delay_across_tenures_occursオープンflaky
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
stacks-network/stacks-core#7918 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
New Mutants Foundオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
rust-bitcoin/rust-bech32#339 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
databendlabs/openraft#2554 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
autofixer: follow-up
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
tursodatabase/turso#12683 ·
メンテナーはふだん 1 日以内に返信