Conversation
@loongphy/codex-auth-darwin-arm64
@loongphy/codex-auth-darwin-x64
@loongphy/codex-auth-linux-arm64
@loongphy/codex-auth-linux-x64
@loongphy/codex-auth-win32-arm64
@loongphy/codex-auth-win32-x64
@loongphy/codex-auth
commit: |
Greptile SummaryThis PR adds Windows-specific Codex launcher resolution to
Confidence Score: 4/5Safe to merge for the .exe and .ps1 launch paths; the .cmd/.bat direct-launch branch has outstanding reliability concerns flagged in prior review threads that remain unaddressed. The non-Windows path is unchanged. The .exe and .ps1 (powershell.exe → pwsh.exe) paths are correctly implemented with sound memory management and good test coverage. The .cmd/.bat direct-launch branch was challenged in previous review threads and those concerns are still present in the code, making the batch-file launch paths unreliable on Windows without a cmd.exe wrapper. src/cli/login.zig — specifically the .cmd/.bat branches in buildWindowsCodexLaunchAlloc and shouldRetryWindowsCodexLaunch Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[runCodexLogin on Windows] --> B[collectWindowsCodexPathsAlloc\nscan PATH for codex.*]
B --> C{Any candidates?}
C -- No --> D[hint: FileNotFound\nreturn error]
C -- Yes --> E[Iterate candidates\n.exe / .cmd / .bat first\n.ps1 last globally]
E --> F[buildWindowsCodexLaunchAlloc]
F -- .exe / .cmd / .bat --> G[argv: path login args]
F -- .ps1 --> H[buildWindowsPowerShellCodexLaunchAlloc\nprefer powershell.exe]
G --> I[std.process.spawn]
H --> I
I -- Success --> J[child.wait → ensureCodexLoginSucceeded]
J --> K[return nil / exit code error]
I -- AccessDenied + ps1 + powershell.exe --> L[rebuild with pwsh.exe]
L -- pwsh found --> I
L -- pwsh not found --> M[last_retryable_build_error\ncontinue candidate_loop]
I -- FileNotFound or AccessDenied other --> N[last_retryable_spawn_error\ncontinue candidate_loop]
I -- other error --> O[hint + return error]
E -- all candidates exhausted --> P[finalRetryableWindowsCodexLaunchFailure]
M --> P
N --> P
P --> Q[write hint + return error]
Reviews (9): Last reviewed commit: "fix(login): bypass PowerShell script pol..." | Re-trigger Greptile |
Summary
Closes #139.
Windows
codex-auth loginnow resolves Codex launchers from the verified installation paths:codex.execodex.cmdwhen available, otherwise fall back tocodex.ps1codexshell script on WindowsPATHEXTorder betweencodex.exeandcodex.cmdcodex.cmdthroughcmd.exe /D /Ccodex.ps1throughpowershell.exe -NoLogo -NoProfile -File, falling back topwsh.exewhen neededcodex