fix(codex): prefer npm/cargo paths over WindowsApps on Windows#2630
Closed
tamish560 wants to merge 2 commits into
Closed
fix(codex): prefer npm/cargo paths over WindowsApps on Windows#2630tamish560 wants to merge 2 commits into
tamish560 wants to merge 2 commits into
Conversation
Author
|
Closing this as a duplicate of #2583 by @somewherelostt, which was opened two days earlier and addresses the same issue (#2582) with the same approach. Should have checked for existing PRs before opening this one. Apologies for the noise. |
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.
What
On Windows,
ResolveCodexBinarynow checks known user-install paths (npmcodex.cmd/codex.exe, cargocodex.exe) before falling back toexec.LookPath. Whenexec.LookPathis used as a last resort, paths underWindowsAppsare skipped.Why
On Windows machines with both the WindowsApps packaged Codex and an npm-installed Codex CLI,
exec.LookPath("codex.exe")resolves to the WindowsApps executable first. That binary cannot be launched directly by AO (Access denied), so the auth probe fails and the UI incorrectly showsCodex - Needs autheven though the npm Codex CLI is logged in.Closes #2582
How
exec.LookPathonly if none exist.isWindowsAppsPathfilter to skip WindowsApps results fromexec.LookPath, since those binaries cannot be spawned directly by the daemon.TestIsWindowsAppsPathcovering forward/back slashes, case sensitivity, and non-WindowsApps paths.Testing
TestIsWindowsAppsPathpasses on all platforms (pure string matching, no Windows required).TestResolveCodexBinaryFindsNVMInstallWhenPathIsSparsestill passes (Unix path resolution unchanged).